From b251209fc8b6e0b0efd7b43c84b2de7edf1cb2cf Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 4 Mar 2024 08:38:25 +0000 Subject: [PATCH] CodeGen from PR 3215 in test-repo-billy/azure-rest-api-specs Merge 9f5cfb70eafe423359d2446fff464d523367102d into d8e7a994129b4ac979c55d3033220ac221241be0 --- sdk/compute/azure-mgmt-compute/_meta.json | 9 +- .../compute/_compute_management_client.py | 64 +- .../compute/aio/_compute_management_client.py | 64 +- .../azure/mgmt/compute/models.py | 2 +- .../mgmt/compute/v2023_07_03/__init__.py | 26 + .../v2023_07_03/_compute_management_client.py | 171 + .../compute/v2023_07_03/_configuration.py | 67 + .../mgmt/compute/v2023_07_03/_metadata.json | 121 + .../azure/mgmt/compute/v2023_07_03/_patch.py | 20 + .../azure/mgmt/compute/v2023_07_03/_vendor.py | 16 + .../mgmt/compute/v2023_07_03/_version.py | 9 + .../mgmt/compute/v2023_07_03/aio/__init__.py | 23 + .../aio/_compute_management_client.py | 172 + .../compute/v2023_07_03/aio/_configuration.py | 67 + .../mgmt/compute/v2023_07_03/aio/_patch.py | 20 + .../v2023_07_03/aio/operations/__init__.py | 41 + .../v2023_07_03/aio/operations/_operations.py | 5471 +++++++++++++ .../v2023_07_03/aio/operations/_patch.py | 20 + .../compute/v2023_07_03/models/__init__.py | 263 + .../_compute_management_client_enums.py | 237 + .../compute/v2023_07_03/models/_models_py3.py | 4856 ++++++++++++ .../mgmt/compute/v2023_07_03/models/_patch.py | 20 + .../v2023_07_03/operations/__init__.py | 41 + .../v2023_07_03/operations/_operations.py | 6752 +++++++++++++++++ .../compute/v2023_07_03/operations/_patch.py | 20 + .../azure/mgmt/compute/v2023_07_03/py.typed | 1 + .../azure-mgmt-servicelinker/_meta.json | 12 +- .../mgmt/servicelinker/_configuration.py | 12 +- .../mgmt/servicelinker/_serialization.py | 119 +- .../_service_linker_management_client.py | 27 +- .../azure/mgmt/servicelinker/_vendor.py | 11 - .../azure/mgmt/servicelinker/_version.py | 2 +- .../mgmt/servicelinker/aio/_configuration.py | 12 +- .../aio/_service_linker_management_client.py | 28 +- .../servicelinker/aio/operations/__init__.py | 6 - .../_configuration_names_operations.py | 150 - .../aio/operations/_connector_operations.py | 1919 ----- .../aio/operations/_linker_operations.py | 117 +- .../aio/operations/_linkers_operations.py | 854 --- .../aio/operations/_operations.py | 12 +- .../mgmt/servicelinker/models/__init__.py | 60 +- .../mgmt/servicelinker/models/_models_py3.py | 1534 +--- ..._service_linker_management_client_enums.py | 52 - .../mgmt/servicelinker/operations/__init__.py | 6 - .../_configuration_names_operations.py | 177 - .../operations/_connector_operations.py | 2343 ------ .../operations/_linker_operations.py | 162 +- .../operations/_linkers_operations.py | 1018 --- .../servicelinker/operations/_operations.py | 16 +- .../configuration_names_list.py | 38 - .../connector_dryrun_create.py | 58 - .../connector_dryrun_delete.py | 42 - .../generated_samples/connector_dryrun_get.py | 42 - .../connector_dryrun_list.py | 42 - .../connector_dryrun_update.py | 58 - .../generated_samples/connector_list.py | 42 - .../generated_samples/connectors.py | 42 - .../generated_samples/delete_connector.py | 42 - .../generated_samples/delete_dryrun.py | 40 - .../{delete_linker.py => delete_link.py} | 7 +- .../generate_configurations.py | 42 - .../generated_samples/get_configurations.py | 2 +- .../generated_samples/get_dryrun.py | 40 - .../generated_samples/{linker.py => link.py} | 4 +- .../{linker_list.py => link_list.py} | 4 +- .../linker_generate_configurations.py | 40 - .../generated_samples/list_dryrun.py | 40 - .../generated_samples/operations_list.py | 2 +- .../generated_samples/patch_dryrun.py | 56 - .../{patch_linker.py => patch_link.py} | 4 +- .../generated_samples/put_dryrun.py | 56 - .../{put_linker.py => put_link.py} | 5 +- ...ector.py => put_link_with_secret_store.py} | 12 +- ...r.py => put_link_with_service_endpoint.py} | 25 +- .../validate_connector_success.py | 42 - ...er_success.py => validate_link_success.py} | 4 +- 76 files changed, 19004 insertions(+), 9049 deletions(-) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_metadata.json create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_vendor.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_compute_management_client_enums.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/py.typed delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{delete_linker.py => delete_link.py} (89%) delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{linker.py => link.py} (93%) rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{linker_list.py => link_list.py} (93%) delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{patch_linker.py => patch_link.py} (95%) delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{put_linker.py => put_link.py} (92%) rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{put_connector.py => put_link_with_secret_store.py} (84%) rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{patch_connector.py => put_link_with_service_endpoint.py} (65%) delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{validate_linker_success.py => validate_link_success.py} (92%) diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index 38e6f1e075f6..fe0d42ea2b22 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,12 +1,12 @@ { - "commit": "4792bce7667477529991457890b4a6b670e70508", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "98df17f623b5197973148ff32dcc0a6cac2abbb8", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/compute/resource-manager/readme.md", "package-2023-03-01-only": "2023-04-17 22:42:05 -0400 b06a6f45e472dd07c2e0dab06b1e52dfe2684c88 Microsoft.Compute/ComputeRP/stable/2023-03-01/virtualMachineScaleSet.json", "package-2023-01-02-only": "2023-06-28 00:48:15 -0400 b1d41f8dc643415d4dc6ee82bdb2fef04ef45bc9 Microsoft.Compute/DiskRP/stable/2023-01-02/snapshot.json", @@ -51,5 +51,6 @@ "package-2023-04-02-only": "2023-08-07 20:58:57 -0400 b9403296f0b0e112b0d8222ad05fd1d79ee10e03 Microsoft.Compute/DiskRP/stable/2023-04-02/snapshot.json", "package-2023-09-01-only": "2023-12-05 16:05:55 -0500 378977e71101fdf224414b86e9f7d8c776cd07ec Microsoft.Compute/ComputeRP/stable/2023-09-01/virtualMachineScaleSet.json", "package-2022-08-03-only": "2023-11-28 14:37:35 -0500 a4d77e0bd0f00b66d42940a9be143fdb38534b1e Microsoft.Compute/GalleryRP/stable/2022-08-03/sharedGallery.json", - "package-2023-10-02-only": "2023-12-19 03:18:52 -0500 4a4e7c0083937d49061641e857bc876043bb1f5b Microsoft.Compute/DiskRP/stable/2023-10-02/snapshot.json" + "package-2023-10-02-only": "2023-12-19 03:18:52 -0500 4a4e7c0083937d49061641e857bc876043bb1f5b Microsoft.Compute/DiskRP/stable/2023-10-02/snapshot.json", + "package-2023-07-03-only": "2024-02-08 13:16:01 -0500 f715b7fee5e648d06b17467b08473f6cbeee84e0 Microsoft.Compute/GalleryRP/stable/2023-07-03/sharedGallery.json" } \ 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 259e670b5762..2f120bad0eb0 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 @@ -66,17 +66,17 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'cloud_service_roles': '2022-09-04', 'cloud_services': '2022-09-04', 'cloud_services_update_domain': '2022-09-04', - 'community_galleries': '2022-08-03', - 'community_gallery_image_versions': '2022-08-03', - 'community_gallery_images': '2022-08-03', + 'community_galleries': '2023-07-03', + 'community_gallery_image_versions': '2023-07-03', + 'community_gallery_images': '2023-07-03', 'dedicated_host_groups': '2023-09-01', 'dedicated_hosts': '2023-09-01', - 'galleries': '2022-08-03', - 'gallery_application_versions': '2022-08-03', - 'gallery_applications': '2022-08-03', - 'gallery_image_versions': '2022-08-03', - 'gallery_images': '2022-08-03', - 'gallery_sharing_profile': '2022-08-03', + 'galleries': '2023-07-03', + 'gallery_application_versions': '2023-07-03', + 'gallery_applications': '2023-07-03', + 'gallery_image_versions': '2023-07-03', + 'gallery_images': '2023-07-03', + 'gallery_sharing_profile': '2023-07-03', 'images': '2023-09-01', 'log_analytics': '2023-09-01', 'operations': '2023-09-01', @@ -84,9 +84,9 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'resource_skus': '2021-07-01', 'restore_point_collections': '2023-09-01', 'restore_points': '2023-09-01', - 'shared_galleries': '2022-08-03', - 'shared_gallery_image_versions': '2022-08-03', - 'shared_gallery_images': '2022-08-03', + 'shared_galleries': '2023-07-03', + 'shared_gallery_image_versions': '2023-07-03', + 'shared_gallery_images': '2023-07-03', 'ssh_public_keys': '2023-09-01', 'usage': '2023-09-01', 'virtual_machine_extension_images': '2023-09-01', @@ -174,6 +174,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-03-01: :mod:`v2023_03_01.models` * 2023-04-02: :mod:`v2023_04_02.models` * 2023-07-01: :mod:`v2023_07_01.models` + * 2023-07-03: :mod:`v2023_07_03.models` * 2023-09-01: :mod:`v2023_09_01.models` * 2023-10-02: :mod:`v2023_10_02.models` """ @@ -303,6 +304,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-07-01': from .v2023_07_01 import models return models + elif api_version == '2023-07-03': + from .v2023_07_03 import models + return models elif api_version == '2023-09-01': from .v2023_09_01 import models return models @@ -587,6 +591,7 @@ def community_galleries(self): * 2022-01-03: :class:`CommunityGalleriesOperations` * 2022-03-03: :class:`CommunityGalleriesOperations` * 2022-08-03: :class:`CommunityGalleriesOperations` + * 2023-07-03: :class:`CommunityGalleriesOperations` """ api_version = self._get_api_version('community_galleries') if api_version == '2021-07-01': @@ -597,6 +602,8 @@ def community_galleries(self): from .v2022_03_03.operations import CommunityGalleriesOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import CommunityGalleriesOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import CommunityGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_galleries'".format(api_version)) self._config.api_version = api_version @@ -610,6 +617,7 @@ def community_gallery_image_versions(self): * 2022-01-03: :class:`CommunityGalleryImageVersionsOperations` * 2022-03-03: :class:`CommunityGalleryImageVersionsOperations` * 2022-08-03: :class:`CommunityGalleryImageVersionsOperations` + * 2023-07-03: :class:`CommunityGalleryImageVersionsOperations` """ api_version = self._get_api_version('community_gallery_image_versions') if api_version == '2021-07-01': @@ -620,6 +628,8 @@ def community_gallery_image_versions(self): from .v2022_03_03.operations import CommunityGalleryImageVersionsOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import CommunityGalleryImageVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import CommunityGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_image_versions'".format(api_version)) self._config.api_version = api_version @@ -633,6 +643,7 @@ def community_gallery_images(self): * 2022-01-03: :class:`CommunityGalleryImagesOperations` * 2022-03-03: :class:`CommunityGalleryImagesOperations` * 2022-08-03: :class:`CommunityGalleryImagesOperations` + * 2023-07-03: :class:`CommunityGalleryImagesOperations` """ api_version = self._get_api_version('community_gallery_images') if api_version == '2021-07-01': @@ -643,6 +654,8 @@ def community_gallery_images(self): from .v2022_03_03.operations import CommunityGalleryImagesOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import CommunityGalleryImagesOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import CommunityGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_images'".format(api_version)) self._config.api_version = api_version @@ -986,6 +999,7 @@ def galleries(self): * 2022-01-03: :class:`GalleriesOperations` * 2022-03-03: :class:`GalleriesOperations` * 2022-08-03: :class:`GalleriesOperations` + * 2023-07-03: :class:`GalleriesOperations` """ api_version = self._get_api_version('galleries') if api_version == '2018-06-01': @@ -1008,6 +1022,8 @@ def galleries(self): from .v2022_03_03.operations import GalleriesOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import GalleriesOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import GalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'galleries'".format(api_version)) self._config.api_version = api_version @@ -1026,6 +1042,7 @@ def gallery_application_versions(self): * 2022-01-03: :class:`GalleryApplicationVersionsOperations` * 2022-03-03: :class:`GalleryApplicationVersionsOperations` * 2022-08-03: :class:`GalleryApplicationVersionsOperations` + * 2023-07-03: :class:`GalleryApplicationVersionsOperations` """ api_version = self._get_api_version('gallery_application_versions') if api_version == '2019-03-01': @@ -1046,6 +1063,8 @@ def gallery_application_versions(self): from .v2022_03_03.operations import GalleryApplicationVersionsOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import GalleryApplicationVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import GalleryApplicationVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_application_versions'".format(api_version)) self._config.api_version = api_version @@ -1064,6 +1083,7 @@ def gallery_applications(self): * 2022-01-03: :class:`GalleryApplicationsOperations` * 2022-03-03: :class:`GalleryApplicationsOperations` * 2022-08-03: :class:`GalleryApplicationsOperations` + * 2023-07-03: :class:`GalleryApplicationsOperations` """ api_version = self._get_api_version('gallery_applications') if api_version == '2019-03-01': @@ -1084,6 +1104,8 @@ def gallery_applications(self): from .v2022_03_03.operations import GalleryApplicationsOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import GalleryApplicationsOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import GalleryApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_applications'".format(api_version)) self._config.api_version = api_version @@ -1103,6 +1125,7 @@ def gallery_image_versions(self): * 2022-01-03: :class:`GalleryImageVersionsOperations` * 2022-03-03: :class:`GalleryImageVersionsOperations` * 2022-08-03: :class:`GalleryImageVersionsOperations` + * 2023-07-03: :class:`GalleryImageVersionsOperations` """ api_version = self._get_api_version('gallery_image_versions') if api_version == '2018-06-01': @@ -1125,6 +1148,8 @@ def gallery_image_versions(self): from .v2022_03_03.operations import GalleryImageVersionsOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import GalleryImageVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import GalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_image_versions'".format(api_version)) self._config.api_version = api_version @@ -1144,6 +1169,7 @@ def gallery_images(self): * 2022-01-03: :class:`GalleryImagesOperations` * 2022-03-03: :class:`GalleryImagesOperations` * 2022-08-03: :class:`GalleryImagesOperations` + * 2023-07-03: :class:`GalleryImagesOperations` """ api_version = self._get_api_version('gallery_images') if api_version == '2018-06-01': @@ -1166,6 +1192,8 @@ def gallery_images(self): from .v2022_03_03.operations import GalleryImagesOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import GalleryImagesOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import GalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_images'".format(api_version)) self._config.api_version = api_version @@ -1181,6 +1209,7 @@ def gallery_sharing_profile(self): * 2022-01-03: :class:`GallerySharingProfileOperations` * 2022-03-03: :class:`GallerySharingProfileOperations` * 2022-08-03: :class:`GallerySharingProfileOperations` + * 2023-07-03: :class:`GallerySharingProfileOperations` """ api_version = self._get_api_version('gallery_sharing_profile') if api_version == '2020-09-30': @@ -1195,6 +1224,8 @@ def gallery_sharing_profile(self): from .v2022_03_03.operations import GallerySharingProfileOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import GallerySharingProfileOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import GallerySharingProfileOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_sharing_profile'".format(api_version)) self._config.api_version = api_version @@ -1589,6 +1620,7 @@ def shared_galleries(self): * 2022-01-03: :class:`SharedGalleriesOperations` * 2022-03-03: :class:`SharedGalleriesOperations` * 2022-08-03: :class:`SharedGalleriesOperations` + * 2023-07-03: :class:`SharedGalleriesOperations` """ api_version = self._get_api_version('shared_galleries') if api_version == '2020-09-30': @@ -1601,6 +1633,8 @@ def shared_galleries(self): from .v2022_03_03.operations import SharedGalleriesOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import SharedGalleriesOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import SharedGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_galleries'".format(api_version)) self._config.api_version = api_version @@ -1615,6 +1649,7 @@ def shared_gallery_image_versions(self): * 2022-01-03: :class:`SharedGalleryImageVersionsOperations` * 2022-03-03: :class:`SharedGalleryImageVersionsOperations` * 2022-08-03: :class:`SharedGalleryImageVersionsOperations` + * 2023-07-03: :class:`SharedGalleryImageVersionsOperations` """ api_version = self._get_api_version('shared_gallery_image_versions') if api_version == '2020-09-30': @@ -1627,6 +1662,8 @@ def shared_gallery_image_versions(self): from .v2022_03_03.operations import SharedGalleryImageVersionsOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import SharedGalleryImageVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import SharedGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_image_versions'".format(api_version)) self._config.api_version = api_version @@ -1641,6 +1678,7 @@ def shared_gallery_images(self): * 2022-01-03: :class:`SharedGalleryImagesOperations` * 2022-03-03: :class:`SharedGalleryImagesOperations` * 2022-08-03: :class:`SharedGalleryImagesOperations` + * 2023-07-03: :class:`SharedGalleryImagesOperations` """ api_version = self._get_api_version('shared_gallery_images') if api_version == '2020-09-30': @@ -1653,6 +1691,8 @@ def shared_gallery_images(self): from .v2022_03_03.operations import SharedGalleryImagesOperations as OperationClass elif api_version == '2022-08-03': from .v2022_08_03.operations import SharedGalleryImagesOperations as OperationClass + elif api_version == '2023-07-03': + from .v2023_07_03.operations import SharedGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_images'".format(api_version)) self._config.api_version = 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 96aa52711b78..aa4273240504 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 @@ -66,17 +66,17 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'cloud_service_roles': '2022-09-04', 'cloud_services': '2022-09-04', 'cloud_services_update_domain': '2022-09-04', - 'community_galleries': '2022-08-03', - 'community_gallery_image_versions': '2022-08-03', - 'community_gallery_images': '2022-08-03', + 'community_galleries': '2023-07-03', + 'community_gallery_image_versions': '2023-07-03', + 'community_gallery_images': '2023-07-03', 'dedicated_host_groups': '2023-09-01', 'dedicated_hosts': '2023-09-01', - 'galleries': '2022-08-03', - 'gallery_application_versions': '2022-08-03', - 'gallery_applications': '2022-08-03', - 'gallery_image_versions': '2022-08-03', - 'gallery_images': '2022-08-03', - 'gallery_sharing_profile': '2022-08-03', + 'galleries': '2023-07-03', + 'gallery_application_versions': '2023-07-03', + 'gallery_applications': '2023-07-03', + 'gallery_image_versions': '2023-07-03', + 'gallery_images': '2023-07-03', + 'gallery_sharing_profile': '2023-07-03', 'images': '2023-09-01', 'log_analytics': '2023-09-01', 'operations': '2023-09-01', @@ -84,9 +84,9 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'resource_skus': '2021-07-01', 'restore_point_collections': '2023-09-01', 'restore_points': '2023-09-01', - 'shared_galleries': '2022-08-03', - 'shared_gallery_image_versions': '2022-08-03', - 'shared_gallery_images': '2022-08-03', + 'shared_galleries': '2023-07-03', + 'shared_gallery_image_versions': '2023-07-03', + 'shared_gallery_images': '2023-07-03', 'ssh_public_keys': '2023-09-01', 'usage': '2023-09-01', 'virtual_machine_extension_images': '2023-09-01', @@ -174,6 +174,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-03-01: :mod:`v2023_03_01.models` * 2023-04-02: :mod:`v2023_04_02.models` * 2023-07-01: :mod:`v2023_07_01.models` + * 2023-07-03: :mod:`v2023_07_03.models` * 2023-09-01: :mod:`v2023_09_01.models` * 2023-10-02: :mod:`v2023_10_02.models` """ @@ -303,6 +304,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-07-01': from ..v2023_07_01 import models return models + elif api_version == '2023-07-03': + from ..v2023_07_03 import models + return models elif api_version == '2023-09-01': from ..v2023_09_01 import models return models @@ -587,6 +591,7 @@ def community_galleries(self): * 2022-01-03: :class:`CommunityGalleriesOperations` * 2022-03-03: :class:`CommunityGalleriesOperations` * 2022-08-03: :class:`CommunityGalleriesOperations` + * 2023-07-03: :class:`CommunityGalleriesOperations` """ api_version = self._get_api_version('community_galleries') if api_version == '2021-07-01': @@ -597,6 +602,8 @@ def community_galleries(self): from ..v2022_03_03.aio.operations import CommunityGalleriesOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import CommunityGalleriesOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import CommunityGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_galleries'".format(api_version)) self._config.api_version = api_version @@ -610,6 +617,7 @@ def community_gallery_image_versions(self): * 2022-01-03: :class:`CommunityGalleryImageVersionsOperations` * 2022-03-03: :class:`CommunityGalleryImageVersionsOperations` * 2022-08-03: :class:`CommunityGalleryImageVersionsOperations` + * 2023-07-03: :class:`CommunityGalleryImageVersionsOperations` """ api_version = self._get_api_version('community_gallery_image_versions') if api_version == '2021-07-01': @@ -620,6 +628,8 @@ def community_gallery_image_versions(self): from ..v2022_03_03.aio.operations import CommunityGalleryImageVersionsOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import CommunityGalleryImageVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import CommunityGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_image_versions'".format(api_version)) self._config.api_version = api_version @@ -633,6 +643,7 @@ def community_gallery_images(self): * 2022-01-03: :class:`CommunityGalleryImagesOperations` * 2022-03-03: :class:`CommunityGalleryImagesOperations` * 2022-08-03: :class:`CommunityGalleryImagesOperations` + * 2023-07-03: :class:`CommunityGalleryImagesOperations` """ api_version = self._get_api_version('community_gallery_images') if api_version == '2021-07-01': @@ -643,6 +654,8 @@ def community_gallery_images(self): from ..v2022_03_03.aio.operations import CommunityGalleryImagesOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import CommunityGalleryImagesOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import CommunityGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_images'".format(api_version)) self._config.api_version = api_version @@ -986,6 +999,7 @@ def galleries(self): * 2022-01-03: :class:`GalleriesOperations` * 2022-03-03: :class:`GalleriesOperations` * 2022-08-03: :class:`GalleriesOperations` + * 2023-07-03: :class:`GalleriesOperations` """ api_version = self._get_api_version('galleries') if api_version == '2018-06-01': @@ -1008,6 +1022,8 @@ def galleries(self): from ..v2022_03_03.aio.operations import GalleriesOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import GalleriesOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import GalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'galleries'".format(api_version)) self._config.api_version = api_version @@ -1026,6 +1042,7 @@ def gallery_application_versions(self): * 2022-01-03: :class:`GalleryApplicationVersionsOperations` * 2022-03-03: :class:`GalleryApplicationVersionsOperations` * 2022-08-03: :class:`GalleryApplicationVersionsOperations` + * 2023-07-03: :class:`GalleryApplicationVersionsOperations` """ api_version = self._get_api_version('gallery_application_versions') if api_version == '2019-03-01': @@ -1046,6 +1063,8 @@ def gallery_application_versions(self): from ..v2022_03_03.aio.operations import GalleryApplicationVersionsOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import GalleryApplicationVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import GalleryApplicationVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_application_versions'".format(api_version)) self._config.api_version = api_version @@ -1064,6 +1083,7 @@ def gallery_applications(self): * 2022-01-03: :class:`GalleryApplicationsOperations` * 2022-03-03: :class:`GalleryApplicationsOperations` * 2022-08-03: :class:`GalleryApplicationsOperations` + * 2023-07-03: :class:`GalleryApplicationsOperations` """ api_version = self._get_api_version('gallery_applications') if api_version == '2019-03-01': @@ -1084,6 +1104,8 @@ def gallery_applications(self): from ..v2022_03_03.aio.operations import GalleryApplicationsOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import GalleryApplicationsOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import GalleryApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_applications'".format(api_version)) self._config.api_version = api_version @@ -1103,6 +1125,7 @@ def gallery_image_versions(self): * 2022-01-03: :class:`GalleryImageVersionsOperations` * 2022-03-03: :class:`GalleryImageVersionsOperations` * 2022-08-03: :class:`GalleryImageVersionsOperations` + * 2023-07-03: :class:`GalleryImageVersionsOperations` """ api_version = self._get_api_version('gallery_image_versions') if api_version == '2018-06-01': @@ -1125,6 +1148,8 @@ def gallery_image_versions(self): from ..v2022_03_03.aio.operations import GalleryImageVersionsOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import GalleryImageVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import GalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_image_versions'".format(api_version)) self._config.api_version = api_version @@ -1144,6 +1169,7 @@ def gallery_images(self): * 2022-01-03: :class:`GalleryImagesOperations` * 2022-03-03: :class:`GalleryImagesOperations` * 2022-08-03: :class:`GalleryImagesOperations` + * 2023-07-03: :class:`GalleryImagesOperations` """ api_version = self._get_api_version('gallery_images') if api_version == '2018-06-01': @@ -1166,6 +1192,8 @@ def gallery_images(self): from ..v2022_03_03.aio.operations import GalleryImagesOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import GalleryImagesOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import GalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_images'".format(api_version)) self._config.api_version = api_version @@ -1181,6 +1209,7 @@ def gallery_sharing_profile(self): * 2022-01-03: :class:`GallerySharingProfileOperations` * 2022-03-03: :class:`GallerySharingProfileOperations` * 2022-08-03: :class:`GallerySharingProfileOperations` + * 2023-07-03: :class:`GallerySharingProfileOperations` """ api_version = self._get_api_version('gallery_sharing_profile') if api_version == '2020-09-30': @@ -1195,6 +1224,8 @@ def gallery_sharing_profile(self): from ..v2022_03_03.aio.operations import GallerySharingProfileOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import GallerySharingProfileOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import GallerySharingProfileOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_sharing_profile'".format(api_version)) self._config.api_version = api_version @@ -1589,6 +1620,7 @@ def shared_galleries(self): * 2022-01-03: :class:`SharedGalleriesOperations` * 2022-03-03: :class:`SharedGalleriesOperations` * 2022-08-03: :class:`SharedGalleriesOperations` + * 2023-07-03: :class:`SharedGalleriesOperations` """ api_version = self._get_api_version('shared_galleries') if api_version == '2020-09-30': @@ -1601,6 +1633,8 @@ def shared_galleries(self): from ..v2022_03_03.aio.operations import SharedGalleriesOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import SharedGalleriesOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import SharedGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_galleries'".format(api_version)) self._config.api_version = api_version @@ -1615,6 +1649,7 @@ def shared_gallery_image_versions(self): * 2022-01-03: :class:`SharedGalleryImageVersionsOperations` * 2022-03-03: :class:`SharedGalleryImageVersionsOperations` * 2022-08-03: :class:`SharedGalleryImageVersionsOperations` + * 2023-07-03: :class:`SharedGalleryImageVersionsOperations` """ api_version = self._get_api_version('shared_gallery_image_versions') if api_version == '2020-09-30': @@ -1627,6 +1662,8 @@ def shared_gallery_image_versions(self): from ..v2022_03_03.aio.operations import SharedGalleryImageVersionsOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import SharedGalleryImageVersionsOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import SharedGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_image_versions'".format(api_version)) self._config.api_version = api_version @@ -1641,6 +1678,7 @@ def shared_gallery_images(self): * 2022-01-03: :class:`SharedGalleryImagesOperations` * 2022-03-03: :class:`SharedGalleryImagesOperations` * 2022-08-03: :class:`SharedGalleryImagesOperations` + * 2023-07-03: :class:`SharedGalleryImagesOperations` """ api_version = self._get_api_version('shared_gallery_images') if api_version == '2020-09-30': @@ -1653,6 +1691,8 @@ def shared_gallery_images(self): from ..v2022_03_03.aio.operations import SharedGalleryImagesOperations as OperationClass elif api_version == '2022-08-03': from ..v2022_08_03.aio.operations import SharedGalleryImagesOperations as OperationClass + elif api_version == '2023-07-03': + from ..v2023_07_03.aio.operations import SharedGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_images'".format(api_version)) self._config.api_version = 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 93ec1f4475f8..30dac82df129 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py @@ -5,7 +5,7 @@ # license information. # -------------------------------------------------------------------------- from .v2021_07_01.models import * -from .v2022_08_03.models import * from .v2022_09_04.models import * +from .v2023_07_03.models import * from .v2023_09_01.models import * from .v2023_10_02.models import * diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/__init__.py new file mode 100644 index 000000000000..3b1b6244b237 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/__init__.py @@ -0,0 +1,26 @@ +# 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 + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComputeManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py new file mode 100644 index 000000000000..fef24235f4fe --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py @@ -0,0 +1,171 @@ +# 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, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Compute Client. + + :ivar galleries: GalleriesOperations operations + :vartype galleries: azure.mgmt.compute.v2023_07_03.operations.GalleriesOperations + :ivar gallery_images: GalleryImagesOperations operations + :vartype gallery_images: azure.mgmt.compute.v2023_07_03.operations.GalleryImagesOperations + :ivar gallery_image_versions: GalleryImageVersionsOperations operations + :vartype gallery_image_versions: + azure.mgmt.compute.v2023_07_03.operations.GalleryImageVersionsOperations + :ivar gallery_applications: GalleryApplicationsOperations operations + :vartype gallery_applications: + azure.mgmt.compute.v2023_07_03.operations.GalleryApplicationsOperations + :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations + :vartype gallery_application_versions: + azure.mgmt.compute.v2023_07_03.operations.GalleryApplicationVersionsOperations + :ivar gallery_sharing_profile: GallerySharingProfileOperations operations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2023_07_03.operations.GallerySharingProfileOperations + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: azure.mgmt.compute.v2023_07_03.operations.SharedGalleriesOperations + :ivar shared_gallery_images: SharedGalleryImagesOperations operations + :vartype shared_gallery_images: + azure.mgmt.compute.v2023_07_03.operations.SharedGalleryImagesOperations + :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2023_07_03.operations.SharedGalleryImageVersionsOperations + :ivar community_galleries: CommunityGalleriesOperations operations + :vartype community_galleries: + azure.mgmt.compute.v2023_07_03.operations.CommunityGalleriesOperations + :ivar community_gallery_images: CommunityGalleryImagesOperations operations + :vartype community_gallery_images: + azure.mgmt.compute.v2023_07_03.operations.CommunityGalleryImagesOperations + :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations + :vartype community_gallery_image_versions: + azure.mgmt.compute.v2023_07_03.operations.CommunityGalleryImageVersionsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :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. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-07-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 = 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, "2023-07-03" + ) + self.gallery_images = GalleryImagesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_image_versions = GalleryImageVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_applications = GalleryApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_application_versions = GalleryApplicationVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_sharing_profile = GallerySharingProfileOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.shared_galleries = SharedGalleriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.shared_gallery_images = SharedGalleryImagesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.community_galleries = CommunityGalleriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.community_gallery_images = CommunityGalleryImagesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + + def _send_request(self, request: 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/dpcodegen/python/send_request + + :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) -> None: + self._client.close() + + def __enter__(self) -> "ComputeManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_configuration.py new file mode 100644 index 000000000000..89a1413791ba --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ComputeManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """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. Required. + :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. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-07-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-07-03") + + 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 = api_version + 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.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/v2023_07_03/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_metadata.json new file mode 100644 index 000000000000..ee7040f75301 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_metadata.json @@ -0,0 +1,121 @@ +{ + "chosen_version": "2023-07-03", + "total_api_version_list": ["2023-07-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": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "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. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "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. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "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, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "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, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "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" + } +} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_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/v2023_07_03/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/__init__.py new file mode 100644 index 000000000000..0715f5018558 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/__init__.py @@ -0,0 +1,23 @@ +# 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 + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComputeManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py new file mode 100644 index 000000000000..3aa9a6e4ce22 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py @@ -0,0 +1,172 @@ +# 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, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +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: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Compute Client. + + :ivar galleries: GalleriesOperations operations + :vartype galleries: azure.mgmt.compute.v2023_07_03.aio.operations.GalleriesOperations + :ivar gallery_images: GalleryImagesOperations operations + :vartype gallery_images: azure.mgmt.compute.v2023_07_03.aio.operations.GalleryImagesOperations + :ivar gallery_image_versions: GalleryImageVersionsOperations operations + :vartype gallery_image_versions: + azure.mgmt.compute.v2023_07_03.aio.operations.GalleryImageVersionsOperations + :ivar gallery_applications: GalleryApplicationsOperations operations + :vartype gallery_applications: + azure.mgmt.compute.v2023_07_03.aio.operations.GalleryApplicationsOperations + :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations + :vartype gallery_application_versions: + azure.mgmt.compute.v2023_07_03.aio.operations.GalleryApplicationVersionsOperations + :ivar gallery_sharing_profile: GallerySharingProfileOperations operations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2023_07_03.aio.operations.GallerySharingProfileOperations + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: + azure.mgmt.compute.v2023_07_03.aio.operations.SharedGalleriesOperations + :ivar shared_gallery_images: SharedGalleryImagesOperations operations + :vartype shared_gallery_images: + azure.mgmt.compute.v2023_07_03.aio.operations.SharedGalleryImagesOperations + :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2023_07_03.aio.operations.SharedGalleryImageVersionsOperations + :ivar community_galleries: CommunityGalleriesOperations operations + :vartype community_galleries: + azure.mgmt.compute.v2023_07_03.aio.operations.CommunityGalleriesOperations + :ivar community_gallery_images: CommunityGalleryImagesOperations operations + :vartype community_gallery_images: + azure.mgmt.compute.v2023_07_03.aio.operations.CommunityGalleryImagesOperations + :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations + :vartype community_gallery_image_versions: + azure.mgmt.compute.v2023_07_03.aio.operations.CommunityGalleryImageVersionsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :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. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-07-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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 = 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, "2023-07-03" + ) + self.gallery_images = GalleryImagesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_image_versions = GalleryImageVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_applications = GalleryApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_application_versions = GalleryApplicationVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.gallery_sharing_profile = GallerySharingProfileOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.shared_galleries = SharedGalleriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.shared_gallery_images = SharedGalleryImagesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.community_galleries = CommunityGalleriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.community_gallery_images = CommunityGalleryImagesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-07-03" + ) + + 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/dpcodegen/python/send_request + + :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: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_configuration.py new file mode 100644 index 000000000000..89c883ae7f01 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_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): # pylint: disable=too-many-instance-attributes + """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. Required. + :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. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-07-03". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-07-03") + + 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 = api_version + 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/v2023_07_03/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/__init__.py new file mode 100644 index 000000000000..322500f75325 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/__init__.py @@ -0,0 +1,41 @@ +# 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 ._operations import GalleriesOperations +from ._operations import GalleryImagesOperations +from ._operations import GalleryImageVersionsOperations +from ._operations import GalleryApplicationsOperations +from ._operations import GalleryApplicationVersionsOperations +from ._operations import GallerySharingProfileOperations +from ._operations import SharedGalleriesOperations +from ._operations import SharedGalleryImagesOperations +from ._operations import SharedGalleryImageVersionsOperations +from ._operations import CommunityGalleriesOperations +from ._operations import CommunityGalleryImagesOperations +from ._operations import CommunityGalleryImageVersionsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "GalleriesOperations", + "GalleryImagesOperations", + "GalleryImageVersionsOperations", + "GalleryApplicationsOperations", + "GalleryApplicationVersionsOperations", + "GallerySharingProfileOperations", + "SharedGalleriesOperations", + "SharedGalleryImagesOperations", + "SharedGalleryImageVersionsOperations", + "CommunityGalleriesOperations", + "CommunityGalleryImagesOperations", + "CommunityGalleryImageVersionsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py new file mode 100644 index 000000000000..9b5f0c7e2b5d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py @@ -0,0 +1,5471 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +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._operations import ( + build_community_galleries_get_request, + build_community_gallery_image_versions_get_request, + build_community_gallery_image_versions_list_request, + build_community_gallery_images_get_request, + build_community_gallery_images_list_request, + build_galleries_create_or_update_request, + build_galleries_delete_request, + build_galleries_get_request, + build_galleries_list_by_resource_group_request, + build_galleries_list_request, + build_galleries_update_request, + build_gallery_application_versions_create_or_update_request, + build_gallery_application_versions_delete_request, + build_gallery_application_versions_get_request, + build_gallery_application_versions_list_by_gallery_application_request, + build_gallery_application_versions_update_request, + build_gallery_applications_create_or_update_request, + build_gallery_applications_delete_request, + build_gallery_applications_get_request, + build_gallery_applications_list_by_gallery_request, + build_gallery_applications_update_request, + build_gallery_image_versions_create_or_update_request, + build_gallery_image_versions_delete_request, + build_gallery_image_versions_get_request, + build_gallery_image_versions_list_by_gallery_image_request, + build_gallery_image_versions_update_request, + build_gallery_images_create_or_update_request, + build_gallery_images_delete_request, + build_gallery_images_get_request, + build_gallery_images_list_by_gallery_request, + build_gallery_images_update_request, + build_gallery_sharing_profile_update_request, + build_shared_galleries_get_request, + build_shared_galleries_list_request, + build_shared_gallery_image_versions_get_request, + build_shared_gallery_image_versions_list_request, + build_shared_gallery_images_get_request, + build_shared_gallery_images_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO], **kwargs: Any + ) -> _models.Gallery: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery, (IOBase, bytes)): + _content = gallery + else: + _json = self._serialize.body(gallery, "Gallery") + + request = build_galleries_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: _models.Gallery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.Gallery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is + either a Gallery type or a IO type. Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.Gallery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Gallery", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + async def _update_initial( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.GalleryUpdate, IO], **kwargs: Any + ) -> _models.Gallery: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery, (IOBase, bytes)): + _content = gallery + else: + _json = self._serialize.body(gallery, "GalleryUpdate") + + request = build_galleries_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: _models.GalleryUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.GalleryUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.GalleryUpdate, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Gallery]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is either a + GalleryUpdate type or a IO type. Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.GalleryUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery=gallery, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Gallery", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :keyword select: The select expression to apply on the operation. "Permissions" Default value + is None. + :paramtype select: str or ~azure.mgmt.compute.v2023_07_03.models.SelectPermissions + :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.Gallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + request = build_galleries_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + select=select, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_galleries_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery to be deleted. Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Gallery"]: + """List galleries under a resource group. + + :param resource_group_name: The name of the resource group. Required. + :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 Gallery or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_galleries_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Gallery"]: + """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 Gallery or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_galleries_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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"} + + +class GalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`gallery_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, IO], + **kwargs: Any + ) -> _models.GalleryImage: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image + else: + _json = self._serialize.body(gallery_image, "GalleryImage") + + request = build_gallery_images_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. Is + either a GalleryImage type or a IO type. Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImage or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImage", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, IO], + **kwargs: Any + ) -> _models.GalleryImage: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image + else: + _json = self._serialize.body(gallery_image, "GalleryImageUpdate") + + request = build_gallery_images_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImage]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Is either a + GalleryImageUpdate type or a IO type. Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImage", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which the Image Definitions are + to be retrieved. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :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.v2023_07_03.models.GalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + request = build_gallery_images_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_images_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be deleted. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be deleted. Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GalleryImage"]: + """List gallery image definitions in a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which Image Definitions are to + be listed. Required. + :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 GalleryImage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_images_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`gallery_image_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + 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: Union[_models.GalleryImageVersion, IO], + **kwargs: Any + ) -> _models.GalleryImageVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version + else: + _json = self._serialize.body(gallery_image_version, "GalleryImageVersion") + + request = build_gallery_image_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryImageVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Is either a GalleryImageVersion type or a IO type. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImageVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersionUpdate, IO], + **kwargs: Any + ) -> _models.GalleryImageVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version + else: + _json = self._serialize.body(gallery_image_version, "GalleryImageVersionUpdate") + + request = build_gallery_image_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryImageVersionUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Is either a GalleryImageVersionUpdate type or a IO type. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionUpdate + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImageVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + request = build_gallery_image_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_image_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be deleted. + Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + @distributed_trace + def list_by_gallery_image( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GalleryImageVersion"]: + """List gallery image versions in a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :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. Required. + :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 GalleryImageVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImageVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_image_versions_list_by_gallery_image_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery_image.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GalleryApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`gallery_applications` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, IO], + **kwargs: Any + ) -> _models.GalleryApplication: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application + else: + _json = self._serialize.body(gallery_application, "GalleryApplication") + + request = build_gallery_applications_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplication, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplication + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Is either a GalleryApplication type or a IO type. Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplication or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplication", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, IO], + **kwargs: Any + ) -> _models.GalleryApplication: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application + else: + _json = self._serialize.body(gallery_application, "GalleryApplicationUpdate") + + request = build_gallery_applications_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplicationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. Is + either a GalleryApplicationUpdate type or a IO type. Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationUpdate or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplication", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which the Application + Definitions are to be retrieved. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :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.v2023_07_03.models.GalleryApplication + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + request = build_gallery_applications_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_applications_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be deleted. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be deleted. + Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GalleryApplication"]: + """List gallery Application Definitions in a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which Application + Definitions are to be listed. Required. + :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 GalleryApplication or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplicationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_applications_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GalleryApplicationVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`gallery_application_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + 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: Union[_models.GalleryApplicationVersion, IO], + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version + else: + _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersion") + + request = build_gallery_application_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryApplicationVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Is either a GalleryApplicationVersion type or a IO type. + Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, IO], + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version + else: + _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersionUpdate") + + request = build_gallery_application_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryApplicationVersionUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Is either a GalleryApplicationVersionUpdate type or a IO type. Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryApplicationVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + request = build_gallery_application_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_application_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + deleted. Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + @distributed_trace + def list_by_gallery_application( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GalleryApplicationVersion"]: + """List gallery Application Versions in a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :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. Required. + :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 GalleryApplicationVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplicationVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_application_versions_list_by_gallery_application_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery_application.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GallerySharingProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`gallery_sharing_profile` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, IO], + **kwargs: Any + ) -> _models.SharingUpdate: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sharing_update, (IOBase, bytes)): + _content = sharing_update + else: + _json = self._serialize.body(sharing_update, "SharingUpdate") + + request = build_gallery_sharing_profile_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: _models.SharingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: ~azure.mgmt.compute.v2023_07_03.models.SharingUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 SharingUpdate or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 SharingUpdate or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Is either a + SharingUpdate type or a IO type. Required. + :type sharing_update: ~azure.mgmt.compute.v2023_07_03.models.SharingUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 SharingUpdate or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2023_07_03.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SharingUpdate", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" + } + + +class SharedGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`shared_galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any + ) -> AsyncIterable["_models.SharedGallery"]: + """List shared galleries by subscription id or tenant id. + + :param location: Resource location. Required. + :type location: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.v2023_07_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 SharedGallery or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.SharedGallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_shared_galleries_list_request( + location=location, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @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. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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.v2023_07_03.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + request = build_shared_galleries_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class SharedGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`shared_gallery_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedGalleryImage"]: + """List shared gallery images by subscription id or tenant id. + + :param location: Resource location. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.v2023_07_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 SharedGalleryImage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.SharedGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_shared_gallery_images_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @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. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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. Required. + :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.v2023_07_03.models.SharedGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) + + request = build_shared_gallery_images_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class SharedGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`shared_gallery_image_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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.SharedGalleryImageVersion"]: + """List shared gallery image versions by subscription id or tenant id. + + :param location: Resource location. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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. Required. + :type gallery_image_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.v2023_07_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 SharedGalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.SharedGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImageVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_shared_gallery_image_versions_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @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. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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. Required. + :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:``. Required. + :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.v2023_07_03.models.SharedGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) + + request = build_shared_gallery_image_versions_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class CommunityGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`community_galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :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.v2023_07_03.models.CommunityGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) + + request = build_community_galleries_get_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class CommunityGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`community_gallery_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :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.v2023_07_03.models.CommunityGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) + + request = build_community_gallery_images_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CommunityGalleryImage"]: + """List community gallery images inside a gallery. + + :param location: Resource location. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :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 CommunityGalleryImage or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_community_gallery_images_list_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class CommunityGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.aio.ComputeManagementClient`'s + :attr:`community_gallery_image_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :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:``. Required. + :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.v2023_07_03.models.CommunityGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + + request = build_community_gallery_image_versions_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CommunityGalleryImageVersion"]: + """List community gallery image versions inside an image. + + :param location: Resource location. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :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 CommunityGalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImageVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_community_gallery_image_versions_list_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/__init__.py new file mode 100644 index 000000000000..515d7cc6390f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/__init__.py @@ -0,0 +1,263 @@ +# 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 CommunityGalleryImageIdentifier +from ._models_py3 import CommunityGalleryImageList +from ._models_py3 import CommunityGalleryImageVersion +from ._models_py3 import CommunityGalleryImageVersionList +from ._models_py3 import CommunityGalleryInfo +from ._models_py3 import CommunityGalleryMetadata +from ._models_py3 import DataDiskImageEncryption +from ._models_py3 import Disallowed +from ._models_py3 import DiskImageEncryption +from ._models_py3 import EncryptionImages +from ._models_py3 import ExtendedLocation +from ._models_py3 import Gallery +from ._models_py3 import GalleryApplication +from ._models_py3 import GalleryApplicationCustomAction +from ._models_py3 import GalleryApplicationCustomActionParameter +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 GalleryApplicationVersionSafetyProfile +from ._models_py3 import GalleryApplicationVersionUpdate +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSafetyProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryArtifactVersionFullSource +from ._models_py3 import GalleryArtifactVersionSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryDiskImageSource +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 GalleryImageVersionSafetyProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryImageVersionUefiSettings +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 ImageVersionSecurityProfile +from ._models_py3 import InnerError +from ._models_py3 import LatestGalleryImageVersion +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 PolicyViolation +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 ResourceWithOptionalLocation +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 SubResource +from ._models_py3 import SubResourceReadOnly +from ._models_py3 import SystemData +from ._models_py3 import TargetRegion +from ._models_py3 import UefiKey +from ._models_py3 import UefiKeySignatures +from ._models_py3 import UpdateResourceDefinition +from ._models_py3 import UserArtifactManage +from ._models_py3 import UserArtifactSettings +from ._models_py3 import UserArtifactSource +from ._models_py3 import UserAssignedIdentitiesValue + +from ._compute_management_client_enums import AggregatedReplicationState +from ._compute_management_client_enums import Architecture +from ._compute_management_client_enums import ConfidentialVMEncryptionType +from ._compute_management_client_enums import EdgeZoneStorageAccountType +from ._compute_management_client_enums import ExtendedLocationTypes +from ._compute_management_client_enums import GalleryApplicationCustomActionParameterType +from ._compute_management_client_enums import GalleryExpandParams +from ._compute_management_client_enums import GalleryExtendedLocationType +from ._compute_management_client_enums import GalleryProvisioningState +from ._compute_management_client_enums import GallerySharingPermissionTypes +from ._compute_management_client_enums import HostCaching +from ._compute_management_client_enums import HyperVGeneration +from ._compute_management_client_enums import OperatingSystemStateTypes +from ._compute_management_client_enums import OperatingSystemTypes +from ._compute_management_client_enums import PolicyViolationCategory +from ._compute_management_client_enums import ReplicationMode +from ._compute_management_client_enums import ReplicationState +from ._compute_management_client_enums import ReplicationStatusTypes +from ._compute_management_client_enums import SelectPermissions +from ._compute_management_client_enums import SharedGalleryHostCaching +from ._compute_management_client_enums import SharedToValues +from ._compute_management_client_enums import SharingProfileGroupTypes +from ._compute_management_client_enums import SharingState +from ._compute_management_client_enums import SharingUpdateOperationTypes +from ._compute_management_client_enums import StorageAccountType +from ._compute_management_client_enums import UefiKeyType +from ._compute_management_client_enums import UefiSignatureTemplateName +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApiError", + "ApiErrorBase", + "CommunityGallery", + "CommunityGalleryImage", + "CommunityGalleryImageIdentifier", + "CommunityGalleryImageList", + "CommunityGalleryImageVersion", + "CommunityGalleryImageVersionList", + "CommunityGalleryInfo", + "CommunityGalleryMetadata", + "DataDiskImageEncryption", + "Disallowed", + "DiskImageEncryption", + "EncryptionImages", + "ExtendedLocation", + "Gallery", + "GalleryApplication", + "GalleryApplicationCustomAction", + "GalleryApplicationCustomActionParameter", + "GalleryApplicationList", + "GalleryApplicationUpdate", + "GalleryApplicationVersion", + "GalleryApplicationVersionList", + "GalleryApplicationVersionPublishingProfile", + "GalleryApplicationVersionSafetyProfile", + "GalleryApplicationVersionUpdate", + "GalleryArtifactPublishingProfileBase", + "GalleryArtifactSafetyProfileBase", + "GalleryArtifactSource", + "GalleryArtifactVersionFullSource", + "GalleryArtifactVersionSource", + "GalleryDataDiskImage", + "GalleryDiskImage", + "GalleryDiskImageSource", + "GalleryExtendedLocation", + "GalleryIdentifier", + "GalleryImage", + "GalleryImageFeature", + "GalleryImageIdentifier", + "GalleryImageList", + "GalleryImageUpdate", + "GalleryImageVersion", + "GalleryImageVersionList", + "GalleryImageVersionPublishingProfile", + "GalleryImageVersionSafetyProfile", + "GalleryImageVersionStorageProfile", + "GalleryImageVersionUefiSettings", + "GalleryImageVersionUpdate", + "GalleryList", + "GalleryOSDiskImage", + "GalleryTargetExtendedLocation", + "GalleryUpdate", + "ImagePurchasePlan", + "ImageVersionSecurityProfile", + "InnerError", + "LatestGalleryImageVersion", + "ManagedArtifact", + "OSDiskImageEncryption", + "OSDiskImageSecurityProfile", + "PirCommunityGalleryResource", + "PirResource", + "PirSharedGalleryResource", + "PolicyViolation", + "RecommendedMachineConfiguration", + "RegionalReplicationStatus", + "RegionalSharingStatus", + "ReplicationStatus", + "Resource", + "ResourceRange", + "ResourceWithOptionalLocation", + "SharedGallery", + "SharedGalleryDataDiskImage", + "SharedGalleryDiskImage", + "SharedGalleryImage", + "SharedGalleryImageList", + "SharedGalleryImageVersion", + "SharedGalleryImageVersionList", + "SharedGalleryImageVersionStorageProfile", + "SharedGalleryList", + "SharedGalleryOSDiskImage", + "SharingProfile", + "SharingProfileGroup", + "SharingStatus", + "SharingUpdate", + "SoftDeletePolicy", + "SubResource", + "SubResourceReadOnly", + "SystemData", + "TargetRegion", + "UefiKey", + "UefiKeySignatures", + "UpdateResourceDefinition", + "UserArtifactManage", + "UserArtifactSettings", + "UserArtifactSource", + "UserAssignedIdentitiesValue", + "AggregatedReplicationState", + "Architecture", + "ConfidentialVMEncryptionType", + "EdgeZoneStorageAccountType", + "ExtendedLocationTypes", + "GalleryApplicationCustomActionParameterType", + "GalleryExpandParams", + "GalleryExtendedLocationType", + "GalleryProvisioningState", + "GallerySharingPermissionTypes", + "HostCaching", + "HyperVGeneration", + "OperatingSystemStateTypes", + "OperatingSystemTypes", + "PolicyViolationCategory", + "ReplicationMode", + "ReplicationState", + "ReplicationStatusTypes", + "SelectPermissions", + "SharedGalleryHostCaching", + "SharedToValues", + "SharingProfileGroupTypes", + "SharingState", + "SharingUpdateOperationTypes", + "StorageAccountType", + "UefiKeyType", + "UefiSignatureTemplateName", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_compute_management_client_enums.py new file mode 100644 index 000000000000..09be37bb0487 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_compute_management_client_enums.py @@ -0,0 +1,237 @@ +# 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 azure.core import CaseInsensitiveEnumMeta + + +class AggregatedReplicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The architecture of the image. Applicable to OS disks only.""" + + X64 = "x64" + ARM64 = "Arm64" + + +class ConfidentialVMEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """confidential VM encryption types.""" + + ENCRYPTED_VM_GUEST_STATE_ONLY_WITH_PMK = "EncryptedVMGuestStateOnlyWithPmk" + ENCRYPTED_WITH_PMK = "EncryptedWithPmk" + ENCRYPTED_WITH_CMK = "EncryptedWithCmk" + NON_PERSISTED_TPM = "NonPersistedTPM" + + +class EdgeZoneStorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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" + STANDARD_SSD_LRS = "StandardSSD_LRS" + PREMIUM_LRS = "Premium_LRS" + + +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of extendedLocation.""" + + EDGE_ZONE = "EdgeZone" + + +class GalleryApplicationCustomActionParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the type of the custom action parameter. Possible values are: String, + ConfigurationDataBlob or LogOutputBlob. + """ + + STRING = "String" + CONFIGURATION_DATA_BLOB = "ConfigurationDataBlob" + LOG_OUTPUT_BLOB = "LogOutputBlob" + + +class GalleryExpandParams(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GalleryExpandParams.""" + + SHARING_PROFILE_GROUPS = "SharingProfile/Groups" + + +class GalleryExtendedLocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """It is type of the extended location.""" + + EDGE_ZONE = "EdgeZone" + UNKNOWN = "Unknown" + + +class GalleryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state, which only appears in the response.""" + + CREATING = "Creating" + UPDATING = "Updating" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + MIGRATING = "Migrating" + + +class GallerySharingPermissionTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This property allows you to specify the permission of sharing gallery. Possible values are: + **Private,** **Groups,** **Community.**. + """ + + PRIVATE = "Private" + GROUPS = "Groups" + COMMUNITY = "Community" + + +class HostCaching(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'.""" + + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + + +class HyperVGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only.""" + + V1 = "V1" + V2 = "V2" + + +class OperatingSystemStateTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This property allows you to specify the supported type of the OS that application is built for. + Possible values are: **Windows,** **Linux.**. + """ + + WINDOWS = "Windows" + LINUX = "Linux" + + +class PolicyViolationCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the nature of the policy violation.""" + + OTHER = "Other" + IMAGE_FLAGGED_UNSAFE = "ImageFlaggedUnsafe" + COPYRIGHT_VALIDATION = "CopyrightValidation" + IP_THEFT = "IpTheft" + + +class ReplicationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Optional parameter which specifies the mode to be used for replication. This property is not + updatable. + """ + + FULL = "Full" + SHALLOW = "Shallow" + + +class ReplicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This is the regional replication state.""" + + UNKNOWN = "Unknown" + REPLICATING = "Replicating" + COMPLETED = "Completed" + FAILED = "Failed" + + +class ReplicationStatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ReplicationStatusTypes.""" + + REPLICATION_STATUS = "ReplicationStatus" + UEFI_SETTINGS = "UefiSettings" + + +class SelectPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SelectPermissions.""" + + PERMISSIONS = "Permissions" + + +class SharedGalleryHostCaching(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'.""" + + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + + +class SharedToValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SharedToValues.""" + + TENANT = "tenant" + + +class SharingProfileGroupTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This property allows you to specify the type of sharing group. Possible values are: + **Subscriptions,** **AADTenants.**. + """ + + SUBSCRIPTIONS = "Subscriptions" + AAD_TENANTS = "AADTenants" + + +class SharingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The sharing state of the gallery, which only appears in the response.""" + + SUCCEEDED = "Succeeded" + IN_PROGRESS = "InProgress" + FAILED = "Failed" + UNKNOWN = "Unknown" + + +class SharingUpdateOperationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This property allows you to specify the operation type of gallery sharing update. Possible + values are: **Add,** **Remove,** **Reset.**. + """ + + ADD = "Add" + REMOVE = "Remove" + RESET = "Reset" + ENABLE_COMMUNITY = "EnableCommunity" + + +class StorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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" + + +class UefiKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of key signature.""" + + SHA256 = "sha256" + X509 = "x509" + + +class UefiSignatureTemplateName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of the signature template that contains default UEFI keys.""" + + NO_SIGNATURE_TEMPLATE = "NoSignatureTemplate" + MICROSOFT_UEFI_CERTIFICATE_AUTHORITY_TEMPLATE = "MicrosoftUefiCertificateAuthorityTemplate" + MICROSOFT_WINDOWS_TEMPLATE = "MicrosoftWindowsTemplate" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py new file mode 100644 index 000000000000..803bc12d0d52 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py @@ -0,0 +1,4856 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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, TYPE_CHECKING, Union + +from ... import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class ApiError(_serialization.Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2023_07_03.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2023_07_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["_models.ApiErrorBase"]] = None, + innererror: Optional["_models.InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2023_07_03.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2023_07_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().__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.target = target + self.message = message + + +class ApiErrorBase(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class PirCommunityGalleryResource(_serialization.Model): + """Base information about the community gallery resource in azure compute gallery. + + 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: Any) -> None: + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + """ + super().__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 + :ivar disclaimer: The disclaimer for a community gallery resource. + :vartype disclaimer: str + :ivar artifact_tags: The artifact tags of a community gallery resource. + :vartype artifact_tags: dict[str, str] + :ivar community_metadata: The metadata of community gallery. + :vartype community_metadata: ~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryMetadata + """ + + _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"}, + "disclaimer": {"key": "properties.disclaimer", "type": "str"}, + "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, + "community_metadata": {"key": "properties.communityMetadata", "type": "CommunityGalleryMetadata"}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + disclaimer: Optional[str] = None, + artifact_tags: Optional[Dict[str, str]] = None, + community_metadata: Optional["_models.CommunityGalleryMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + :keyword disclaimer: The disclaimer for a community gallery resource. + :paramtype disclaimer: str + :keyword artifact_tags: The artifact tags of a community gallery resource. + :paramtype artifact_tags: dict[str, str] + :keyword community_metadata: The metadata of community gallery. + :paramtype community_metadata: ~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryMetadata + """ + super().__init__(unique_id=unique_id, **kwargs) + self.disclaimer = disclaimer + self.artifact_tags = artifact_tags + self.community_metadata = community_metadata + + +class CommunityGalleryImage(PirCommunityGalleryResource): # pylint: disable=too-many-instance-attributes + """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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" and + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2023_07_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 community gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2023_07_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2023_07_03.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_03.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2023_07_03.models.Architecture + :ivar privacy_statement_uri: Privacy statement URI for the current community gallery image. + :vartype privacy_statement_uri: str + :ivar eula: The end-user license agreement for the current community gallery image. + :vartype eula: str + :ivar disclaimer: The disclaimer for a community gallery resource. + :vartype disclaimer: str + :ivar artifact_tags: The artifact tags of a community gallery resource. + :vartype artifact_tags: dict[str, 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"}, + "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": "CommunityGalleryImageIdentifier"}, + "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"}, + "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, + "eula": {"key": "properties.eula", "type": "str"}, + "disclaimer": {"key": "properties.disclaimer", "type": "str"}, + "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["_models.CommunityGalleryImageIdentifier"] = None, + recommended: Optional["_models.RecommendedMachineConfiguration"] = None, + disallowed: Optional["_models.Disallowed"] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + features: Optional[List["_models.GalleryImageFeature"]] = None, + purchase_plan: Optional["_models.ImagePurchasePlan"] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + privacy_statement_uri: Optional[str] = None, + eula: Optional[str] = None, + disclaimer: Optional[str] = None, + artifact_tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" + and "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2023_07_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 community gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2023_07_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2023_07_03.models.Disallowed + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_03.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2023_07_03.models.Architecture + :keyword privacy_statement_uri: Privacy statement URI for the current community gallery image. + :paramtype privacy_statement_uri: str + :keyword eula: The end-user license agreement for the current community gallery image. + :paramtype eula: str + :keyword disclaimer: The disclaimer for a community gallery resource. + :paramtype disclaimer: str + :keyword artifact_tags: The artifact tags of a community gallery resource. + :paramtype artifact_tags: dict[str, str] + """ + super().__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 + self.privacy_statement_uri = privacy_statement_uri + self.eula = eula + self.disclaimer = disclaimer + self.artifact_tags = artifact_tags + + +class CommunityGalleryImageIdentifier(_serialization.Model): + """This is the community gallery image definition identifier. + + :ivar publisher: The name of the gallery image definition publisher. + :vartype publisher: str + :ivar offer: The name of the gallery image definition offer. + :vartype offer: str + :ivar sku: The name of the gallery image definition SKU. + :vartype sku: str + """ + + _attribute_map = { + "publisher": {"key": "publisher", "type": "str"}, + "offer": {"key": "offer", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + } + + def __init__( + self, *, publisher: Optional[str] = None, offer: Optional[str] = None, sku: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword publisher: The name of the gallery image definition publisher. + :paramtype publisher: str + :keyword offer: The name of the gallery image definition offer. + :paramtype offer: str + :keyword sku: The name of the gallery image definition SKU. + :paramtype sku: str + """ + super().__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + + +class CommunityGalleryImageList(_serialization.Model): + """The List Community Gallery Images operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of community gallery images. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.CommunityGalleryImage"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of community gallery images. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__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.v2023_07_03.models.SharedGalleryImageVersionStorageProfile + :ivar disclaimer: The disclaimer for a community gallery resource. + :vartype disclaimer: str + :ivar artifact_tags: The artifact tags of a community gallery resource. + :vartype artifact_tags: dict[str, 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"}, + "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"}, + "disclaimer": {"key": "properties.disclaimer", "type": "str"}, + "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, + } + + 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["_models.SharedGalleryImageVersionStorageProfile"] = None, + disclaimer: Optional[str] = None, + artifact_tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :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.v2023_07_03.models.SharedGalleryImageVersionStorageProfile + :keyword disclaimer: The disclaimer for a community gallery resource. + :paramtype disclaimer: str + :keyword artifact_tags: The artifact tags of a community gallery resource. + :paramtype artifact_tags: dict[str, str] + """ + super().__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 + self.disclaimer = disclaimer + self.artifact_tags = artifact_tags + + +class CommunityGalleryImageVersionList(_serialization.Model): + """The List Community Gallery Image versions operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of community gallery image versions. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.CommunityGalleryImageVersion"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of community gallery image versions. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CommunityGalleryInfo(_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: The link to the publisher website. Visible to all users. + :vartype publisher_uri: str + :ivar publisher_contact: Community gallery publisher support email. The email address of the + publisher. Visible to all users. + :vartype publisher_contact: str + :ivar eula: End-user license agreement for community gallery image. + :vartype eula: str + :ivar public_name_prefix: The prefix of the gallery name that will be displayed publicly. + Visible to all users. + :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: Any + ) -> None: + """ + :keyword publisher_uri: The link to the publisher website. Visible to all users. + :paramtype publisher_uri: str + :keyword publisher_contact: Community gallery publisher support email. The email address of the + publisher. Visible to all users. + :paramtype publisher_contact: str + :keyword eula: End-user license agreement for community gallery image. + :paramtype eula: str + :keyword public_name_prefix: The prefix of the gallery name that will be displayed publicly. + Visible to all users. + :paramtype public_name_prefix: str + """ + super().__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 CommunityGalleryMetadata(_serialization.Model): + """The metadata of community gallery. + + All required parameters must be populated in order to send to Azure. + + :ivar publisher_uri: The publisher URI of this community gallery. + :vartype publisher_uri: str + :ivar publisher_contact: The publisher email id of this community gallery. Required. + :vartype publisher_contact: str + :ivar eula: The end-user license agreement for this community gallery. + :vartype eula: str + :ivar public_names: A list of public names the gallery has. Required. + :vartype public_names: list[str] + :ivar privacy_statement_uri: The link for the privacy statement of this community gallery from + the gallery publisher. + :vartype privacy_statement_uri: str + """ + + _validation = { + "publisher_contact": {"required": True}, + "public_names": {"required": True}, + } + + _attribute_map = { + "publisher_uri": {"key": "publisherUri", "type": "str"}, + "publisher_contact": {"key": "publisherContact", "type": "str"}, + "eula": {"key": "eula", "type": "str"}, + "public_names": {"key": "publicNames", "type": "[str]"}, + "privacy_statement_uri": {"key": "privacyStatementUri", "type": "str"}, + } + + def __init__( + self, + *, + publisher_contact: str, + public_names: List[str], + publisher_uri: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher_uri: The publisher URI of this community gallery. + :paramtype publisher_uri: str + :keyword publisher_contact: The publisher email id of this community gallery. Required. + :paramtype publisher_contact: str + :keyword eula: The end-user license agreement for this community gallery. + :paramtype eula: str + :keyword public_names: A list of public names the gallery has. Required. + :paramtype public_names: list[str] + :keyword privacy_statement_uri: The link for the privacy statement of this community gallery + from the gallery publisher. + :paramtype privacy_statement_uri: str + """ + super().__init__(**kwargs) + self.publisher_uri = publisher_uri + self.publisher_contact = publisher_contact + self.eula = eula + self.public_names = public_names + self.privacy_statement_uri = privacy_statement_uri + + +class DiskImageEncryption(_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: Any) -> None: + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ + super().__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: 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. Required. + :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: Any) -> None: + """ + :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: 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. Required. + :paramtype lun: int + """ + super().__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) + self.lun = lun + + +class Disallowed(_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: Any) -> None: + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ + super().__init__(**kwargs) + self.disk_types = disk_types + + +class EncryptionImages(_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.v2023_07_03.models.OSDiskImageEncryption + :ivar data_disk_images: A list of encryption specifications for data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2023_07_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["_models.OSDiskImageEncryption"] = None, + data_disk_images: Optional[List["_models.DataDiskImageEncryption"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword os_disk_image: Contains encryption settings for an OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2023_07_03.models.OSDiskImageEncryption + :keyword data_disk_images: A list of encryption specifications for data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2023_07_03.models.DataDiskImageEncryption] + """ + super().__init__(**kwargs) + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + + +class ExtendedLocation(_serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. "EdgeZone" + :vartype type: str or ~azure.mgmt.compute.v2023_07_03.models.ExtendedLocationTypes + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. "EdgeZone" + :paramtype type: str or ~azure.mgmt.compute.v2023_07_03.models.ExtendedLocationTypes + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class Resource(_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: Resource location. Required. + :vartype location: str + :ivar 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: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class Gallery(Resource): # pylint: disable=too-many-instance-attributes + """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: Resource location. Required. + :vartype location: str + :ivar 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.v2023_07_03.models.GalleryIdentifier + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2023_07_03.models.SharingProfile + :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. + :vartype soft_delete_policy: ~azure.mgmt.compute.v2023_07_03.models.SoftDeletePolicy + :ivar sharing_status: Sharing status of current gallery. + :vartype sharing_status: ~azure.mgmt.compute.v2023_07_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["_models.GalleryIdentifier"] = None, + sharing_profile: Optional["_models.SharingProfile"] = None, + soft_delete_policy: Optional["_models.SoftDeletePolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword 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.v2023_07_03.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2023_07_03.models.SharingProfile + :keyword soft_delete_policy: Contains information about the soft deletion policy of the + gallery. + :paramtype soft_delete_policy: ~azure.mgmt.compute.v2023_07_03.models.SoftDeletePolicy + """ + super().__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): # pylint: disable=too-many-instance-attributes + """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: Resource location. Required. + :vartype location: str + :ivar 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. Possible values are: **Windows,** **Linux.**. Known values are: + "Windows" and "Linux". + :vartype supported_os_type: str or ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemTypes + :ivar custom_actions: A list of custom actions that can be performed with all of the Gallery + Application Versions within this Gallery Application. + :vartype custom_actions: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomAction] + """ + + _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"}, + "custom_actions": {"key": "properties.customActions", "type": "[GalleryApplicationCustomAction]"}, + } + + 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, "_models.OperatingSystemTypes"]] = None, + custom_actions: Optional[List["_models.GalleryApplicationCustomAction"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword 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. Possible values are: **Windows,** **Linux.**. Known values are: + "Windows" and "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemTypes + :keyword custom_actions: A list of custom actions that can be performed with all of the Gallery + Application Versions within this Gallery Application. + :paramtype custom_actions: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomAction] + """ + super().__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 + self.custom_actions = custom_actions + + +class GalleryApplicationCustomAction(_serialization.Model): + """A custom action that can be performed with a Gallery Application Version. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the custom action. Must be unique within the Gallery Application + Version. Required. + :vartype name: str + :ivar script: The script to run when executing this custom action. Required. + :vartype script: str + :ivar description: Description to help the users understand what this custom action does. + :vartype description: str + :ivar parameters: The parameters that this custom action uses. + :vartype parameters: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomActionParameter] + """ + + _validation = { + "name": {"required": True}, + "script": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "script": {"key": "script", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "parameters": {"key": "parameters", "type": "[GalleryApplicationCustomActionParameter]"}, + } + + def __init__( + self, + *, + name: str, + script: str, + description: Optional[str] = None, + parameters: Optional[List["_models.GalleryApplicationCustomActionParameter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the custom action. Must be unique within the Gallery Application + Version. Required. + :paramtype name: str + :keyword script: The script to run when executing this custom action. Required. + :paramtype script: str + :keyword description: Description to help the users understand what this custom action does. + :paramtype description: str + :keyword parameters: The parameters that this custom action uses. + :paramtype parameters: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomActionParameter] + """ + super().__init__(**kwargs) + self.name = name + self.script = script + self.description = description + self.parameters = parameters + + +class GalleryApplicationCustomActionParameter(_serialization.Model): + """The definition of a parameter that can be passed to a custom action of a Gallery Application + Version. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the custom action. Must be unique within the Gallery Application + Version. Required. + :vartype name: str + :ivar required: Indicates whether this parameter must be passed when running the custom action. + :vartype required: bool + :ivar type: Specifies the type of the custom action parameter. Possible values are: String, + ConfigurationDataBlob or LogOutputBlob. Known values are: "String", "ConfigurationDataBlob", + and "LogOutputBlob". + :vartype type: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomActionParameterType + :ivar default_value: The default value of the parameter. Only applies to string types. + :vartype default_value: str + :ivar description: A description to help users understand what this parameter means. + :vartype description: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "required": {"key": "required", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "default_value": {"key": "defaultValue", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + required: Optional[bool] = None, + type: Optional[Union[str, "_models.GalleryApplicationCustomActionParameterType"]] = None, + default_value: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the custom action. Must be unique within the Gallery Application + Version. Required. + :paramtype name: str + :keyword required: Indicates whether this parameter must be passed when running the custom + action. + :paramtype required: bool + :keyword type: Specifies the type of the custom action parameter. Possible values are: String, + ConfigurationDataBlob or LogOutputBlob. Known values are: "String", "ConfigurationDataBlob", + and "LogOutputBlob". + :paramtype type: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomActionParameterType + :keyword default_value: The default value of the parameter. Only applies to string types. + :paramtype default_value: str + :keyword description: A description to help users understand what this parameter means. + :paramtype description: str + """ + super().__init__(**kwargs) + self.name = name + self.required = required + self.type = type + self.default_value = default_value + self.description = description + + +class GalleryApplicationList(_serialization.Model): + """The List Gallery Applications operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of Gallery Applications. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.GalleryApplication"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of Gallery Applications. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateResourceDefinition(_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: 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: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = tags + + +class GalleryApplicationUpdate(UpdateResourceDefinition): # pylint: disable=too-many-instance-attributes + """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: 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. Possible values are: **Windows,** **Linux.**. Known values are: + "Windows" and "Linux". + :vartype supported_os_type: str or ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemTypes + :ivar custom_actions: A list of custom actions that can be performed with all of the Gallery + Application Versions within this Gallery Application. + :vartype custom_actions: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomAction] + """ + + _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"}, + "custom_actions": {"key": "properties.customActions", "type": "[GalleryApplicationCustomAction]"}, + } + + 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, "_models.OperatingSystemTypes"]] = None, + custom_actions: Optional[List["_models.GalleryApplicationCustomAction"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword 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. Possible values are: **Windows,** **Linux.**. Known values are: + "Windows" and "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemTypes + :keyword custom_actions: A list of custom actions that can be performed with all of the Gallery + Application Versions within this Gallery Application. + :paramtype custom_actions: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomAction] + """ + super().__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 + self.custom_actions = custom_actions + + +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: Resource location. Required. + :vartype location: str + :ivar 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.v2023_07_03.models.GalleryApplicationVersionPublishingProfile + :ivar safety_profile: The safety profile of the Gallery Application Version. + :vartype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionSafetyProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2023_07_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", + }, + "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryApplicationVersionSafetyProfile"}, + "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["_models.GalleryApplicationVersionPublishingProfile"] = None, + safety_profile: Optional["_models.GalleryApplicationVersionSafetyProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword 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.v2023_07_03.models.GalleryApplicationVersionPublishingProfile + :keyword safety_profile: The safety profile of the Gallery Application Version. + :paramtype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionSafetyProfile + """ + super().__init__(location=location, tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.safety_profile = safety_profile + self.provisioning_state = None + self.replication_status = None + + +class GalleryApplicationVersionList(_serialization.Model): + """The List Gallery Application version operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of gallery Application Versions. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.GalleryApplicationVersion"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of gallery Application Versions. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GalleryArtifactPublishingProfileBase(_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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2023_07_03.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Known values are: "Full" and "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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["_models.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, "_models.StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, + target_extended_locations: Optional[List["_models.GalleryTargetExtendedLocation"]] = None, + **kwargs: Any + ) -> None: + """ + :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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2023_07_03.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Known values are: "Full" and "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryTargetExtendedLocation] + """ + super().__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 +): # pylint: disable=too-many-instance-attributes + """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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2023_07_03.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Known values are: "Full" and "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryTargetExtendedLocation] + :ivar source: The source image from which the Image Version is going to be created. Required. + :vartype source: ~azure.mgmt.compute.v2023_07_03.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.v2023_07_03.models.UserArtifactManage + :ivar settings: Additional settings for the VM app that contains the target package and config + file name when it is deployed to target VM or VM scale set. + :vartype settings: ~azure.mgmt.compute.v2023_07_03.models.UserArtifactSettings + :ivar advanced_settings: Optional. Additional settings to pass to the vm-application-manager + extension. For advanced use only. + :vartype advanced_settings: dict[str, str] + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool + :ivar custom_actions: A list of custom actions that can be performed with this Gallery + Application Version. + :vartype custom_actions: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomAction] + """ + + _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"}, + "settings": {"key": "settings", "type": "UserArtifactSettings"}, + "advanced_settings": {"key": "advancedSettings", "type": "{str}"}, + "enable_health_check": {"key": "enableHealthCheck", "type": "bool"}, + "custom_actions": {"key": "customActions", "type": "[GalleryApplicationCustomAction]"}, + } + + def __init__( + self, + *, + source: "_models.UserArtifactSource", + target_regions: Optional[List["_models.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, "_models.StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, + target_extended_locations: Optional[List["_models.GalleryTargetExtendedLocation"]] = None, + manage_actions: Optional["_models.UserArtifactManage"] = None, + settings: Optional["_models.UserArtifactSettings"] = None, + advanced_settings: Optional[Dict[str, str]] = None, + enable_health_check: Optional[bool] = None, + custom_actions: Optional[List["_models.GalleryApplicationCustomAction"]] = None, + **kwargs: Any + ) -> None: + """ + :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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2023_07_03.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Known values are: "Full" and "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryTargetExtendedLocation] + :keyword source: The source image from which the Image Version is going to be created. + Required. + :paramtype source: ~azure.mgmt.compute.v2023_07_03.models.UserArtifactSource + :keyword manage_actions: + :paramtype manage_actions: ~azure.mgmt.compute.v2023_07_03.models.UserArtifactManage + :keyword settings: Additional settings for the VM app that contains the target package and + config file name when it is deployed to target VM or VM scale set. + :paramtype settings: ~azure.mgmt.compute.v2023_07_03.models.UserArtifactSettings + :keyword advanced_settings: Optional. Additional settings to pass to the vm-application-manager + extension. For advanced use only. + :paramtype advanced_settings: dict[str, str] + :keyword enable_health_check: Optional. Whether or not this application reports health. + :paramtype enable_health_check: bool + :keyword custom_actions: A list of custom actions that can be performed with this Gallery + Application Version. + :paramtype custom_actions: + list[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationCustomAction] + """ + super().__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.settings = settings + self.advanced_settings = advanced_settings + self.enable_health_check = enable_health_check + self.custom_actions = custom_actions + + +class GalleryArtifactSafetyProfileBase(_serialization.Model): + """This is the safety profile of the Gallery Artifact Version. + + :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :vartype allow_deletion_of_replicated_locations: bool + """ + + _attribute_map = { + "allow_deletion_of_replicated_locations": {"key": "allowDeletionOfReplicatedLocations", "type": "bool"}, + } + + def __init__(self, *, allow_deletion_of_replicated_locations: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :paramtype allow_deletion_of_replicated_locations: bool + """ + super().__init__(**kwargs) + self.allow_deletion_of_replicated_locations = allow_deletion_of_replicated_locations + + +class GalleryApplicationVersionSafetyProfile(GalleryArtifactSafetyProfileBase): + """The safety profile of the Gallery Application Version. + + :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :vartype allow_deletion_of_replicated_locations: bool + """ + + _attribute_map = { + "allow_deletion_of_replicated_locations": {"key": "allowDeletionOfReplicatedLocations", "type": "bool"}, + } + + def __init__(self, *, allow_deletion_of_replicated_locations: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :paramtype allow_deletion_of_replicated_locations: bool + """ + super().__init__(allow_deletion_of_replicated_locations=allow_deletion_of_replicated_locations, **kwargs) + + +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: Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionPublishingProfile + :ivar safety_profile: The safety profile of the Gallery Application Version. + :vartype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionSafetyProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2023_07_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", + }, + "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryApplicationVersionSafetyProfile"}, + "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["_models.GalleryApplicationVersionPublishingProfile"] = None, + safety_profile: Optional["_models.GalleryApplicationVersionSafetyProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword 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.v2023_07_03.models.GalleryApplicationVersionPublishingProfile + :keyword safety_profile: The safety profile of the Gallery Application Version. + :paramtype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionSafetyProfile + """ + super().__init__(tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.safety_profile = safety_profile + self.provisioning_state = None + self.replication_status = None + + +class GalleryArtifactSource(_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: The managed artifact. Required. + :vartype managed_image: ~azure.mgmt.compute.v2023_07_03.models.ManagedArtifact + """ + + _validation = { + "managed_image": {"required": True}, + } + + _attribute_map = { + "managed_image": {"key": "managedImage", "type": "ManagedArtifact"}, + } + + def __init__(self, *, managed_image: "_models.ManagedArtifact", **kwargs: Any) -> None: + """ + :keyword managed_image: The managed artifact. Required. + :paramtype managed_image: ~azure.mgmt.compute.v2023_07_03.models.ManagedArtifact + """ + super().__init__(**kwargs) + self.managed_image = managed_image + + +class GalleryArtifactVersionSource(_serialization.Model): + """The gallery artifact version source. + + :ivar id: The id of the gallery artifact version source. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The id of the gallery artifact version source. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class GalleryArtifactVersionFullSource(GalleryArtifactVersionSource): + """The source of the gallery artifact version. + + :ivar id: The id of the gallery artifact version source. + :vartype id: str + :ivar community_gallery_image_id: The resource Id of the source Community Gallery Image. Only + required when using Community Gallery Image as a source. + :vartype community_gallery_image_id: str + :ivar virtual_machine_id: The resource Id of the source virtual machine. Only required when + capturing a virtual machine to source this Gallery Image Version. + :vartype virtual_machine_id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "community_gallery_image_id": {"key": "communityGalleryImageId", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + community_gallery_image_id: Optional[str] = None, + virtual_machine_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The id of the gallery artifact version source. + :paramtype id: str + :keyword community_gallery_image_id: The resource Id of the source Community Gallery Image. + Only required when using Community Gallery Image as a source. + :paramtype community_gallery_image_id: str + :keyword virtual_machine_id: The resource Id of the source virtual machine. Only required when + capturing a virtual machine to source this Gallery Image Version. + :paramtype virtual_machine_id: str + """ + super().__init__(id=id, **kwargs) + self.community_gallery_image_id = community_gallery_image_id + self.virtual_machine_id = virtual_machine_id + + +class GalleryDiskImage(_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'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.HostCaching + :ivar source: The source for the disk image. + :vartype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryDiskImageSource + """ + + _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": "GalleryDiskImageSource"}, + } + + def __init__( + self, + *, + host_caching: Optional[Union[str, "_models.HostCaching"]] = None, + source: Optional["_models.GalleryDiskImageSource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.HostCaching + :keyword source: The source for the disk image. + :paramtype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryDiskImageSource + """ + super().__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'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.HostCaching + :ivar source: The source for the disk image. + :vartype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryDiskImageSource + :ivar lun: 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. Required. + :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": "GalleryDiskImageSource"}, + "lun": {"key": "lun", "type": "int"}, + } + + def __init__( + self, + *, + lun: int, + host_caching: Optional[Union[str, "_models.HostCaching"]] = None, + source: Optional["_models.GalleryDiskImageSource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.HostCaching + :keyword source: The source for the disk image. + :paramtype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryDiskImageSource + :keyword lun: 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. Required. + :paramtype lun: int + """ + super().__init__(host_caching=host_caching, source=source, **kwargs) + self.lun = lun + + +class GalleryDiskImageSource(GalleryArtifactVersionSource): + """The source for the disk image. + + :ivar id: The id of the gallery artifact version source. + :vartype id: str + :ivar uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob + source. + :vartype uri: str + :ivar storage_account_id: The Storage Account Id that contains the vhd blob being used as a + source for this artifact version. + :vartype storage_account_id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + uri: Optional[str] = None, + storage_account_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The id of the gallery artifact version source. + :paramtype id: str + :keyword uri: The uri of the gallery artifact version source. Currently used to specify + vhd/blob source. + :paramtype uri: str + :keyword storage_account_id: The Storage Account Id that contains the vhd blob being used as a + source for this artifact version. + :paramtype storage_account_id: str + """ + super().__init__(id=id, **kwargs) + self.uri = uri + self.storage_account_id = storage_account_id + + +class GalleryExtendedLocation(_serialization.Model): + """The name of the extended location. + + :ivar name: + :vartype name: str + :ivar type: It is type of the extended location. Known values are: "EdgeZone" and "Unknown". + :vartype type: str or ~azure.mgmt.compute.v2023_07_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, "_models.GalleryExtendedLocationType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: + :paramtype name: str + :keyword type: It is type of the extended location. Known values are: "EdgeZone" and "Unknown". + :paramtype type: str or ~azure.mgmt.compute.v2023_07_03.models.GalleryExtendedLocationType + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class GalleryIdentifier(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.unique_name = None + + +class GalleryImage(Resource): # pylint: disable=too-many-instance-attributes + """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: Resource location. Required. + :vartype location: str + :ivar 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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" and + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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.v2023_07_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2023_07_03.models.GalleryImageFeature] + :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2023_07_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, "_models.OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["_models.GalleryImageIdentifier"] = None, + recommended: Optional["_models.RecommendedMachineConfiguration"] = None, + disallowed: Optional["_models.Disallowed"] = None, + purchase_plan: Optional["_models.ImagePurchasePlan"] = None, + features: Optional[List["_models.GalleryImageFeature"]] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword 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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" + and "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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.v2023_07_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2023_07_03.models.GalleryImageFeature] + :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2023_07_03.models.Architecture + """ + super().__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(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.value = value + + +class GalleryImageIdentifier(_serialization.Model): + """This is the gallery image definition identifier. + + All required parameters must be populated in order to send to Azure. + + :ivar publisher: The name of the gallery image definition publisher. Required. + :vartype publisher: str + :ivar offer: The name of the gallery image definition offer. Required. + :vartype offer: str + :ivar sku: The name of the gallery image definition SKU. Required. + :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: Any) -> None: + """ + :keyword publisher: The name of the gallery image definition publisher. Required. + :paramtype publisher: str + :keyword offer: The name of the gallery image definition offer. Required. + :paramtype offer: str + :keyword sku: The name of the gallery image definition SKU. Required. + :paramtype sku: str + """ + super().__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + + +class GalleryImageList(_serialization.Model): + """The List Gallery Images operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of Shared Image Gallery images. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.GalleryImage"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of Shared Image Gallery images. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GalleryImageUpdate(UpdateResourceDefinition): # pylint: disable=too-many-instance-attributes + """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: 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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" and + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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.v2023_07_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2023_07_03.models.GalleryImageFeature] + :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2023_07_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, "_models.OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["_models.GalleryImageIdentifier"] = None, + recommended: Optional["_models.RecommendedMachineConfiguration"] = None, + disallowed: Optional["_models.Disallowed"] = None, + purchase_plan: Optional["_models.ImagePurchasePlan"] = None, + features: Optional[List["_models.GalleryImageFeature"]] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword 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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" + and "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2023_07_03.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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.v2023_07_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2023_07_03.models.GalleryImageFeature] + :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2023_07_03.models.Architecture + """ + super().__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): # pylint: disable=too-many-instance-attributes + """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: Resource location. Required. + :vartype location: str + :ivar 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.v2023_07_03.models.GalleryImageVersionPublishingProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionStorageProfile + :ivar safety_profile: This is the safety profile of the Gallery Image Version. + :vartype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionSafetyProfile + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2023_07_03.models.ReplicationStatus + :ivar security_profile: The security profile of a gallery image version. + :vartype security_profile: ~azure.mgmt.compute.v2023_07_03.models.ImageVersionSecurityProfile + """ + + _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"}, + "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryImageVersionSafetyProfile"}, + "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, + "security_profile": {"key": "properties.securityProfile", "type": "ImageVersionSecurityProfile"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + publishing_profile: Optional["_models.GalleryImageVersionPublishingProfile"] = None, + storage_profile: Optional["_models.GalleryImageVersionStorageProfile"] = None, + safety_profile: Optional["_models.GalleryImageVersionSafetyProfile"] = None, + security_profile: Optional["_models.ImageVersionSecurityProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword 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.v2023_07_03.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionStorageProfile + :keyword safety_profile: This is the safety profile of the Gallery Image Version. + :paramtype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionSafetyProfile + :keyword security_profile: The security profile of a gallery image version. + :paramtype security_profile: ~azure.mgmt.compute.v2023_07_03.models.ImageVersionSecurityProfile + """ + super().__init__(location=location, tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.provisioning_state = None + self.storage_profile = storage_profile + self.safety_profile = safety_profile + self.replication_status = None + self.security_profile = security_profile + + +class GalleryImageVersionList(_serialization.Model): + """The List Gallery Image version operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of gallery image versions. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.GalleryImageVersion"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of gallery image versions. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2023_07_03.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Known values are: "Full" and "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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["_models.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, "_models.StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, + target_extended_locations: Optional[List["_models.GalleryTargetExtendedLocation"]] = None, + **kwargs: Any + ) -> None: + """ + :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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2023_07_03.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Known values are: "Full" and "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryTargetExtendedLocation] + """ + super().__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 GalleryImageVersionSafetyProfile(GalleryArtifactSafetyProfileBase): + """This is the safety profile of the Gallery Image Version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :vartype allow_deletion_of_replicated_locations: bool + :ivar reported_for_policy_violation: Indicates whether this image has been reported as + violating Microsoft's policies. + :vartype reported_for_policy_violation: bool + :ivar policy_violations: A list of Policy Violations that have been reported for this Gallery + Image Version. + :vartype policy_violations: list[~azure.mgmt.compute.v2023_07_03.models.PolicyViolation] + """ + + _validation = { + "reported_for_policy_violation": {"readonly": True}, + "policy_violations": {"readonly": True}, + } + + _attribute_map = { + "allow_deletion_of_replicated_locations": {"key": "allowDeletionOfReplicatedLocations", "type": "bool"}, + "reported_for_policy_violation": {"key": "reportedForPolicyViolation", "type": "bool"}, + "policy_violations": {"key": "policyViolations", "type": "[PolicyViolation]"}, + } + + def __init__(self, *, allow_deletion_of_replicated_locations: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword allow_deletion_of_replicated_locations: Indicates whether or not removing this Gallery + Image Version from replicated regions is allowed. + :paramtype allow_deletion_of_replicated_locations: bool + """ + super().__init__(allow_deletion_of_replicated_locations=allow_deletion_of_replicated_locations, **kwargs) + self.reported_for_policy_violation = None + self.policy_violations = None + + +class GalleryImageVersionStorageProfile(_serialization.Model): + """This is the storage profile of a Gallery Image Version. + + :ivar source: The source of the gallery artifact version. + :vartype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryArtifactVersionFullSource + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2023_07_03.models.GalleryDataDiskImage] + """ + + _attribute_map = { + "source": {"key": "source", "type": "GalleryArtifactVersionFullSource"}, + "os_disk_image": {"key": "osDiskImage", "type": "GalleryOSDiskImage"}, + "data_disk_images": {"key": "dataDiskImages", "type": "[GalleryDataDiskImage]"}, + } + + def __init__( + self, + *, + source: Optional["_models.GalleryArtifactVersionFullSource"] = None, + os_disk_image: Optional["_models.GalleryOSDiskImage"] = None, + data_disk_images: Optional[List["_models.GalleryDataDiskImage"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword source: The source of the gallery artifact version. + :paramtype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryArtifactVersionFullSource + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: list[~azure.mgmt.compute.v2023_07_03.models.GalleryDataDiskImage] + """ + super().__init__(**kwargs) + self.source = source + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + + +class GalleryImageVersionUefiSettings(_serialization.Model): + """Contains UEFI settings for the image version. + + :ivar signature_template_names: The name of the template(s) that contains default UEFI key + signatures that will be added to the image. + :vartype signature_template_names: list[str or + ~azure.mgmt.compute.v2023_07_03.models.UefiSignatureTemplateName] + :ivar additional_signatures: Additional UEFI key signatures that will be added to the image in + addition to the signature templates. + :vartype additional_signatures: ~azure.mgmt.compute.v2023_07_03.models.UefiKeySignatures + """ + + _attribute_map = { + "signature_template_names": {"key": "signatureTemplateNames", "type": "[str]"}, + "additional_signatures": {"key": "additionalSignatures", "type": "UefiKeySignatures"}, + } + + def __init__( + self, + *, + signature_template_names: Optional[List[Union[str, "_models.UefiSignatureTemplateName"]]] = None, + additional_signatures: Optional["_models.UefiKeySignatures"] = None, + **kwargs: Any + ) -> None: + """ + :keyword signature_template_names: The name of the template(s) that contains default UEFI key + signatures that will be added to the image. + :paramtype signature_template_names: list[str or + ~azure.mgmt.compute.v2023_07_03.models.UefiSignatureTemplateName] + :keyword additional_signatures: Additional UEFI key signatures that will be added to the image + in addition to the signature templates. + :paramtype additional_signatures: ~azure.mgmt.compute.v2023_07_03.models.UefiKeySignatures + """ + super().__init__(**kwargs) + self.signature_template_names = signature_template_names + self.additional_signatures = additional_signatures + + +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: Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionPublishingProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionStorageProfile + :ivar safety_profile: This is the safety profile of the Gallery Image Version. + :vartype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionSafetyProfile + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2023_07_03.models.ReplicationStatus + :ivar security_profile: The security profile of a gallery image version. + :vartype security_profile: ~azure.mgmt.compute.v2023_07_03.models.ImageVersionSecurityProfile + """ + + _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"}, + "safety_profile": {"key": "properties.safetyProfile", "type": "GalleryImageVersionSafetyProfile"}, + "replication_status": {"key": "properties.replicationStatus", "type": "ReplicationStatus"}, + "security_profile": {"key": "properties.securityProfile", "type": "ImageVersionSecurityProfile"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + publishing_profile: Optional["_models.GalleryImageVersionPublishingProfile"] = None, + storage_profile: Optional["_models.GalleryImageVersionStorageProfile"] = None, + safety_profile: Optional["_models.GalleryImageVersionSafetyProfile"] = None, + security_profile: Optional["_models.ImageVersionSecurityProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword 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.v2023_07_03.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionStorageProfile + :keyword safety_profile: This is the safety profile of the Gallery Image Version. + :paramtype safety_profile: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionSafetyProfile + :keyword security_profile: The security profile of a gallery image version. + :paramtype security_profile: ~azure.mgmt.compute.v2023_07_03.models.ImageVersionSecurityProfile + """ + super().__init__(tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.provisioning_state = None + self.storage_profile = storage_profile + self.safety_profile = safety_profile + self.replication_status = None + self.security_profile = security_profile + + +class GalleryList(_serialization.Model): + """The List Galleries operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of galleries. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.Gallery"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of galleries. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__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'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.HostCaching + :ivar source: The source for the disk image. + :vartype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryDiskImageSource + """ + + _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": "GalleryDiskImageSource"}, + } + + def __init__( + self, + *, + host_caching: Optional[Union[str, "_models.HostCaching"]] = None, + source: Optional["_models.GalleryDiskImageSource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.HostCaching + :keyword source: The source for the disk image. + :paramtype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryDiskImageSource + """ + super().__init__(host_caching=host_caching, source=source, **kwargs) + + +class GalleryTargetExtendedLocation(_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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", + "StandardSSD_LRS", and "Premium_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2023_07_03.models.EdgeZoneStorageAccountType + :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.v2023_07_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["_models.GalleryExtendedLocation"] = None, + extended_location_replica_count: Optional[int] = None, + storage_account_type: Optional[Union[str, "_models.EdgeZoneStorageAccountType"]] = None, + encryption: Optional["_models.EncryptionImages"] = None, + **kwargs: Any + ) -> None: + """ + :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.v2023_07_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. Known values are: "Standard_LRS", "Standard_ZRS", + "StandardSSD_LRS", and "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2023_07_03.models.EdgeZoneStorageAccountType + :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.v2023_07_03.models.EncryptionImages + """ + super().__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: 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.v2023_07_03.models.GalleryIdentifier + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Deleting", and "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2023_07_03.models.GalleryProvisioningState + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2023_07_03.models.SharingProfile + :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. + :vartype soft_delete_policy: ~azure.mgmt.compute.v2023_07_03.models.SoftDeletePolicy + :ivar sharing_status: Sharing status of current gallery. + :vartype sharing_status: ~azure.mgmt.compute.v2023_07_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["_models.GalleryIdentifier"] = None, + sharing_profile: Optional["_models.SharingProfile"] = None, + soft_delete_policy: Optional["_models.SoftDeletePolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword 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.v2023_07_03.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2023_07_03.models.SharingProfile + :keyword soft_delete_policy: Contains information about the soft deletion policy of the + gallery. + :paramtype soft_delete_policy: ~azure.mgmt.compute.v2023_07_03.models.SoftDeletePolicy + """ + super().__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(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + + +class ImageVersionSecurityProfile(_serialization.Model): + """The security profile of a gallery image version. + + :ivar uefi_settings: Contains UEFI settings for the image version. + :vartype uefi_settings: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionUefiSettings + """ + + _attribute_map = { + "uefi_settings": {"key": "uefiSettings", "type": "GalleryImageVersionUefiSettings"}, + } + + def __init__( + self, *, uefi_settings: Optional["_models.GalleryImageVersionUefiSettings"] = None, **kwargs: Any + ) -> None: + """ + :keyword uefi_settings: Contains UEFI settings for the image version. + :paramtype uefi_settings: + ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionUefiSettings + """ + super().__init__(**kwargs) + self.uefi_settings = uefi_settings + + +class InnerError(_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: Any + ) -> None: + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ + super().__init__(**kwargs) + self.exceptiontype = exceptiontype + self.errordetail = errordetail + + +class LatestGalleryImageVersion(_serialization.Model): + """The gallery image version with latest version in a particular region. + + :ivar latest_version_name: The name of the latest version in the region. + :vartype latest_version_name: str + :ivar location: region of the Gallery Image Version. + :vartype location: str + """ + + _attribute_map = { + "latest_version_name": {"key": "latestVersionName", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, *, latest_version_name: Optional[str] = None, location: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword latest_version_name: The name of the latest version in the region. + :paramtype latest_version_name: str + :keyword location: region of the Gallery Image Version. + :paramtype location: str + """ + super().__init__(**kwargs) + self.latest_version_name = latest_version_name + self.location = location + + +class ManagedArtifact(_serialization.Model): + """The managed artifact. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The managed artifact id. Required. + :vartype id: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The managed artifact id. Required. + :paramtype id: str + """ + super().__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.v2023_07_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["_models.OSDiskImageSecurityProfile"] = None, + **kwargs: Any + ) -> None: + """ + :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.v2023_07_03.models.OSDiskImageSecurityProfile + """ + super().__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) + self.security_profile = security_profile + + +class OSDiskImageSecurityProfile(_serialization.Model): + """Contains security profile for an OS disk image. + + :ivar confidential_vm_encryption_type: confidential VM encryption types. Known values are: + "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk", and + "NonPersistedTPM". + :vartype confidential_vm_encryption_type: str or + ~azure.mgmt.compute.v2023_07_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, "_models.ConfidentialVMEncryptionType"]] = None, + secure_vm_disk_encryption_set_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword confidential_vm_encryption_type: confidential VM encryption types. Known values are: + "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk", and + "NonPersistedTPM". + :paramtype confidential_vm_encryption_type: str or + ~azure.mgmt.compute.v2023_07_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().__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(_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: Any) -> None: + """ """ + super().__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: Any) -> None: + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ + super().__init__(**kwargs) + self.unique_id = unique_id + + +class PolicyViolation(_serialization.Model): + """A policy violation reported against a gallery artifact. + + :ivar category: Describes the nature of the policy violation. Known values are: "Other", + "ImageFlaggedUnsafe", "CopyrightValidation", and "IpTheft". + :vartype category: str or ~azure.mgmt.compute.v2023_07_03.models.PolicyViolationCategory + :ivar details: Describes specific details about why this policy violation was reported. + :vartype details: str + """ + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "details": {"key": "details", "type": "str"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.PolicyViolationCategory"]] = None, + details: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Describes the nature of the policy violation. Known values are: "Other", + "ImageFlaggedUnsafe", "CopyrightValidation", and "IpTheft". + :paramtype category: str or ~azure.mgmt.compute.v2023_07_03.models.PolicyViolationCategory + :keyword details: Describes specific details about why this policy violation was reported. + :paramtype details: str + """ + super().__init__(**kwargs) + self.category = category + self.details = details + + +class RecommendedMachineConfiguration(_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.v2023_07_03.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2023_07_03.models.ResourceRange + """ + + _attribute_map = { + "v_cp_us": {"key": "vCPUs", "type": "ResourceRange"}, + "memory": {"key": "memory", "type": "ResourceRange"}, + } + + def __init__( + self, + *, + v_cp_us: Optional["_models.ResourceRange"] = None, + memory: Optional["_models.ResourceRange"] = None, + **kwargs: Any + ) -> None: + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2023_07_03.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2023_07_03.models.ResourceRange + """ + super().__init__(**kwargs) + self.v_cp_us = v_cp_us + self.memory = memory + + +class RegionalReplicationStatus(_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. Known values are: "Unknown", + "Replicating", "Completed", and "Failed". + :vartype state: str or ~azure.mgmt.compute.v2023_07_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.region = None + self.state = None + self.details = None + self.progress = None + + +class RegionalSharingStatus(_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. Known values are: "Succeeded", + "InProgress", "Failed", and "Unknown". + :vartype state: str or ~azure.mgmt.compute.v2023_07_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: Any) -> None: + """ + :keyword region: Region name. + :paramtype region: str + :keyword details: Details of gallery regional sharing failure. + :paramtype details: str + """ + super().__init__(**kwargs) + self.region = region + self.state = None + self.details = details + + +class ReplicationStatus(_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. Known values are: "Unknown", "InProgress", "Completed", and "Failed". + :vartype aggregated_state: str or + ~azure.mgmt.compute.v2023_07_03.models.AggregatedReplicationState + :ivar summary: This is a summary of replication status for each region. + :vartype summary: list[~azure.mgmt.compute.v2023_07_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.aggregated_state = None + self.summary = None + + +class ResourceRange(_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, # pylint: disable=redefined-builtin + max: Optional[int] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ + super().__init__(**kwargs) + self.min = min + self.max = max + + +class ResourceWithOptionalLocation(_serialization.Model): + """The Resource model definition with location property as optional. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar location: Resource location. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.id = None + self.name = None + self.type = None + self.tags = tags + + +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 + :ivar artifact_tags: The artifact tags of a shared gallery resource. + :vartype artifact_tags: dict[str, str] + """ + + _validation = { + "name": {"readonly": True}, + "location": {"readonly": True}, + "artifact_tags": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "unique_id": {"key": "identifier.uniqueId", "type": "str"}, + "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, + } + + def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ + super().__init__(unique_id=unique_id, **kwargs) + self.artifact_tags = None + + +class SharedGalleryDiskImage(_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'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2023_07_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, "_models.SharedGalleryHostCaching"]] = None, **kwargs: Any + ) -> None: + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.SharedGalleryHostCaching + """ + super().__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'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.SharedGalleryHostCaching + :ivar lun: 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. Required. + :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, "_models.SharedGalleryHostCaching"]] = None, **kwargs: Any + ) -> None: + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.SharedGalleryHostCaching + :keyword lun: 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. Required. + :paramtype lun: int + """ + super().__init__(host_caching=host_caching, **kwargs) + self.lun = lun + + +class SharedGalleryImage(PirSharedGalleryResource): # pylint: disable=too-many-instance-attributes + """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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" and + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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.v2023_07_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2023_07_03.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_03.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :ivar architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2023_07_03.models.Architecture + :ivar privacy_statement_uri: Privacy statement uri for the current community gallery image. + :vartype privacy_statement_uri: str + :ivar eula: End-user license agreement for the current community gallery image. + :vartype eula: str + :ivar artifact_tags: The artifact tags of a shared gallery resource. + :vartype artifact_tags: dict[str, 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"}, + "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"}, + "privacy_statement_uri": {"key": "properties.privacyStatementUri", "type": "str"}, + "eula": {"key": "properties.eula", "type": "str"}, + "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "_models.OperatingSystemStateTypes"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["_models.GalleryImageIdentifier"] = None, + recommended: Optional["_models.RecommendedMachineConfiguration"] = None, + disallowed: Optional["_models.Disallowed"] = None, + hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, + features: Optional[List["_models.GalleryImageFeature"]] = None, + purchase_plan: Optional["_models.ImagePurchasePlan"] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + privacy_statement_uri: Optional[str] = None, + eula: Optional[str] = None, + artifact_tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :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. Possible values are: **Windows,** **Linux.**. + Known values are: "Windows" and "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2023_07_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'. Known values are: "Generalized" + and "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_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.v2023_07_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2023_07_03.models.Disallowed + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Known values are: "V1" and "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2023_07_03.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.ImagePurchasePlan + :keyword architecture: The architecture of the image. Applicable to OS disks only. Known values + are: "x64" and "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2023_07_03.models.Architecture + :keyword privacy_statement_uri: Privacy statement uri for the current community gallery image. + :paramtype privacy_statement_uri: str + :keyword eula: End-user license agreement for the current community gallery image. + :paramtype eula: str + :keyword artifact_tags: The artifact tags of a shared gallery resource. + :paramtype artifact_tags: dict[str, str] + """ + super().__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 + self.privacy_statement_uri = privacy_statement_uri + self.eula = eula + self.artifact_tags = artifact_tags + + +class SharedGalleryImageList(_serialization.Model): + """The List Shared Gallery Images operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of shared gallery images. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.SharedGalleryImage"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of shared gallery images. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__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.v2023_07_03.models.SharedGalleryImageVersionStorageProfile + :ivar artifact_tags: The artifact tags of a shared gallery resource. + :vartype artifact_tags: dict[str, 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"}, + "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"}, + "artifact_tags": {"key": "properties.artifactTags", "type": "{str}"}, + } + + 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["_models.SharedGalleryImageVersionStorageProfile"] = None, + artifact_tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :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.v2023_07_03.models.SharedGalleryImageVersionStorageProfile + :keyword artifact_tags: The artifact tags of a shared gallery resource. + :paramtype artifact_tags: dict[str, str] + """ + super().__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 + self.artifact_tags = artifact_tags + + +class SharedGalleryImageVersionList(_serialization.Model): + """The List Shared Gallery Image versions operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of shared gallery images versions. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.SharedGalleryImageVersion"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of shared gallery images versions. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SharedGalleryImageVersionStorageProfile(_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.v2023_07_03.models.SharedGalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: + list[~azure.mgmt.compute.v2023_07_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["_models.SharedGalleryOSDiskImage"] = None, + data_disk_images: Optional[List["_models.SharedGalleryDataDiskImage"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2023_07_03.models.SharedGalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2023_07_03.models.SharedGalleryDataDiskImage] + """ + super().__init__(**kwargs) + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + + +class SharedGalleryList(_serialization.Model): + """The List Shared Galleries operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: A list of shared galleries. Required. + :vartype value: list[~azure.mgmt.compute.v2023_07_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["_models.SharedGallery"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of shared galleries. Required. + :paramtype value: list[~azure.mgmt.compute.v2023_07_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().__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'. Known values are: "None", "ReadOnly", and "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2023_07_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, "_models.SharedGalleryHostCaching"]] = None, **kwargs: Any + ) -> None: + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Known values are: "None", "ReadOnly", and "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.SharedGalleryHostCaching + """ + super().__init__(host_caching=host_caching, **kwargs) + + +class SharingProfile(_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. + Possible values are: **Private,** **Groups,** **Community.**. Known values are: "Private", + "Groups", and "Community". + :vartype permissions: str or + ~azure.mgmt.compute.v2023_07_03.models.GallerySharingPermissionTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.v2023_07_03.models.SharingProfileGroup] + :ivar community_gallery_info: Information of community gallery if current gallery is shared to + community. + :vartype community_gallery_info: ~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryInfo + """ + + _validation = { + "groups": {"readonly": True}, + } + + _attribute_map = { + "permissions": {"key": "permissions", "type": "str"}, + "groups": {"key": "groups", "type": "[SharingProfileGroup]"}, + "community_gallery_info": {"key": "communityGalleryInfo", "type": "CommunityGalleryInfo"}, + } + + def __init__( + self, + *, + permissions: Optional[Union[str, "_models.GallerySharingPermissionTypes"]] = None, + community_gallery_info: Optional["_models.CommunityGalleryInfo"] = None, + **kwargs: Any + ) -> None: + """ + :keyword permissions: This property allows you to specify the permission of sharing gallery. + Possible values are: **Private,** **Groups,** **Community.**. Known values are: "Private", + "Groups", and "Community". + :paramtype permissions: str or + ~azure.mgmt.compute.v2023_07_03.models.GallerySharingPermissionTypes + :keyword community_gallery_info: Information of community gallery if current gallery is shared + to community. + :paramtype community_gallery_info: ~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryInfo + """ + super().__init__(**kwargs) + self.permissions = permissions + self.groups = None + self.community_gallery_info = community_gallery_info + + +class SharingProfileGroup(_serialization.Model): + """Group of the gallery sharing profile. + + :ivar type: This property allows you to specify the type of sharing group. Possible values are: + **Subscriptions,** **AADTenants.**. Known values are: "Subscriptions" and "AADTenants". + :vartype type: str or ~azure.mgmt.compute.v2023_07_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, "_models.SharingProfileGroupTypes"]] = None, + ids: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: This property allows you to specify the type of sharing group. Possible values + are: **Subscriptions,** **AADTenants.**. Known values are: "Subscriptions" and "AADTenants". + :paramtype type: str or ~azure.mgmt.compute.v2023_07_03.models.SharingProfileGroupTypes + :keyword ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :paramtype ids: list[str] + """ + super().__init__(**kwargs) + self.type = type + self.ids = ids + + +class SharingStatus(_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. Known values are: + "Succeeded", "InProgress", "Failed", and "Unknown". + :vartype aggregated_state: str or ~azure.mgmt.compute.v2023_07_03.models.SharingState + :ivar summary: Summary of all regional sharing status. + :vartype summary: list[~azure.mgmt.compute.v2023_07_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["_models.RegionalSharingStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword summary: Summary of all regional sharing status. + :paramtype summary: list[~azure.mgmt.compute.v2023_07_03.models.RegionalSharingStatus] + """ + super().__init__(**kwargs) + self.aggregated_state = None + self.summary = summary + + +class SharingUpdate(_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: This property allows you to specify the operation type of gallery sharing + update. Possible values are: **Add,** **Remove,** **Reset.**. Required. Known values are: + "Add", "Remove", "Reset", and "EnableCommunity". + :vartype operation_type: str or + ~azure.mgmt.compute.v2023_07_03.models.SharingUpdateOperationTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.v2023_07_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, "_models.SharingUpdateOperationTypes"], + groups: Optional[List["_models.SharingProfileGroup"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword operation_type: This property allows you to specify the operation type of gallery + sharing update. Possible values are: **Add,** **Remove,** **Reset.**. Required. Known values + are: "Add", "Remove", "Reset", and "EnableCommunity". + :paramtype operation_type: str or + ~azure.mgmt.compute.v2023_07_03.models.SharingUpdateOperationTypes + :keyword groups: A list of sharing profile groups. + :paramtype groups: list[~azure.mgmt.compute.v2023_07_03.models.SharingProfileGroup] + """ + super().__init__(**kwargs) + self.operation_type = operation_type + self.groups = groups + + +class SoftDeletePolicy(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.is_soft_delete_enabled = is_soft_delete_enabled + + +class SubResource(_serialization.Model): + """SubResource. + + :ivar id: Resource Id. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource Id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class SubResourceReadOnly(_serialization.Model): + """SubResourceReadOnly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class SystemData(_serialization.Model): + """The system meta data relating to this resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_at: Specifies the time in UTC at which the Cloud Service (extended support) + resource was created. :code:`
`Minimum api-version: 2022-04-04. + :vartype created_at: ~datetime.datetime + :ivar last_modified_at: Specifies the time in UTC at which the Cloud Service (extended support) + resource was last modified. :code:`
`Minimum api-version: 2022-04-04. + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + "created_at": {"readonly": True}, + "last_modified_at": {"readonly": True}, + } + + _attribute_map = { + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_at = None + self.last_modified_at = None + + +class TargetRegion(_serialization.Model): + """Describes the target region information. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the region. Required. + :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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.EncryptionImages + :ivar exclude_from_latest: Contains the flag setting to hide an image when users specify + version='latest'. + :vartype exclude_from_latest: bool + """ + + _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"}, + "exclude_from_latest": {"key": "excludeFromLatest", "type": "bool"}, + } + + def __init__( + self, + *, + name: str, + regional_replica_count: Optional[int] = None, + storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, + encryption: Optional["_models.EncryptionImages"] = None, + exclude_from_latest: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the region. Required. + :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. Known values are: "Standard_LRS", "Standard_ZRS", and + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.EncryptionImages + :keyword exclude_from_latest: Contains the flag setting to hide an image when users specify + version='latest'. + :paramtype exclude_from_latest: bool + """ + super().__init__(**kwargs) + self.name = name + self.regional_replica_count = regional_replica_count + self.storage_account_type = storage_account_type + self.encryption = encryption + self.exclude_from_latest = exclude_from_latest + + +class UefiKey(_serialization.Model): + """A UEFI key signature. + + :ivar type: The type of key signature. Known values are: "sha256" and "x509". + :vartype type: str or ~azure.mgmt.compute.v2023_07_03.models.UefiKeyType + :ivar value: The value of the key signature. + :vartype value: list[str] + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "value": {"key": "value", "type": "[str]"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.UefiKeyType"]] = None, + value: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of key signature. Known values are: "sha256" and "x509". + :paramtype type: str or ~azure.mgmt.compute.v2023_07_03.models.UefiKeyType + :keyword value: The value of the key signature. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.type = type + self.value = value + + +class UefiKeySignatures(_serialization.Model): + """Additional UEFI key signatures that will be added to the image in addition to the signature + templates. + + :ivar pk: The Platform Key of this image version. + :vartype pk: ~azure.mgmt.compute.v2023_07_03.models.UefiKey + :ivar kek: The Key Encryption Keys of this image version. + :vartype kek: list[~azure.mgmt.compute.v2023_07_03.models.UefiKey] + :ivar db: The database of UEFI keys for this image version. + :vartype db: list[~azure.mgmt.compute.v2023_07_03.models.UefiKey] + :ivar dbx: The database of revoked UEFI keys for this image version. + :vartype dbx: list[~azure.mgmt.compute.v2023_07_03.models.UefiKey] + """ + + _attribute_map = { + "pk": {"key": "pk", "type": "UefiKey"}, + "kek": {"key": "kek", "type": "[UefiKey]"}, + "db": {"key": "db", "type": "[UefiKey]"}, + "dbx": {"key": "dbx", "type": "[UefiKey]"}, + } + + def __init__( + self, + *, + pk: Optional["_models.UefiKey"] = None, + kek: Optional[List["_models.UefiKey"]] = None, + db: Optional[List["_models.UefiKey"]] = None, + dbx: Optional[List["_models.UefiKey"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword pk: The Platform Key of this image version. + :paramtype pk: ~azure.mgmt.compute.v2023_07_03.models.UefiKey + :keyword kek: The Key Encryption Keys of this image version. + :paramtype kek: list[~azure.mgmt.compute.v2023_07_03.models.UefiKey] + :keyword db: The database of UEFI keys for this image version. + :paramtype db: list[~azure.mgmt.compute.v2023_07_03.models.UefiKey] + :keyword dbx: The database of revoked UEFI keys for this image version. + :paramtype dbx: list[~azure.mgmt.compute.v2023_07_03.models.UefiKey] + """ + super().__init__(**kwargs) + self.pk = pk + self.kek = kek + self.db = db + self.dbx = dbx + + +class UserArtifactManage(_serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :ivar install: Required. The path and arguments to install the gallery application. This is + limited to 4096 characters. Required. + :vartype install: str + :ivar remove: Required. The path and arguments to remove the gallery application. This is + limited to 4096 characters. Required. + :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: Any) -> None: + """ + :keyword install: Required. The path and arguments to install the gallery application. This is + limited to 4096 characters. Required. + :paramtype install: str + :keyword remove: Required. The path and arguments to remove the gallery application. This is + limited to 4096 characters. Required. + :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().__init__(**kwargs) + self.install = install + self.remove = remove + self.update = update + + +class UserArtifactSettings(_serialization.Model): + """Additional settings for the VM app that contains the target package and config file name when + it is deployed to target VM or VM scale set. + + :ivar package_file_name: Optional. The name to assign the downloaded package file on the VM. + This is limited to 4096 characters. If not specified, the package file will be named the same + as the Gallery Application name. + :vartype package_file_name: str + :ivar config_file_name: Optional. The name to assign the downloaded config file on the VM. This + is limited to 4096 characters. If not specified, the config file will be named the Gallery + Application name appended with "_config". + :vartype config_file_name: str + """ + + _attribute_map = { + "package_file_name": {"key": "packageFileName", "type": "str"}, + "config_file_name": {"key": "configFileName", "type": "str"}, + } + + def __init__( + self, *, package_file_name: Optional[str] = None, config_file_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword package_file_name: Optional. The name to assign the downloaded package file on the VM. + This is limited to 4096 characters. If not specified, the package file will be named the same + as the Gallery Application name. + :paramtype package_file_name: str + :keyword config_file_name: Optional. The name to assign the downloaded config file on the VM. + This is limited to 4096 characters. If not specified, the config file will be named the Gallery + Application name appended with "_config". + :paramtype config_file_name: str + """ + super().__init__(**kwargs) + self.package_file_name = package_file_name + self.config_file_name = config_file_name + + +class UserArtifactSource(_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. The mediaLink of the artifact, must be a readable storage page + blob. Required. + :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: Any) -> None: + """ + :keyword media_link: Required. The mediaLink of the artifact, must be a readable storage page + blob. Required. + :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().__init__(**kwargs) + self.media_link = media_link + self.default_configuration_link = default_configuration_link + + +class UserAssignedIdentitiesValue(_serialization.Model): + """UserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/__init__.py new file mode 100644 index 000000000000..322500f75325 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/__init__.py @@ -0,0 +1,41 @@ +# 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 ._operations import GalleriesOperations +from ._operations import GalleryImagesOperations +from ._operations import GalleryImageVersionsOperations +from ._operations import GalleryApplicationsOperations +from ._operations import GalleryApplicationVersionsOperations +from ._operations import GallerySharingProfileOperations +from ._operations import SharedGalleriesOperations +from ._operations import SharedGalleryImagesOperations +from ._operations import SharedGalleryImageVersionsOperations +from ._operations import CommunityGalleriesOperations +from ._operations import CommunityGalleryImagesOperations +from ._operations import CommunityGalleryImageVersionsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "GalleriesOperations", + "GalleryImagesOperations", + "GalleryImageVersionsOperations", + "GalleryApplicationsOperations", + "GalleryApplicationVersionsOperations", + "GallerySharingProfileOperations", + "SharedGalleriesOperations", + "SharedGalleryImagesOperations", + "SharedGalleryImageVersionsOperations", + "CommunityGalleriesOperations", + "CommunityGalleryImagesOperations", + "CommunityGalleryImageVersionsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py new file mode 100644 index 000000000000..732e44f30065 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py @@ -0,0 +1,6752 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_galleries_create_or_update_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_update_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_get_request( + resource_group_name: str, + gallery_name: str, + subscription_id: str, + *, + select: Optional[Union[str, _models.SelectPermissions]] = None, + expand: Optional[Union[str, _models.GalleryExpandParams]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_delete_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_galleries_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_create_or_update_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_update_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_get_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_delete_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_images_list_by_gallery_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_create_or_update_request( + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_update_request( + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_get_request( + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_delete_request( + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_image_versions_list_by_gallery_image_request( + resource_group_name: str, gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_create_or_update_request( + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_update_request( + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_get_request( + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_delete_request( + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_applications_list_by_gallery_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_create_or_update_request( + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_update_request( + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_get_request( + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ReplicationStatusTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_delete_request( + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_application_versions_list_by_gallery_application_request( + resource_group_name: str, gallery_name: str, gallery_application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gallery_sharing_profile_update_request( + resource_group_name: str, gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_galleries_list_request( + location: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_galleries_get_request( + location: str, gallery_unique_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_images_list_request( + location: str, + gallery_unique_name: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_images_get_request( + location: str, gallery_unique_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_image_versions_list_request( + location: str, + gallery_unique_name: str, + gallery_image_name: str, + subscription_id: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if shared_to is not None: + _params["sharedTo"] = _SERIALIZER.query("shared_to", shared_to, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_gallery_image_versions_get_request( + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_galleries_get_request( + location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_images_get_request( + location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_images_list_request( + location: str, public_gallery_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_image_versions_get_request( + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_community_gallery_image_versions_list_request( + location: str, public_gallery_name: str, gallery_image_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-03")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions", + ) # pylint: disable=line-too-long + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO], **kwargs: Any + ) -> _models.Gallery: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery, (IOBase, bytes)): + _content = gallery + else: + _json = self._serialize.body(gallery, "Gallery") + + request = build_galleries_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: _models.Gallery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.Gallery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + Required. + :type gallery: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.Gallery, IO], **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. Is + either a Gallery type or a IO type. Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.Gallery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery=gallery, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Gallery", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + def _update_initial( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.GalleryUpdate, IO], **kwargs: Any + ) -> _models.Gallery: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery, (IOBase, bytes)): + _content = gallery + else: + _json = self._serialize.body(gallery, "GalleryUpdate") + + request = build_galleries_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: _models.GalleryUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.GalleryUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Required. + :type gallery: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, gallery_name: str, gallery: Union[_models.GalleryUpdate, IO], **kwargs: Any + ) -> LROPoller[_models.Gallery]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. Required. + :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. + Required. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. Is either a + GalleryUpdate type or a IO type. Required. + :type gallery: ~azure.mgmt.compute.v2023_07_03.models.GalleryUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery=gallery, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Gallery", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :keyword select: The select expression to apply on the operation. "Permissions" Default value + is None. + :paramtype select: str or ~azure.mgmt.compute.v2023_07_03.models.SelectPermissions + :keyword expand: The expand query option to apply on the operation. "SharingProfile/Groups" + Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.Gallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.Gallery] = kwargs.pop("cls", None) + + request = build_galleries_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + select=select, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_galleries_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery to be deleted. Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Gallery"]: + """List galleries under a resource group. + + :param resource_group_name: The name of the resource group. Required. + :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 Gallery or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_galleries_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Gallery"]: + """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 Gallery or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.Gallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_galleries_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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"} + + +class GalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`gallery_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, IO], + **kwargs: Any + ) -> _models.GalleryImage: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image + else: + _json = self._serialize.body(gallery_image, "GalleryImage") + + request = build_gallery_images_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + Required. + :type gallery_image: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImage, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryImage]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. Is + either a GalleryImage type or a IO type. Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImage or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImage", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, IO], + **kwargs: Any + ) -> _models.GalleryImage: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image, (IOBase, bytes)): + _content = gallery_image + else: + _json = self._serialize.body(gallery_image, "GalleryImageUpdate") + + request = build_gallery_images_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: _models.GalleryImageUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImage]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImage]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Required. + :type gallery_image: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: Union[_models.GalleryImageUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryImage]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. Required. + :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. Required. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. Is either a + GalleryImageUpdate type or a IO type. Required. + :type gallery_image: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImage", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which the Image Definitions are + to be retrieved. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. Required. + :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.v2023_07_03.models.GalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + request = build_gallery_images_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_images_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be deleted. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be deleted. Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + } + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> Iterable["_models.GalleryImage"]: + """List gallery image definitions in a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which Image Definitions are to + be listed. Required. + :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 GalleryImage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_images_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`gallery_image_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + 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: Union[_models.GalleryImageVersion, IO], + **kwargs: Any + ) -> _models.GalleryImageVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version + else: + _json = self._serialize.body(gallery_image_version, "GalleryImageVersion") + + request = build_gallery_image_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Required. + :type gallery_image_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryImageVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryImageVersion]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. Is either a GalleryImageVersion type or a IO type. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImageVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: Union[_models.GalleryImageVersionUpdate, IO], + **kwargs: Any + ) -> _models.GalleryImageVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_image_version, (IOBase, bytes)): + _content = gallery_image_version + else: + _json = self._serialize.body(gallery_image_version, "GalleryImageVersionUpdate") + + request = build_gallery_image_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Required. + :type gallery_image_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryImageVersionUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryImageVersion]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. Required. + :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:``. Required. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. Is either a GalleryImageVersionUpdate type or a IO type. Required. + :type gallery_image_version: ~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersionUpdate + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryImageVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + Required. + :type gallery_image_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImageVersion] = kwargs.pop("cls", None) + + request = build_gallery_image_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_image_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. Required. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be deleted. + Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + } + + @distributed_trace + def list_by_gallery_image( + self, resource_group_name: str, gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> Iterable["_models.GalleryImageVersion"]: + """List gallery image versions in a gallery image definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. Required. + :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. Required. + :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 GalleryImageVersion or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryImageVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_image_versions_list_by_gallery_image_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery_image.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GalleryApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`gallery_applications` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, IO], + **kwargs: Any + ) -> _models.GalleryApplication: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application + else: + _json = self._serialize.body(gallery_application, "GalleryApplication") + + request = build_gallery_applications_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplication, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplication + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Required. + :type gallery_application: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplication, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. Is either a GalleryApplication type or a IO type. Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplication or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplication", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, IO], + **kwargs: Any + ) -> _models.GalleryApplication: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application, (IOBase, bytes)): + _content = gallery_application + else: + _json = self._serialize.body(gallery_application, "GalleryApplicationUpdate") + + request = build_gallery_applications_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: _models.GalleryApplicationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + Required. + :type gallery_application: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: Union[_models.GalleryApplicationUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryApplication]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. Required. + :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. Required. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. Is + either a GalleryApplicationUpdate type or a IO type. Required. + :type gallery_application: ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationUpdate or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplication", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which the Application + Definitions are to be retrieved. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. Required. + :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.v2023_07_03.models.GalleryApplication + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplication] = kwargs.pop("cls", None) + + request = build_gallery_applications_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_applications_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be deleted. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be deleted. + Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + } + + @distributed_trace + def list_by_gallery( + self, resource_group_name: str, gallery_name: str, **kwargs: Any + ) -> Iterable["_models.GalleryApplication"]: + """List gallery Application Definitions in a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which Application + Definitions are to be listed. Required. + :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 GalleryApplication or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryApplication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplicationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_applications_list_by_gallery_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GalleryApplicationVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`gallery_application_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + 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: Union[_models.GalleryApplicationVersion, IO], + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version + else: + _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersion") + + request = build_gallery_application_versions_create_or_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Required. + :type gallery_application_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryApplicationVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. Is either a GalleryApplicationVersion type or a IO type. + Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: Union[_models.GalleryApplicationVersionUpdate, IO], + **kwargs: Any + ) -> _models.GalleryApplicationVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gallery_application_version, (IOBase, bytes)): + _content = gallery_application_version + else: + _json = self._serialize.body(gallery_application_version, "GalleryApplicationVersionUpdate") + + request = build_gallery_application_versions_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Required. + :type gallery_application_version: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.GalleryApplicationVersionUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.GalleryApplicationVersion]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. Required. + :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:``. Required. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. Is either a GalleryApplicationVersionUpdate type or a IO type. Required. + :type gallery_application_version: + ~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersionUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GalleryApplicationVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. Required. + :type gallery_application_version_name: str + :keyword expand: The expand expression to apply on the operation. Known values are: + "ReplicationStatus" and "UefiSettings". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2023_07_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.v2023_07_03.models.GalleryApplicationVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplicationVersion] = kwargs.pop("cls", None) + + request = build_gallery_application_versions_get_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_gallery_application_versions_delete_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @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. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. Required. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + deleted. Required. + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + } + + @distributed_trace + def list_by_gallery_application( + self, resource_group_name: str, gallery_name: str, gallery_application_name: str, **kwargs: Any + ) -> Iterable["_models.GalleryApplicationVersion"]: + """List gallery Application Versions in a gallery Application Definition. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. Required. + :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. Required. + :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 GalleryApplicationVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.GalleryApplicationVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.GalleryApplicationVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_gallery_application_versions_list_by_gallery_application_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_gallery_application.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class GallerySharingProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`gallery_sharing_profile` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, IO], + **kwargs: Any + ) -> _models.SharingUpdate: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sharing_update, (IOBase, bytes)): + _content = sharing_update + else: + _json = self._serialize.body(sharing_update, "SharingUpdate") + + request = build_gallery_sharing_profile_update_request( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" + } + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: _models.SharingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: ~azure.mgmt.compute.v2023_07_03.models.SharingUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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 SharingUpdate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Required. + :type sharing_update: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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 SharingUpdate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: Union[_models.SharingUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.SharingUpdate]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. Required. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. Is either a + SharingUpdate type or a IO type. Required. + :type sharing_update: ~azure.mgmt.compute.v2023_07_03.models.SharingUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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 SharingUpdate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2023_07_03.models.SharingUpdate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharingUpdate] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + gallery_name=gallery_name, + sharing_update=sharing_update, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SharingUpdate", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" + } + + +class SharedGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`shared_galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, location: str, *, shared_to: Optional[Union[str, _models.SharedToValues]] = None, **kwargs: Any + ) -> Iterable["_models.SharedGallery"]: + """List shared galleries by subscription id or tenant id. + + :param location: Resource location. Required. + :type location: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.v2023_07_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 SharedGallery or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.SharedGallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_shared_galleries_list_request( + location=location, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @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. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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.v2023_07_03.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + request = build_shared_galleries_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class SharedGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`shared_gallery_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, _models.SharedToValues]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryImage"]: + """List shared gallery images by subscription id or tenant id. + + :param location: Resource location. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :type gallery_unique_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.v2023_07_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 SharedGalleryImage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.SharedGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_shared_gallery_images_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @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. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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. Required. + :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.v2023_07_03.models.SharedGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImage] = kwargs.pop("cls", None) + + request = build_shared_gallery_images_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class SharedGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`shared_gallery_image_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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.SharedGalleryImageVersion"]: + """List shared gallery image versions by subscription id or tenant id. + + :param location: Resource location. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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. Required. + :type gallery_image_name: str + :keyword shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. "tenant" Default value is None. + :paramtype shared_to: str or ~azure.mgmt.compute.v2023_07_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 SharedGalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.SharedGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImageVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_shared_gallery_image_versions_list_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + shared_to=shared_to, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + @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. Required. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. Required. + :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. Required. + :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:``. Required. + :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.v2023_07_03.models.SharedGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.SharedGalleryImageVersion] = kwargs.pop("cls", None) + + request = build_shared_gallery_image_versions_get_request( + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class CommunityGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`community_galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :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.v2023_07_03.models.CommunityGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGallery] = kwargs.pop("cls", None) + + request = build_community_galleries_get_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + +class CommunityGalleryImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`community_gallery_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :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.v2023_07_03.models.CommunityGalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImage] = kwargs.pop("cls", None) + + request = build_community_gallery_images_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @distributed_trace + def list(self, location: str, public_gallery_name: str, **kwargs: Any) -> Iterable["_models.CommunityGalleryImage"]: + """List community gallery images inside a gallery. + + :param location: Resource location. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :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 CommunityGalleryImage or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_community_gallery_images_list_request( + location=location, + public_gallery_name=public_gallery_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } + + +class CommunityGalleryImageVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2023_07_03.ComputeManagementClient`'s + :attr:`community_gallery_image_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @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. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :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:``. Required. + :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.v2023_07_03.models.CommunityGalleryImageVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImageVersion] = kwargs.pop("cls", None) + + request = build_community_gallery_image_versions_get_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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}" + } + + @distributed_trace + def list( + self, location: str, public_gallery_name: str, gallery_image_name: str, **kwargs: Any + ) -> Iterable["_models.CommunityGalleryImageVersion"]: + """List community gallery image versions inside an image. + + :param location: Resource location. Required. + :type location: str + :param public_gallery_name: The public name of the community gallery. Required. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. Required. + :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 CommunityGalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2023_07_03.models.CommunityGalleryImageVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-07-03")) + cls: ClsType[_models.CommunityGalleryImageVersionList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_community_gallery_image_versions_list_request( + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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" + } diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/py.typed b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json index 9dd88955eb82..0f100defff38 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json @@ -1,11 +1,11 @@ { - "commit": "279924e2cefe36a86703fd85a91679f6dfc067fc", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "commit": "98df17f623b5197973148ff32dcc0a6cac2abbb8", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2022-11-01-preview --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/servicelinker/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py index 096b5822e77e..6206bd7a8bf7 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,14 +27,14 @@ class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disa :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(ServiceLinkerManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-11-01-preview"] = kwargs.pop("api_version", "2022-11-01-preview") + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -875,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -922,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py index 2212b97af887..17dd710d562e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py @@ -15,13 +15,7 @@ from . import models as _models from ._configuration import ServiceLinkerManagementClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ( - ConfigurationNamesOperations, - ConnectorOperations, - LinkerOperations, - LinkersOperations, - Operations, -) +from .operations import LinkerOperations, Operations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,22 +25,16 @@ class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-version-keyword """Microsoft.ServiceLinker provider. - :ivar connector: ConnectorOperations operations - :vartype connector: azure.mgmt.servicelinker.operations.ConnectorOperations :ivar linker: LinkerOperations operations :vartype linker: azure.mgmt.servicelinker.operations.LinkerOperations - :ivar linkers: LinkersOperations operations - :vartype linkers: azure.mgmt.servicelinker.operations.LinkersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicelinker.operations.Operations - :ivar configuration_names: ConfigurationNamesOperations operations - :vartype configuration_names: azure.mgmt.servicelinker.operations.ConfigurationNamesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -56,19 +44,14 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = 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.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) - self.linkers = LinkersOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_names = ConfigurationNamesOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -99,5 +82,5 @@ def __enter__(self) -> "ServiceLinkerManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): 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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py index 58920e6942de..e5754a47ce68 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py index 52e9af507a22..34d6e196b191 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,14 +27,14 @@ class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disa :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(ServiceLinkerManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-11-01-preview"] = kwargs.pop("api_version", "2022-11-01-preview") + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py index e46ec5e97a01..925af92f2e34 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py @@ -15,13 +15,7 @@ from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ServiceLinkerManagementClientConfiguration -from .operations import ( - ConfigurationNamesOperations, - ConnectorOperations, - LinkerOperations, - LinkersOperations, - Operations, -) +from .operations import LinkerOperations, Operations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,23 +25,16 @@ class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-version-keyword """Microsoft.ServiceLinker provider. - :ivar connector: ConnectorOperations operations - :vartype connector: azure.mgmt.servicelinker.aio.operations.ConnectorOperations :ivar linker: LinkerOperations operations :vartype linker: azure.mgmt.servicelinker.aio.operations.LinkerOperations - :ivar linkers: LinkersOperations operations - :vartype linkers: azure.mgmt.servicelinker.aio.operations.LinkersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicelinker.aio.operations.Operations - :ivar configuration_names: ConfigurationNamesOperations operations - :vartype configuration_names: - azure.mgmt.servicelinker.aio.operations.ConfigurationNamesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -57,19 +44,14 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = 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.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) - self.linkers = LinkersOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_names = ConfigurationNamesOperations( - 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. @@ -100,5 +82,5 @@ async def __aenter__(self) -> "ServiceLinkerManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py index 80d740a2329c..6a161b8edd91 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py @@ -6,22 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._connector_operations import ConnectorOperations from ._linker_operations import LinkerOperations -from ._linkers_operations import LinkersOperations from ._operations import Operations -from ._configuration_names_operations import ConfigurationNamesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ConnectorOperations", "LinkerOperations", - "LinkersOperations", "Operations", - "ConfigurationNamesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py deleted file mode 100644 index 941b51550439..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py +++ /dev/null @@ -1,150 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._configuration_names_operations import build_list_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationNamesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.aio.ServiceLinkerManagementClient`'s - :attr:`configuration_names` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationNameItem"]: - """Lists the configuration names generated by Service Connector for all target, client types, auth - types. - - :param filter: OData filter options. Default value is None. - :type filter: str - :param skip_token: OData skipToken option for pagination. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationNameItem or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConfigurationNameResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - filter=filter, - skip_token=skip_token, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("ConfigurationNameResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/configurationNames"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py deleted file mode 100644 index e8f0e3a10d43..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py +++ /dev/null @@ -1,1919 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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.core.utils import case_insensitive_dict -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._connector_operations import ( - build_create_dryrun_request, - build_create_or_update_request, - build_delete_dryrun_request, - build_delete_request, - build_generate_configurations_request, - build_get_dryrun_request, - build_get_request, - build_list_dryrun_request, - build_list_request, - build_update_dryrun_request, - build_update_request, - build_validate_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConnectorOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.aio.ServiceLinkerManagementClient`'s - :attr:`connector` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> AsyncIterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns" - } - - @distributed_trace_async - async def get_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> _models.DryrunResource: - """get a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - async def _create_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> _models.DryrunResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - async def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - async def _update_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> Optional[_models.DryrunResource]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - async def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace_async - async def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace - def list( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> AsyncIterable["_models.LinkerResource"]: - """Returns list of connector which connects to the resource, which supports to config the target - service during the resource provision. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkerResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("ResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors" - } - - @distributed_trace_async - async def get( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> _models.LinkerResource: - """Returns Connector resource for a given name. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - request = build_get_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _create_or_update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> _models.LinkerResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerResource") - - request = build_create_or_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - async def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @distributed_trace_async - async def begin_delete( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> _models.LinkerResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") - - request = build_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - async def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _validate_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> Optional[_models.ValidateOperationResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - - request = build_validate_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self._validate_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @distributed_trace_async - async def begin_validate( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ValidateOperationResult]: - """Validate a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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 ValidateOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @overload - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a model type - or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations" - } diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py index 7d971b7057a5..6c6feefc88cc 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_validate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +66,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.LinkerResource"]: - """Returns list of Linkers which connects to the resource. which supports to config both - application and target service during the resource provision. + """Returns list of Linkers which connects to the resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -85,10 +80,8 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Linke _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LinkerList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -130,7 +123,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceList", pipeline_response) + deserialized = self._deserialize("LinkerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -139,8 +132,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,9 +174,7 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) request = build_get_request( @@ -196,8 +188,9 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,16 +223,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerResource") @@ -258,8 +249,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,7 +286,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -330,7 +322,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -360,14 +352,14 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a model type or a IO type. Required. + :param parameters: Linker details. Is either a LinkerResource type or a IO type. Required. :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -388,9 +380,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -450,9 +440,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -466,8 +454,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a Linker. + """Delete a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -506,9 +495,7 @@ async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -563,16 +550,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerPatch") @@ -591,8 +576,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,7 +611,7 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -661,7 +647,7 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -691,14 +677,14 @@ async def begin_update( async def begin_update( self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a model type or a IO type. Required. + :param parameters: Linker details. Is either a LinkerPatch type or a IO type. Required. :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -719,9 +705,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -781,9 +765,7 @@ async def _validate_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) request = build_validate_request( @@ -797,8 +779,9 @@ async def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -825,7 +808,7 @@ async def _validate_initial( async def begin_validate( self, resource_uri: str, linker_name: str, **kwargs: Any ) -> AsyncLROPoller[_models.ValidateOperationResult]: - """Validate a Linker. + """Validate a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -849,9 +832,7 @@ async def begin_validate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -876,7 +857,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -898,8 +880,8 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def list_configurations( self, resource_uri: str, linker_name: str, **kwargs: Any - ) -> _models.ConfigurationResult: - """list source configurations for a Linker. + ) -> _models.SourceConfigurationResult: + """list source configurations for a linker. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -907,8 +889,8 @@ async def list_configurations( :param linker_name: The name Linker resource. Required. :type linker_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :return: SourceConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.SourceConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -922,10 +904,8 @@ async def list_configurations( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SourceConfigurationResult] = kwargs.pop("cls", None) request = build_list_configurations_request( resource_uri=resource_uri, @@ -938,8 +918,9 @@ async def list_configurations( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -949,7 +930,7 @@ async def list_configurations( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConfigurationResult", pipeline_response) + deserialized = self._deserialize("SourceConfigurationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py deleted file mode 100644 index 25aa290694a2..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py +++ /dev/null @@ -1,854 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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.core.utils import case_insensitive_dict -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._linkers_operations import ( - build_create_dryrun_request, - build_delete_dryrun_request, - build_generate_configurations_request, - build_get_dryrun_request, - build_list_dryrun_request, - build_update_dryrun_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class LinkersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.aio.ServiceLinkerManagementClient`'s - :attr:`linkers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - resource_uri=resource_uri, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns"} - - @distributed_trace_async - async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: - """get a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - async def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> _models.DryrunResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - async def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - async def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> Optional[_models.DryrunResource]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - async def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, 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, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @distributed_trace_async - async def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - async def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a model type - or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - } diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py index 27c38f1b9782..672ca4560ab8 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py index aaa1b77d5a88..5c735956e364 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py @@ -6,72 +6,46 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AccessKeyInfoBase from ._models_py3 import AuthInfoBase from ._models_py3 import AzureKeyVaultProperties from ._models_py3 import AzureResource from ._models_py3 import AzureResourcePropertiesBase -from ._models_py3 import BasicErrorDryrunPrerequisiteResult -from ._models_py3 import ConfigurationInfo -from ._models_py3 import ConfigurationName -from ._models_py3 import ConfigurationNameItem -from ._models_py3 import ConfigurationNameResult -from ._models_py3 import ConfigurationResult from ._models_py3 import ConfluentBootstrapServer from ._models_py3 import ConfluentSchemaRegistry -from ._models_py3 import CreateOrUpdateDryrunParameters -from ._models_py3 import DatabaseAadAuthInfo -from ._models_py3 import DryrunList -from ._models_py3 import DryrunOperationPreview -from ._models_py3 import DryrunParameters -from ._models_py3 import DryrunPatch -from ._models_py3 import DryrunPrerequisiteResult -from ._models_py3 import DryrunResource from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse -from ._models_py3 import FirewallRules from ._models_py3 import KeyVaultSecretReferenceSecretInfo from ._models_py3 import KeyVaultSecretUriSecretInfo +from ._models_py3 import LinkerList from ._models_py3 import LinkerPatch -from ._models_py3 import LinkerProperties from ._models_py3 import LinkerResource from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult -from ._models_py3 import PermissionsMissingDryrunPrerequisiteResult from ._models_py3 import ProxyResource -from ._models_py3 import PublicNetworkSolution from ._models_py3 import Resource -from ._models_py3 import ResourceList from ._models_py3 import SecretAuthInfo from ._models_py3 import SecretInfoBase from ._models_py3 import SecretStore -from ._models_py3 import SelfHostedServer from ._models_py3 import ServicePrincipalCertificateAuthInfo from ._models_py3 import ServicePrincipalSecretAuthInfo from ._models_py3 import SourceConfiguration +from ._models_py3 import SourceConfigurationResult from ._models_py3 import SystemAssignedIdentityAuthInfo from ._models_py3 import SystemData from ._models_py3 import TargetServiceBase -from ._models_py3 import UserAccountAuthInfo from ._models_py3 import UserAssignedIdentityAuthInfo from ._models_py3 import VNetSolution from ._models_py3 import ValidateOperationResult from ._models_py3 import ValidationResultItem from ._models_py3 import ValueSecretInfo -from ._service_linker_management_client_enums import AccessKeyPermissions from ._service_linker_management_client_enums import ActionType -from ._service_linker_management_client_enums import AllowType from ._service_linker_management_client_enums import AuthType from ._service_linker_management_client_enums import AzureResourceType from ._service_linker_management_client_enums import ClientType from ._service_linker_management_client_enums import CreatedByType -from ._service_linker_management_client_enums import DeleteOrUpdateBehavior -from ._service_linker_management_client_enums import DryrunActionName -from ._service_linker_management_client_enums import DryrunPrerequisiteResultType -from ._service_linker_management_client_enums import DryrunPreviewOperationType from ._service_linker_management_client_enums import Origin from ._service_linker_management_client_enums import SecretType from ._service_linker_management_client_enums import TargetServiceType @@ -82,71 +56,45 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AccessKeyInfoBase", "AuthInfoBase", "AzureKeyVaultProperties", "AzureResource", "AzureResourcePropertiesBase", - "BasicErrorDryrunPrerequisiteResult", - "ConfigurationInfo", - "ConfigurationName", - "ConfigurationNameItem", - "ConfigurationNameResult", - "ConfigurationResult", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", - "CreateOrUpdateDryrunParameters", - "DatabaseAadAuthInfo", - "DryrunList", - "DryrunOperationPreview", - "DryrunParameters", - "DryrunPatch", - "DryrunPrerequisiteResult", - "DryrunResource", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", - "FirewallRules", "KeyVaultSecretReferenceSecretInfo", "KeyVaultSecretUriSecretInfo", + "LinkerList", "LinkerPatch", - "LinkerProperties", "LinkerResource", "Operation", "OperationDisplay", "OperationListResult", - "PermissionsMissingDryrunPrerequisiteResult", "ProxyResource", - "PublicNetworkSolution", "Resource", - "ResourceList", "SecretAuthInfo", "SecretInfoBase", "SecretStore", - "SelfHostedServer", "ServicePrincipalCertificateAuthInfo", "ServicePrincipalSecretAuthInfo", "SourceConfiguration", + "SourceConfigurationResult", "SystemAssignedIdentityAuthInfo", "SystemData", "TargetServiceBase", - "UserAccountAuthInfo", "UserAssignedIdentityAuthInfo", "VNetSolution", "ValidateOperationResult", "ValidationResultItem", "ValueSecretInfo", - "AccessKeyPermissions", "ActionType", - "AllowType", "AuthType", "AzureResourceType", "ClientType", "CreatedByType", - "DeleteOrUpdateBehavior", - "DryrunActionName", - "DryrunPrerequisiteResultType", - "DryrunPreviewOperationType", "Origin", "SecretType", "TargetServiceType", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py index e24a2dd6129e..7ba3ffec9b53 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -21,15 +21,13 @@ class AuthInfoBase(_serialization.Model): """The authentication info. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AccessKeyInfoBase, SecretAuthInfo, ServicePrincipalCertificateAuthInfo, - ServicePrincipalSecretAuthInfo, SystemAssignedIdentityAuthInfo, UserAccountAuthInfo, - UserAssignedIdentityAuthInfo + SecretAuthInfo, ServicePrincipalCertificateAuthInfo, ServicePrincipalSecretAuthInfo, + SystemAssignedIdentityAuthInfo, UserAssignedIdentityAuthInfo All required parameters must be populated in order to send to Azure. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType """ @@ -43,58 +41,20 @@ class AuthInfoBase(_serialization.Model): _subtype_map = { "auth_type": { - "accessKey": "AccessKeyInfoBase", "secret": "SecretAuthInfo", "servicePrincipalCertificate": "ServicePrincipalCertificateAuthInfo", "servicePrincipalSecret": "ServicePrincipalSecretAuthInfo", "systemAssignedIdentity": "SystemAssignedIdentityAuthInfo", - "userAccount": "UserAccountAuthInfo", "userAssignedIdentity": "UserAssignedIdentityAuthInfo", } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.auth_type: Optional[str] = None -class AccessKeyInfoBase(AuthInfoBase): - """The access key directly from target resource properties, which target service is Azure Resource, such as Microsoft.Storage. - - All required parameters must be populated in order to send to Azure. - - :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar permissions: Permissions of the accessKey. ``Read`` and ``Write`` are for Azure Cosmos DB - and Azure App Configuration, ``Listen``\ , ``Send`` and ``Manage`` are for Azure Event Hub and - Azure Service Bus. - :vartype permissions: list[str or ~azure.mgmt.servicelinker.models.AccessKeyPermissions] - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "permissions": {"key": "permissions", "type": "[str]"}, - } - - def __init__(self, *, permissions: Optional[List[Union[str, "_models.AccessKeyPermissions"]]] = None, **kwargs): - """ - :keyword permissions: Permissions of the accessKey. ``Read`` and ``Write`` are for Azure Cosmos - DB and Azure App Configuration, ``Listen``\ , ``Send`` and ``Manage`` are for Azure Event Hub - and Azure Service Bus. - :paramtype permissions: list[str or ~azure.mgmt.servicelinker.models.AccessKeyPermissions] - """ - super().__init__(**kwargs) - self.auth_type: str = "accessKey" - self.permissions = permissions - - class AzureResourcePropertiesBase(_serialization.Model): """The azure resource properties. @@ -117,7 +77,7 @@ class AzureResourcePropertiesBase(_serialization.Model): _subtype_map = {"type": {"KeyVault": "AzureKeyVaultProperties"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type: Optional[str] = None @@ -143,7 +103,7 @@ class AzureKeyVaultProperties(AzureResourcePropertiesBase): "connect_as_kubernetes_csi_driver": {"key": "connectAsKubernetesCsiDriver", "type": "bool"}, } - def __init__(self, *, connect_as_kubernetes_csi_driver: Optional[bool] = None, **kwargs): + def __init__(self, *, connect_as_kubernetes_csi_driver: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword connect_as_kubernetes_csi_driver: True if connect via Kubernetes CSI Driver. :paramtype connect_as_kubernetes_csi_driver: bool @@ -157,12 +117,12 @@ class TargetServiceBase(_serialization.Model): """The target service properties. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureResource, ConfluentBootstrapServer, ConfluentSchemaRegistry, SelfHostedServer + AzureResource, ConfluentBootstrapServer, ConfluentSchemaRegistry All required parameters must be populated in order to send to Azure. :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType """ @@ -179,11 +139,10 @@ class TargetServiceBase(_serialization.Model): "AzureResource": "AzureResource", "ConfluentBootstrapServer": "ConfluentBootstrapServer", "ConfluentSchemaRegistry": "ConfluentSchemaRegistry", - "SelfHostedServer": "SelfHostedServer", } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type: Optional[str] = None @@ -195,7 +154,7 @@ class AzureResource(TargetServiceBase): All required parameters must be populated in order to send to Azure. :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar id: The Id of azure resource. :vartype id: str @@ -218,8 +177,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin resource_properties: Optional["_models.AzureResourcePropertiesBase"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The Id of azure resource. :paramtype id: str @@ -232,276 +191,13 @@ def __init__( self.resource_properties = resource_properties -class DryrunPrerequisiteResult(_serialization.Model): - """A result of dryrun. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - BasicErrorDryrunPrerequisiteResult, PermissionsMissingDryrunPrerequisiteResult - - All required parameters must be populated in order to send to Azure. - - :ivar type: The type of dryrun result. Required. Known values are: "basicError" and - "permissionsMissing". - :vartype type: str or ~azure.mgmt.servicelinker.models.DryrunPrerequisiteResultType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": { - "basicError": "BasicErrorDryrunPrerequisiteResult", - "permissionsMissing": "PermissionsMissingDryrunPrerequisiteResult", - } - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class BasicErrorDryrunPrerequisiteResult(DryrunPrerequisiteResult): - """The represent of basic error. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The type of dryrun result. Required. Known values are: "basicError" and - "permissionsMissing". - :vartype type: str or ~azure.mgmt.servicelinker.models.DryrunPrerequisiteResultType - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): - """ - :keyword code: The error code. - :paramtype code: str - :keyword message: The error message. - :paramtype message: str - """ - super().__init__(**kwargs) - self.type: str = "basicError" - self.code = code - self.message = message - - -class ConfigurationInfo(_serialization.Model): - """The configuration information, used to generate configurations or save to applications. - - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar action: Optional, indicate whether to apply configurations on source application. If - enable, generate configurations and applied to the source application. Default is enable. If - optOut, no configuration change will be made on source. Known values are: "Internal", "enable", - and "optOut". - :vartype action: str or ~azure.mgmt.servicelinker.models.ActionType - :ivar customized_keys: Optional. A dictionary of default key name and customized key name - mapping. If not specified, default key name will be used for generate configurations. - :vartype customized_keys: dict[str, str] - :ivar additional_configurations: A dictionary of additional configurations to be added. Service - will auto generate a set of basic configurations and this property is to full fill more - customized configurations. - :vartype additional_configurations: dict[str, str] - """ - - _attribute_map = { - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "customized_keys": {"key": "customizedKeys", "type": "{str}"}, - "additional_configurations": {"key": "additionalConfigurations", "type": "{str}"}, - } - - def __init__( - self, - *, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - action: Optional[Union[str, "_models.ActionType"]] = None, - customized_keys: Optional[Dict[str, str]] = None, - additional_configurations: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword action: Optional, indicate whether to apply configurations on source application. If - enable, generate configurations and applied to the source application. Default is enable. If - optOut, no configuration change will be made on source. Known values are: "Internal", "enable", - and "optOut". - :paramtype action: str or ~azure.mgmt.servicelinker.models.ActionType - :keyword customized_keys: Optional. A dictionary of default key name and customized key name - mapping. If not specified, default key name will be used for generate configurations. - :paramtype customized_keys: dict[str, str] - :keyword additional_configurations: A dictionary of additional configurations to be added. - Service will auto generate a set of basic configurations and this property is to full fill more - customized configurations. - :paramtype additional_configurations: dict[str, str] - """ - super().__init__(**kwargs) - self.delete_or_update_behavior = delete_or_update_behavior - self.action = action - self.customized_keys = customized_keys - self.additional_configurations = additional_configurations - - -class ConfigurationName(_serialization.Model): - """The configuration names. - - :ivar value: - :vartype value: str - :ivar description: Description for the configuration name. - :vartype description: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, description: Optional[str] = None, **kwargs): - """ - :keyword value: - :paramtype value: str - :keyword description: Description for the configuration name. - :paramtype description: str - """ - super().__init__(**kwargs) - self.value = value - self.description = description - - -class ConfigurationNameItem(_serialization.Model): - """ConfigurationNameItem. - - :ivar target_service: The target service provider name and resource name. - :vartype target_service: str - :ivar client_type: The client type for configuration names. Known values are: "none", "dotnet", - "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and - "kafka-springBoot". - :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :ivar auth_type: The auth type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar names: The configuration names to be set in compute service environment. - :vartype names: list[~azure.mgmt.servicelinker.models.ConfigurationName] - """ - - _attribute_map = { - "target_service": {"key": "properties.targetService", "type": "str"}, - "client_type": {"key": "properties.clientType", "type": "str"}, - "auth_type": {"key": "properties.authType", "type": "str"}, - "names": {"key": "properties.names", "type": "[ConfigurationName]"}, - } - - def __init__( - self, - *, - target_service: Optional[str] = None, - client_type: Optional[Union[str, "_models.ClientType"]] = None, - auth_type: Optional[Union[str, "_models.AuthType"]] = None, - names: Optional[List["_models.ConfigurationName"]] = None, - **kwargs - ): - """ - :keyword target_service: The target service provider name and resource name. - :paramtype target_service: str - :keyword client_type: The client type for configuration names. Known values are: "none", - "dotnet", "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and - "kafka-springBoot". - :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :keyword auth_type: The auth type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". - :paramtype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :keyword names: The configuration names to be set in compute service environment. - :paramtype names: list[~azure.mgmt.servicelinker.models.ConfigurationName] - """ - super().__init__(**kwargs) - self.target_service = target_service - self.client_type = client_type - self.auth_type = auth_type - self.names = names - - -class ConfigurationNameResult(_serialization.Model): - """Configuration Name list which will be set based on different target resource, client type, auth type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Expected configuration names for each target service. - :vartype value: list[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ConfigurationNameItem]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.ConfigurationNameItem"]] = None, **kwargs): - """ - :keyword value: Expected configuration names for each target service. - :paramtype value: list[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ConfigurationResult(_serialization.Model): - """Configurations for source resource, include appSettings, connectionString and serviceBindings. - - :ivar configurations: The configuration properties for source resource. - :vartype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] - """ - - _attribute_map = { - "configurations": {"key": "configurations", "type": "[SourceConfiguration]"}, - } - - def __init__(self, *, configurations: Optional[List["_models.SourceConfiguration"]] = None, **kwargs): - """ - :keyword configurations: The configuration properties for source resource. - :paramtype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] - """ - super().__init__(**kwargs) - self.configurations = configurations - - class ConfluentBootstrapServer(TargetServiceBase): """The service properties when target service type is ConfluentBootstrapServer. All required parameters must be populated in order to send to Azure. :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar endpoint: The endpoint of service. :vartype endpoint: str @@ -516,7 +212,7 @@ class ConfluentBootstrapServer(TargetServiceBase): "endpoint": {"key": "endpoint", "type": "str"}, } - def __init__(self, *, endpoint: Optional[str] = None, **kwargs): + def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: """ :keyword endpoint: The endpoint of service. :paramtype endpoint: str @@ -532,7 +228,7 @@ class ConfluentSchemaRegistry(TargetServiceBase): All required parameters must be populated in order to send to Azure. :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar endpoint: The endpoint of service. :vartype endpoint: str @@ -547,519 +243,14 @@ class ConfluentSchemaRegistry(TargetServiceBase): "endpoint": {"key": "endpoint", "type": "str"}, } - def __init__(self, *, endpoint: Optional[str] = None, **kwargs): + def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: """ :keyword endpoint: The endpoint of service. - :paramtype endpoint: str - """ - super().__init__(**kwargs) - self.type: str = "ConfluentSchemaRegistry" - self.endpoint = endpoint - - -class LinkerProperties(_serialization.Model): - """The properties of the Linker. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_service: The target service properties. - :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :ivar auth_info: The authentication type. - :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". - :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :ivar v_net_solution: The VNet solution. - :vartype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :ivar secret_store: An option to store secret value in secure place. - :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :ivar scope: connection scope in source service. - :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "target_service": {"key": "targetService", "type": "TargetServiceBase"}, - "auth_info": {"key": "authInfo", "type": "AuthInfoBase"}, - "client_type": {"key": "clientType", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "v_net_solution": {"key": "vNetSolution", "type": "VNetSolution"}, - "secret_store": {"key": "secretStore", "type": "SecretStore"}, - "scope": {"key": "scope", "type": "str"}, - "public_network_solution": {"key": "publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "configurationInfo", "type": "ConfigurationInfo"}, - } - - def __init__( - self, - *, - target_service: Optional["_models.TargetServiceBase"] = None, - auth_info: Optional["_models.AuthInfoBase"] = None, - client_type: Optional[Union[str, "_models.ClientType"]] = None, - v_net_solution: Optional["_models.VNetSolution"] = None, - secret_store: Optional["_models.SecretStore"] = None, - scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, - **kwargs - ): - """ - :keyword target_service: The target service properties. - :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :keyword auth_info: The authentication type. - :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". - :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :keyword v_net_solution: The VNet solution. - :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :keyword secret_store: An option to store secret value in secure place. - :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :keyword scope: connection scope in source service. - :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - super().__init__(**kwargs) - self.target_service = target_service - self.auth_info = auth_info - self.client_type = client_type - self.provisioning_state = None - self.v_net_solution = v_net_solution - self.secret_store = secret_store - self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info - - -class DryrunParameters(_serialization.Model): - """The parameters of the dryrun. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CreateOrUpdateDryrunParameters - - All required parameters must be populated in order to send to Azure. - - :ivar action_name: The name of action for you dryrun job. Required. "createOrUpdate" - :vartype action_name: str or ~azure.mgmt.servicelinker.models.DryrunActionName - """ - - _validation = { - "action_name": {"required": True}, - } - - _attribute_map = { - "action_name": {"key": "actionName", "type": "str"}, - } - - _subtype_map = {"action_name": {"createOrUpdate": "CreateOrUpdateDryrunParameters"}} - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.action_name: Optional[str] = None - - -class CreateOrUpdateDryrunParameters(DryrunParameters, LinkerProperties): - """The dryrun parameters for creation or update a linker. - - 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_service: The target service properties. - :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :ivar auth_info: The authentication type. - :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". - :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :ivar v_net_solution: The VNet solution. - :vartype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :ivar secret_store: An option to store secret value in secure place. - :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :ivar scope: connection scope in source service. - :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :ivar action_name: The name of action for you dryrun job. Required. "createOrUpdate" - :vartype action_name: str or ~azure.mgmt.servicelinker.models.DryrunActionName - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "action_name": {"required": True}, - } - - _attribute_map = { - "target_service": {"key": "targetService", "type": "TargetServiceBase"}, - "auth_info": {"key": "authInfo", "type": "AuthInfoBase"}, - "client_type": {"key": "clientType", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "v_net_solution": {"key": "vNetSolution", "type": "VNetSolution"}, - "secret_store": {"key": "secretStore", "type": "SecretStore"}, - "scope": {"key": "scope", "type": "str"}, - "public_network_solution": {"key": "publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "configurationInfo", "type": "ConfigurationInfo"}, - "action_name": {"key": "actionName", "type": "str"}, - } - - def __init__( - self, - *, - target_service: Optional["_models.TargetServiceBase"] = None, - auth_info: Optional["_models.AuthInfoBase"] = None, - client_type: Optional[Union[str, "_models.ClientType"]] = None, - v_net_solution: Optional["_models.VNetSolution"] = None, - secret_store: Optional["_models.SecretStore"] = None, - scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, - **kwargs - ): - """ - :keyword target_service: The target service properties. - :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :keyword auth_info: The authentication type. - :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". - :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :keyword v_net_solution: The VNet solution. - :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :keyword secret_store: An option to store secret value in secure place. - :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :keyword scope: connection scope in source service. - :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - super().__init__( - target_service=target_service, - auth_info=auth_info, - client_type=client_type, - v_net_solution=v_net_solution, - secret_store=secret_store, - scope=scope, - public_network_solution=public_network_solution, - configuration_info=configuration_info, - **kwargs - ) - self.target_service = target_service - self.auth_info = auth_info - self.client_type = client_type - self.provisioning_state = None - self.v_net_solution = v_net_solution - self.secret_store = secret_store - self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info - self.action_name: str = "createOrUpdate" - - -class DatabaseAadAuthInfo(_serialization.Model): - """The extra auth info required by Database AAD authentication. - - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str - """ - - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - } - - def __init__(self, *, user_name: Optional[str] = None, **kwargs): - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - """ - super().__init__(**kwargs) - self.user_name = user_name - - -class DryrunList(_serialization.Model): - """The list of dryrun. - - :ivar next_link: The link used to get the next page of dryrun list. - :vartype next_link: str - :ivar value: The list of dryrun. - :vartype value: list[~azure.mgmt.servicelinker.models.DryrunResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[DryrunResource]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.DryrunResource"]] = None, **kwargs - ): - """ - :keyword next_link: The link used to get the next page of dryrun list. - :paramtype next_link: str - :keyword value: The list of dryrun. - :paramtype value: list[~azure.mgmt.servicelinker.models.DryrunResource] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class DryrunOperationPreview(_serialization.Model): - """The preview of the operations for creation. - - :ivar name: The operation name. - :vartype name: str - :ivar operation_type: The operation type. Known values are: "configConnection", - "configNetwork", and "configAuth". - :vartype operation_type: str or ~azure.mgmt.servicelinker.models.DryrunPreviewOperationType - :ivar description: The description of the operation. - :vartype description: str - :ivar action: The action defined by RBAC, refer - https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. - :vartype action: str - :ivar scope: The scope of the operation, refer - https://docs.microsoft.com/azure/role-based-access-control/scope-overview. - :vartype scope: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "operation_type": {"key": "operationType", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - operation_type: Optional[Union[str, "_models.DryrunPreviewOperationType"]] = None, - description: Optional[str] = None, - action: Optional[str] = None, - scope: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The operation name. - :paramtype name: str - :keyword operation_type: The operation type. Known values are: "configConnection", - "configNetwork", and "configAuth". - :paramtype operation_type: str or ~azure.mgmt.servicelinker.models.DryrunPreviewOperationType - :keyword description: The description of the operation. - :paramtype description: str - :keyword action: The action defined by RBAC, refer - https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. - :paramtype action: str - :keyword scope: The scope of the operation, refer - https://docs.microsoft.com/azure/role-based-access-control/scope-overview. - :paramtype scope: str - """ - super().__init__(**kwargs) - self.name = name - self.operation_type = operation_type - self.description = description - self.action = action - self.scope = scope - - -class DryrunPatch(_serialization.Model): - """a dryrun job to be updated. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar parameters: The parameters of the dryrun. - :vartype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters - :ivar prerequisite_results: the result of the dryrun. - :vartype prerequisite_results: list[~azure.mgmt.servicelinker.models.DryrunPrerequisiteResult] - :ivar operation_previews: the preview of the operations for creation. - :vartype operation_previews: list[~azure.mgmt.servicelinker.models.DryrunOperationPreview] - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - "prerequisite_results": {"readonly": True}, - "operation_previews": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "parameters": {"key": "properties.parameters", "type": "DryrunParameters"}, - "prerequisite_results": {"key": "properties.prerequisiteResults", "type": "[DryrunPrerequisiteResult]"}, - "operation_previews": {"key": "properties.operationPreviews", "type": "[DryrunOperationPreview]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, **kwargs): - """ - :keyword parameters: The parameters of the dryrun. - :paramtype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters - """ - super().__init__(**kwargs) - self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - - -class DryrunResource(ProxyResource): - """a dryrun job resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData - :ivar parameters: The parameters of the dryrun. - :vartype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters - :ivar prerequisite_results: the result of the dryrun. - :vartype prerequisite_results: list[~azure.mgmt.servicelinker.models.DryrunPrerequisiteResult] - :ivar operation_previews: the preview of the operations for creation. - :vartype operation_previews: list[~azure.mgmt.servicelinker.models.DryrunOperationPreview] - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "prerequisite_results": {"readonly": True}, - "operation_previews": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "parameters": {"key": "properties.parameters", "type": "DryrunParameters"}, - "prerequisite_results": {"key": "properties.prerequisiteResults", "type": "[DryrunPrerequisiteResult]"}, - "operation_previews": {"key": "properties.operationPreviews", "type": "[DryrunOperationPreview]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, **kwargs): - """ - :keyword parameters: The parameters of the dryrun. - :paramtype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters + :paramtype endpoint: str """ super().__init__(**kwargs) - self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None + self.type: str = "ConfluentSchemaRegistry" + self.endpoint = endpoint class ErrorAdditionalInfo(_serialization.Model): @@ -1083,7 +274,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1123,7 +314,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1134,7 +325,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.servicelinker.models.ErrorDetail @@ -1144,7 +336,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicelinker.models.ErrorDetail @@ -1153,53 +345,6 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): self.error = error -class FirewallRules(_serialization.Model): - """Target service's firewall rules. to allow connections from source service. - - :ivar ip_ranges: This value specifies the set of IP addresses or IP address ranges in CIDR form - to be included as the allowed list of client IPs for a given database account. - :vartype ip_ranges: list[str] - :ivar azure_services: Allow Azure services to access the target service if true. Known values - are: "true" and "false". - :vartype azure_services: str or ~azure.mgmt.servicelinker.models.AllowType - :ivar caller_client_ip: Allow caller client IP to access the target service if true. the - property is used when connecting local application to target service. Known values are: "true" - and "false". - :vartype caller_client_ip: str or ~azure.mgmt.servicelinker.models.AllowType - """ - - _attribute_map = { - "ip_ranges": {"key": "ipRanges", "type": "[str]"}, - "azure_services": {"key": "azureServices", "type": "str"}, - "caller_client_ip": {"key": "callerClientIP", "type": "str"}, - } - - def __init__( - self, - *, - ip_ranges: Optional[List[str]] = None, - azure_services: Optional[Union[str, "_models.AllowType"]] = None, - caller_client_ip: Optional[Union[str, "_models.AllowType"]] = None, - **kwargs - ): - """ - :keyword ip_ranges: This value specifies the set of IP addresses or IP address ranges in CIDR - form to be included as the allowed list of client IPs for a given database account. - :paramtype ip_ranges: list[str] - :keyword azure_services: Allow Azure services to access the target service if true. Known - values are: "true" and "false". - :paramtype azure_services: str or ~azure.mgmt.servicelinker.models.AllowType - :keyword caller_client_ip: Allow caller client IP to access the target service if true. the - property is used when connecting local application to target service. Known values are: "true" - and "false". - :paramtype caller_client_ip: str or ~azure.mgmt.servicelinker.models.AllowType - """ - super().__init__(**kwargs) - self.ip_ranges = ip_ranges - self.azure_services = azure_services - self.caller_client_ip = caller_client_ip - - class SecretInfoBase(_serialization.Model): """The secret info. @@ -1229,14 +374,16 @@ class SecretInfoBase(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.secret_type: Optional[str] = None class KeyVaultSecretReferenceSecretInfo(SecretInfoBase): - """The secret info when type is keyVaultSecretReference. It's for scenario that user provides a secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to secretStore.keyVaultId. + """The secret info when type is keyVaultSecretReference. It's for scenario that user provides a + secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is + linked to secretStore.keyVaultId. All required parameters must be populated in order to send to Azure. @@ -1259,7 +406,7 @@ class KeyVaultSecretReferenceSecretInfo(SecretInfoBase): "version": {"key": "version", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of the Key Vault secret. :paramtype name: str @@ -1273,7 +420,8 @@ def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, class KeyVaultSecretUriSecretInfo(SecretInfoBase): - """The secret info when type is keyVaultSecretUri. It's for scenario that user provides a secret stored in user's keyvault and source is Web App, Spring Cloud or Container App. + """The secret info when type is keyVaultSecretUri. It's for scenario that user provides a secret + stored in user's keyvault and source is Web App, Spring Cloud or Container App. All required parameters must be populated in order to send to Azure. @@ -1293,7 +441,7 @@ class KeyVaultSecretUriSecretInfo(SecretInfoBase): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: URI to the keyvault secret. :paramtype value: str @@ -1303,8 +451,36 @@ def __init__(self, *, value: Optional[str] = None, **kwargs): self.value = value +class LinkerList(_serialization.Model): + """The list of Linker. + + :ivar next_link: The link used to get the next page of Linker list. + :vartype next_link: str + :ivar value: The list of Linkers. + :vartype value: list[~azure.mgmt.servicelinker.models.LinkerResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[LinkerResource]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.LinkerResource"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link used to get the next page of Linker list. + :paramtype next_link: str + :keyword value: The list of Linkers. + :paramtype value: list[~azure.mgmt.servicelinker.models.LinkerResource] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + class LinkerPatch(_serialization.Model): - """A Linker to be updated. + """A linker to be updated. Variables are only populated by the server, and will be ignored when sending a request. @@ -1323,11 +499,6 @@ class LinkerPatch(_serialization.Model): :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :ivar scope: connection scope in source service. :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ _validation = { @@ -1342,8 +513,6 @@ class LinkerPatch(_serialization.Model): "v_net_solution": {"key": "properties.vNetSolution", "type": "VNetSolution"}, "secret_store": {"key": "properties.secretStore", "type": "SecretStore"}, "scope": {"key": "properties.scope", "type": "str"}, - "public_network_solution": {"key": "properties.publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "properties.configurationInfo", "type": "ConfigurationInfo"}, } def __init__( @@ -1355,10 +524,8 @@ def __init__( v_net_solution: Optional["_models.VNetSolution"] = None, secret_store: Optional["_models.SecretStore"] = None, scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword target_service: The target service properties. :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase @@ -1373,11 +540,6 @@ def __init__( :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :keyword scope: connection scope in source service. :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ super().__init__(**kwargs) self.target_service = target_service @@ -1387,8 +549,74 @@ def __init__( self.v_net_solution = v_net_solution self.secret_store = secret_store self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: 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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: 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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attributes @@ -1404,8 +632,7 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. + :ivar system_data: The system data. :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData :ivar target_service: The target service properties. :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase @@ -1422,11 +649,6 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :ivar scope: connection scope in source service. :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ _validation = { @@ -1449,8 +671,6 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib "v_net_solution": {"key": "properties.vNetSolution", "type": "VNetSolution"}, "secret_store": {"key": "properties.secretStore", "type": "SecretStore"}, "scope": {"key": "properties.scope", "type": "str"}, - "public_network_solution": {"key": "properties.publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "properties.configurationInfo", "type": "ConfigurationInfo"}, } def __init__( @@ -1462,10 +682,8 @@ def __init__( v_net_solution: Optional["_models.VNetSolution"] = None, secret_store: Optional["_models.SecretStore"] = None, scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword target_service: The target service properties. :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase @@ -1480,13 +698,9 @@ def __init__( :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :keyword scope: connection scope in source service. :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ super().__init__(**kwargs) + self.system_data = None self.target_service = target_service self.auth_info = auth_info self.client_type = client_type @@ -1494,8 +708,6 @@ def __init__( self.v_net_solution = v_net_solution self.secret_store = secret_store self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info class Operation(_serialization.Model): @@ -1516,7 +728,7 @@ class Operation(_serialization.Model): and "user,system". :vartype origin: str or ~azure.mgmt.servicelinker.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Known values are: "Internal", "enable", and "optOut". + internal only APIs. "Internal" :vartype action_type: str or ~azure.mgmt.servicelinker.models.ActionType """ @@ -1535,7 +747,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.servicelinker.models.OperationDisplay @@ -1581,7 +793,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1591,7 +803,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1611,150 +824,20 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResult): - """The represent of missing permissions. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The type of dryrun result. Required. Known values are: "basicError" and - "permissionsMissing". - :vartype type: str or ~azure.mgmt.servicelinker.models.DryrunPrerequisiteResultType - :ivar scope: The permission scope. - :vartype scope: str - :ivar permissions: The permission list. - :vartype permissions: list[str] - :ivar recommended_role: The recommended role to resolve permissions missing. - :vartype recommended_role: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "permissions": {"key": "permissions", "type": "[str]"}, - "recommended_role": {"key": "recommendedRole", "type": "str"}, - } - - def __init__( - self, - *, - scope: Optional[str] = None, - permissions: Optional[List[str]] = None, - recommended_role: Optional[str] = None, - **kwargs - ): - """ - :keyword scope: The permission scope. - :paramtype scope: str - :keyword permissions: The permission list. - :paramtype permissions: list[str] - :keyword recommended_role: The recommended role to resolve permissions missing. - :paramtype recommended_role: str - """ - super().__init__(**kwargs) - self.type: str = "permissionsMissing" - self.scope = scope - self.permissions = permissions - self.recommended_role = recommended_role - - -class PublicNetworkSolution(_serialization.Model): - """Indicates public network solution, include firewall rules. - - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation(such as - firewall rules) when Linker is updating or deleting. Known values are: "Default" and - "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar action: Optional. Indicates public network solution. If enable, enable public network - access of target service with best try. Default is enable. If optOut, opt out public network - access configuration. Known values are: "Internal", "enable", and "optOut". - :vartype action: str or ~azure.mgmt.servicelinker.models.ActionType - :ivar firewall_rules: Describe firewall rules of target service to make sure source application - could connect to the target. - :vartype firewall_rules: ~azure.mgmt.servicelinker.models.FirewallRules - """ - - _attribute_map = { - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "firewall_rules": {"key": "firewallRules", "type": "FirewallRules"}, - } - - def __init__( - self, - *, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - action: Optional[Union[str, "_models.ActionType"]] = None, - firewall_rules: Optional["_models.FirewallRules"] = None, - **kwargs - ): - """ - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation(such as - firewall rules) when Linker is updating or deleting. Known values are: "Default" and - "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword action: Optional. Indicates public network solution. If enable, enable public network - access of target service with best try. Default is enable. If optOut, opt out public network - access configuration. Known values are: "Internal", "enable", and "optOut". - :paramtype action: str or ~azure.mgmt.servicelinker.models.ActionType - :keyword firewall_rules: Describe firewall rules of target service to make sure source - application could connect to the target. - :paramtype firewall_rules: ~azure.mgmt.servicelinker.models.FirewallRules - """ - super().__init__(**kwargs) - self.delete_or_update_behavior = delete_or_update_behavior - self.action = action - self.firewall_rules = firewall_rules - - -class ResourceList(_serialization.Model): - """The list of Linker. - - :ivar next_link: The Linker used to get the next page of Linker list. - :vartype next_link: str - :ivar value: The list of Linkers. - :vartype value: list[~azure.mgmt.servicelinker.models.LinkerResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[LinkerResource]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.LinkerResource"]] = None, **kwargs - ): - """ - :keyword next_link: The Linker used to get the next page of Linker list. - :paramtype next_link: str - :keyword value: The list of Linkers. - :paramtype value: list[~azure.mgmt.servicelinker.models.LinkerResource] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - class SecretAuthInfo(AuthInfoBase): """The authentication info when authType is secret. All required parameters must be populated in order to send to Azure. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar name: Username or account name for secret auth. :vartype name: str @@ -1772,7 +855,9 @@ class SecretAuthInfo(AuthInfoBase): "secret_info": {"key": "secretInfo", "type": "SecretInfoBase"}, } - def __init__(self, *, name: Optional[str] = None, secret_info: Optional["_models.SecretInfoBase"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, secret_info: Optional["_models.SecretInfoBase"] = None, **kwargs: Any + ) -> None: """ :keyword name: Username or account name for secret auth. :paramtype name: str @@ -1790,58 +875,19 @@ class SecretStore(_serialization.Model): :ivar key_vault_id: The key vault id to store secret. :vartype key_vault_id: str - :ivar key_vault_secret_name: The key vault secret name to store secret, only valid when storing - one secret. - :vartype key_vault_secret_name: str """ _attribute_map = { "key_vault_id": {"key": "keyVaultId", "type": "str"}, - "key_vault_secret_name": {"key": "keyVaultSecretName", "type": "str"}, } - def __init__(self, *, key_vault_id: Optional[str] = None, key_vault_secret_name: Optional[str] = None, **kwargs): + def __init__(self, *, key_vault_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key_vault_id: The key vault id to store secret. :paramtype key_vault_id: str - :keyword key_vault_secret_name: The key vault secret name to store secret, only valid when - storing one secret. - :paramtype key_vault_secret_name: str """ super().__init__(**kwargs) self.key_vault_id = key_vault_id - self.key_vault_secret_name = key_vault_secret_name - - -class SelfHostedServer(TargetServiceBase): - """The service properties when target service type is SelfHostedServer. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". - :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType - :ivar endpoint: The endpoint of service. - :vartype endpoint: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "endpoint": {"key": "endpoint", "type": "str"}, - } - - def __init__(self, *, endpoint: Optional[str] = None, **kwargs): - """ - :keyword endpoint: The endpoint of service. - :paramtype endpoint: str - """ - super().__init__(**kwargs) - self.type: str = "SelfHostedServer" - self.endpoint = endpoint class ServicePrincipalCertificateAuthInfo(AuthInfoBase): @@ -1850,8 +896,7 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: Application clientId for servicePrincipal auth. Required. :vartype client_id: str @@ -1859,12 +904,6 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): :vartype principal_id: str :ivar certificate: ServicePrincipal certificate for servicePrincipal auth. Required. :vartype certificate: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :vartype roles: list[str] """ _validation = { @@ -1879,20 +918,9 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): "client_id": {"key": "clientId", "type": "str"}, "principal_id": {"key": "principalId", "type": "str"}, "certificate": {"key": "certificate", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } - def __init__( - self, - *, - client_id: str, - principal_id: str, - certificate: str, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, client_id: str, principal_id: str, certificate: str, **kwargs: Any) -> None: """ :keyword client_id: Application clientId for servicePrincipal auth. Required. :paramtype client_id: str @@ -1900,32 +928,21 @@ def __init__( :paramtype principal_id: str :keyword certificate: ServicePrincipal certificate for servicePrincipal auth. Required. :paramtype certificate: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :paramtype roles: list[str] """ super().__init__(**kwargs) self.auth_type: str = "servicePrincipalCertificate" self.client_id = client_id self.principal_id = principal_id self.certificate = certificate - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles -class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class ServicePrincipalSecretAuthInfo(AuthInfoBase): """The authentication info when authType is servicePrincipal secret. All required parameters must be populated in order to send to Azure. - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: ServicePrincipal application clientId for servicePrincipal auth. Required. :vartype client_id: str @@ -1933,12 +950,6 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): :vartype principal_id: str :ivar secret: Secret for servicePrincipal auth. Required. :vartype secret: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :vartype roles: list[str] """ _validation = { @@ -1949,50 +960,26 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "principal_id": {"key": "principalId", "type": "str"}, "secret": {"key": "secret", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } - def __init__( - self, - *, - client_id: str, - principal_id: str, - secret: str, - user_name: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, client_id: str, principal_id: str, secret: str, **kwargs: Any) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str :keyword client_id: ServicePrincipal application clientId for servicePrincipal auth. Required. :paramtype client_id: str :keyword principal_id: Principal Id for servicePrincipal auth. Required. :paramtype principal_id: str :keyword secret: Secret for servicePrincipal auth. Required. :paramtype secret: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :paramtype roles: list[str] """ - super().__init__(user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(**kwargs) self.auth_type: str = "servicePrincipalSecret" self.client_id = client_id self.principal_id = principal_id self.secret = secret - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles class SourceConfiguration(_serialization.Model): @@ -2009,7 +996,7 @@ class SourceConfiguration(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of setting. :paramtype name: str @@ -2021,23 +1008,34 @@ def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, * self.value = value -class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class SourceConfigurationResult(_serialization.Model): + """Configurations for source resource, include appSettings, connectionString and serviceBindings. + + :ivar configurations: The configuration properties for source resource. + :vartype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] + """ + + _attribute_map = { + "configurations": {"key": "configurations", "type": "[SourceConfiguration]"}, + } + + def __init__(self, *, configurations: Optional[List["_models.SourceConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword configurations: The configuration properties for source resource. + :paramtype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] + """ + super().__init__(**kwargs) + self.configurations = configurations + + +class SystemAssignedIdentityAuthInfo(AuthInfoBase): """The authentication info when authType is systemAssignedIdentity. All required parameters must be populated in order to send to Azure. - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure role to be assigned. - :vartype roles: list[str] """ _validation = { @@ -2045,35 +1043,13 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } - def __init__( - self, - *, - user_name: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure role to be assigned. - :paramtype roles: list[str] - """ - super().__init__(user_name=user_name, **kwargs) - self.user_name = user_name + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.auth_type: str = "systemAssignedIdentity" - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles class SystemData(_serialization.Model): @@ -2113,8 +1089,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2140,89 +1116,18 @@ def __init__( self.last_modified_at = last_modified_at -class UserAccountAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): - """The authentication info when authType is user account. - - All required parameters must be populated in order to send to Azure. - - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str - :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar principal_id: Principal Id for user account. - :vartype principal_id: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :vartype roles: list[str] - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - "auth_type": {"key": "authType", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, - } - - def __init__( - self, - *, - user_name: Optional[str] = None, - principal_id: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - :keyword principal_id: Principal Id for user account. - :paramtype principal_id: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :paramtype roles: list[str] - """ - super().__init__(user_name=user_name, **kwargs) - self.user_name = user_name - self.auth_type: str = "userAccount" - self.principal_id = principal_id - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles - - -class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class UserAssignedIdentityAuthInfo(AuthInfoBase): """The authentication info when authType is userAssignedIdentity. All required parameters must be populated in order to send to Azure. - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: Client Id for userAssignedIdentity. :vartype client_id: str :ivar subscription_id: Subscription id for userAssignedIdentity. :vartype subscription_id: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure role to be assigned. - :vartype roles: list[str] """ _validation = { @@ -2230,51 +1135,30 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "subscription_id": {"key": "subscriptionId", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } def __init__( - self, - *, - user_name: Optional[str] = None, - client_id: Optional[str] = None, - subscription_id: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): + self, *, client_id: Optional[str] = None, subscription_id: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str :keyword client_id: Client Id for userAssignedIdentity. :paramtype client_id: str :keyword subscription_id: Subscription id for userAssignedIdentity. :paramtype subscription_id: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure role to be assigned. - :paramtype roles: list[str] """ - super().__init__(user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(**kwargs) self.auth_type: str = "userAssignedIdentity" self.client_id = client_id self.subscription_id = subscription_id - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles class ValidateOperationResult(_serialization.Model): - """The validation operation result for a Linker. + """The validation operation result for a linker. - :ivar resource_id: Validated Linker id. + :ivar resource_id: Validated linker id. :vartype resource_id: str :ivar status: Validation operation status. :vartype status: str @@ -2287,13 +1171,12 @@ class ValidateOperationResult(_serialization.Model): :vartype report_start_time_utc: ~datetime.datetime :ivar report_end_time_utc: The end time of the validation report. :vartype report_end_time_utc: ~datetime.datetime - :ivar source_id: The resource id of the Linker source application. + :ivar source_id: The resource id of the linker source application. :vartype source_id: str :ivar target_id: The resource Id of target service. :vartype target_id: str :ivar auth_type: The authentication type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar validation_detail: The detail of validation result. :vartype validation_detail: list[~azure.mgmt.servicelinker.models.ValidationResultItem] @@ -2325,10 +1208,10 @@ def __init__( target_id: Optional[str] = None, auth_type: Optional[Union[str, "_models.AuthType"]] = None, validation_detail: Optional[List["_models.ValidationResultItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword resource_id: Validated Linker id. + :keyword resource_id: Validated linker id. :paramtype resource_id: str :keyword status: Validation operation status. :paramtype status: str @@ -2341,13 +1224,12 @@ def __init__( :paramtype report_start_time_utc: ~datetime.datetime :keyword report_end_time_utc: The end time of the validation report. :paramtype report_end_time_utc: ~datetime.datetime - :keyword source_id: The resource id of the Linker source application. + :keyword source_id: The resource id of the linker source application. :paramtype source_id: str :keyword target_id: The resource Id of target service. :paramtype target_id: str :keyword auth_type: The authentication type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :paramtype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :keyword validation_detail: The detail of validation result. :paramtype validation_detail: list[~azure.mgmt.servicelinker.models.ValidationResultItem] @@ -2366,7 +1248,7 @@ def __init__( class ValidationResultItem(_serialization.Model): - """The validation item for a Linker. + """The validation item for a linker. :ivar name: The validation item name. :vartype name: str @@ -2396,8 +1278,8 @@ def __init__( result: Optional[Union[str, "_models.ValidationResultStatus"]] = None, error_message: Optional[str] = None, error_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The validation item name. :paramtype name: str @@ -2440,7 +1322,7 @@ class ValueSecretInfo(SecretInfoBase): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The actual value of the secret. :paramtype value: str @@ -2455,32 +1337,16 @@ class VNetSolution(_serialization.Model): :ivar type: Type of VNet solution. Known values are: "serviceEndpoint" and "privateLink". :vartype type: str or ~azure.mgmt.servicelinker.models.VNetSolutionType - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior """ _attribute_map = { "type": {"key": "type", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.VNetSolutionType"]] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.VNetSolutionType"]] = None, **kwargs: Any) -> None: """ :keyword type: Type of VNet solution. Known values are: "serviceEndpoint" and "privateLink". :paramtype type: str or ~azure.mgmt.servicelinker.models.VNetSolutionType - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior """ super().__init__(**kwargs) self.type = type - self.delete_or_update_behavior = delete_or_update_behavior diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py index ae45bc931eaa..ba236f109bca 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py @@ -10,29 +10,10 @@ from azure.core import CaseInsensitiveEnumMeta -class AccessKeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AccessKeyPermissions.""" - - READ = "Read" - WRITE = "Write" - LISTEN = "Listen" - SEND = "Send" - MANAGE = "Manage" - - class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" INTERNAL = "Internal" - ENABLE = "enable" - OPT_OUT = "optOut" - - -class AllowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to allow firewall rules.""" - - TRUE = "true" - FALSE = "false" class AuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -43,8 +24,6 @@ class AuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_PRINCIPAL_SECRET = "servicePrincipalSecret" SERVICE_PRINCIPAL_CERTIFICATE = "servicePrincipalCertificate" SECRET = "secret" - ACCESS_KEY = "accessKey" - USER_ACCOUNT = "userAccount" class AzureResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -78,36 +57,6 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" -class DeleteOrUpdateBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The cleanup behavior to indicate whether clean up operation when resource is deleted or - updated. - """ - - DEFAULT = "Default" - FORCED_CLEANUP = "ForcedCleanup" - - -class DryrunActionName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of action for you dryrun job.""" - - CREATE_OR_UPDATE = "createOrUpdate" - - -class DryrunPrerequisiteResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of dryrun result.""" - - BASIC_ERROR = "basicError" - PERMISSIONS_MISSING = "permissionsMissing" - - -class DryrunPreviewOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operation type.""" - - CONFIG_CONNECTION = "configConnection" - CONFIG_NETWORK = "configNetwork" - CONFIG_AUTH = "configAuth" - - class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". @@ -132,7 +81,6 @@ class TargetServiceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_RESOURCE = "AzureResource" CONFLUENT_BOOTSTRAP_SERVER = "ConfluentBootstrapServer" CONFLUENT_SCHEMA_REGISTRY = "ConfluentSchemaRegistry" - SELF_HOSTED_SERVER = "SelfHostedServer" class ValidationResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py index 80d740a2329c..6a161b8edd91 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py @@ -6,22 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._connector_operations import ConnectorOperations from ._linker_operations import LinkerOperations -from ._linkers_operations import LinkersOperations from ._operations import Operations -from ._configuration_names_operations import ConfigurationNamesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ConnectorOperations", "LinkerOperations", - "LinkersOperations", "Operations", - "ConfigurationNamesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py deleted file mode 100644 index 5faa1ebc6879..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py +++ /dev/null @@ -1,177 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -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(*, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceLinker/configurationNames") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationNamesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.ServiceLinkerManagementClient`'s - :attr:`configuration_names` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ConfigurationNameItem"]: - """Lists the configuration names generated by Service Connector for all target, client types, auth - types. - - :param filter: OData filter options. Default value is None. - :type filter: str - :param skip_token: OData skipToken option for pagination. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationNameItem or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConfigurationNameResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - filter=filter, - skip_token=skip_token, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("ConfigurationNameResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/configurationNames"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py deleted file mode 100644 index fc79258dcc26..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py +++ /dev/null @@ -1,2343 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, resource_group_name: str, location: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_configurations_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConnectorOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.ServiceLinkerManagementClient`'s - :attr:`connector` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> Iterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns" - } - - @distributed_trace - def get_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> _models.DryrunResource: - """get a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - def _create_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> _models.DryrunResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - def _update_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> Optional[_models.DryrunResource]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace - def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace - def list( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> Iterable["_models.LinkerResource"]: - """Returns list of connector which connects to the resource, which supports to config the target - service during the resource provision. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkerResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("ResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors" - } - - @distributed_trace - def get( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> _models.LinkerResource: - """Returns Connector resource for a given name. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - request = build_get_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _create_or_update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> _models.LinkerResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerResource") - - request = build_create_or_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @distributed_trace - def begin_delete( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> _models.LinkerResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") - - request = build_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _validate_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> Optional[_models.ValidateOperationResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - - request = build_validate_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self._validate_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @distributed_trace - def begin_validate( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> LROPoller[_models.ValidateOperationResult]: - """Validate a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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 ValidateOperationResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @overload - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a model type - or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations" - } diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py index 614b13d06c66..8d515886e9fb 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +52,7 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +67,7 @@ def build_get_request(resource_uri: str, linker_name: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +77,7 @@ def build_get_request(resource_uri: str, linker_name: str, **kwargs: Any) -> Htt "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,9 +92,7 @@ def build_create_or_update_request(resource_uri: str, linker_name: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -113,7 +103,7 @@ def build_create_or_update_request(resource_uri: str, linker_name: str, **kwargs "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,9 +120,7 @@ def build_delete_request(resource_uri: str, linker_name: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +130,7 @@ def build_delete_request(resource_uri: str, linker_name: str, **kwargs: Any) -> "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,9 +145,7 @@ def build_update_request(resource_uri: str, linker_name: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +156,7 @@ def build_update_request(resource_uri: str, linker_name: str, **kwargs: Any) -> "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,9 +173,7 @@ def build_validate_request(resource_uri: str, linker_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +185,7 @@ def build_validate_request(resource_uri: str, linker_name: str, **kwargs: Any) - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,9 +200,7 @@ def build_list_configurations_request(resource_uri: str, linker_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +212,7 @@ def build_list_configurations_request(resource_uri: str, linker_name: str, **kwa "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,8 +244,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerResource"]: - """Returns list of Linkers which connects to the resource. which supports to config both - application and target service during the resource provision. + """Returns list of Linkers which connects to the resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -276,10 +257,8 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerReso _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LinkerList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -321,7 +300,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceList", pipeline_response) + deserialized = self._deserialize("LinkerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -330,8 +309,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -371,9 +351,7 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) request = build_get_request( @@ -387,8 +365,9 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,16 +400,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerResource") @@ -449,8 +426,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -485,7 +463,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -521,7 +499,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -551,14 +529,14 @@ def begin_create_or_update( def begin_create_or_update( self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a model type or a IO type. Required. + :param parameters: Linker details. Is either a LinkerResource type or a IO type. Required. :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -579,9 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -640,9 +616,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -656,8 +630,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -674,7 +649,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a Linker. + """Delete a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -696,9 +671,7 @@ def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -752,16 +725,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerPatch") @@ -780,8 +751,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,7 +786,7 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -850,7 +822,7 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -880,14 +852,14 @@ def begin_update( def begin_update( self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :param parameters: Linker details. Is either a model type or a IO type. Required. + :param parameters: Linker details. Is either a LinkerPatch type or a IO type. Required. :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -908,9 +880,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -969,9 +939,7 @@ def _validate_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) request = build_validate_request( @@ -985,8 +953,9 @@ def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,7 +982,7 @@ def _validate_initial( def begin_validate( self, resource_uri: str, linker_name: str, **kwargs: Any ) -> LROPoller[_models.ValidateOperationResult]: - """Validate a Linker. + """Validate a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -1036,9 +1005,7 @@ def begin_validate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1063,7 +1030,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -1083,8 +1050,10 @@ def get_long_running_output(pipeline_response): } @distributed_trace - def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.ConfigurationResult: - """list source configurations for a Linker. + def list_configurations( + self, resource_uri: str, linker_name: str, **kwargs: Any + ) -> _models.SourceConfigurationResult: + """list source configurations for a linker. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -1092,8 +1061,8 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any :param linker_name: The name Linker resource. Required. :type linker_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :return: SourceConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.SourceConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1107,10 +1076,8 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SourceConfigurationResult] = kwargs.pop("cls", None) request = build_list_configurations_request( resource_uri=resource_uri, @@ -1123,8 +1090,9 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1134,7 +1102,7 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConfigurationResult", pipeline_response) + deserialized = self._deserialize("SourceConfigurationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py deleted file mode 100644 index fec0c2e128d4..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py +++ /dev/null @@ -1,1018 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_dryrun_request(resource_uri: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_configurations_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class LinkersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.ServiceLinkerManagementClient`'s - :attr:`linkers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - resource_uri=resource_uri, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - 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("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns"} - - @distributed_trace - def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: - """get a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> _models.DryrunResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> Optional[_models.DryrunResource]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: 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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, 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, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @distributed_trace - def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a model type - or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - } diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py index 3521a31d7e2e..3cf61e1f6103 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py deleted file mode 100644 index d981f77a84c8..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python configuration_names_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.configuration_names.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ConfigurationNamesList.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py deleted file mode 100644 index 82d00a60727c..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_create_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ConnectorDryrunCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py deleted file mode 100644 index 2c046d96e706..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.delete_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ConnectorDryrunDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py deleted file mode 100644 index ae13d8533db1..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.get_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ConnectorDryrunGet.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py deleted file mode 100644 index bb8eaaca762d..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.list_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ConnectorDryrunList.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py deleted file mode 100644 index 4467b5718675..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_update_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ConnectorDryrunUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py deleted file mode 100644 index aab572dfd263..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.list( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ConnectorList.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py deleted file mode 100644 index adb19e3adf45..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connectors.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.get( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/Connectors.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py deleted file mode 100644 index 811175603563..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python delete_connector.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_delete( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/DeleteConnector.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py deleted file mode 100644 index 800955ff6342..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python delete_dryrun.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.delete_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/DeleteDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_link.py similarity index 89% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_link.py index e91d30ca6f6e..eb7fe1c22c81 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python delete_linker.py + python delete_link.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.linker.begin_delete( + client.linker.begin_delete( resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", linker_name="linkName", ).result() - print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/DeleteLinker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/DeleteLink.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py deleted file mode 100644 index 77cc2ee74bec..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python generate_configurations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.generate_configurations( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/GenerateConfigurations.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py index 1477174dc298..2752a106298e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/GetConfigurations.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/GetConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py deleted file mode 100644 index dfc22faeb1e1..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python get_dryrun.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.get_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/GetDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link.py similarity index 93% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link.py index b224b0466d78..97c278e2ae48 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python linker.py + python link.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/Linker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/Link.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link_list.py similarity index 93% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link_list.py index 9e2244cbc26e..48612b4346e2 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python linker_list.py + python link_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/LinkerList.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/LinkList.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py deleted file mode 100644 index 8036dc8e62fa..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python linker_generate_configurations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.generate_configurations( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/LinkerGenerateConfigurations.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py deleted file mode 100644 index 84db1b94bec6..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python list_dryrun.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.list_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ListDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py index e7ad4ed8f194..047089b3f174 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py deleted file mode 100644 index f11233704400..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python patch_dryrun.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.begin_update_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PatchDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_link.py similarity index 95% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_link.py index 89bc8bbaa5a4..7148387db1b5 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python patch_linker.py + python patch_link.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PatchLinker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/PatchLink.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py deleted file mode 100644 index 706dc83da6ce..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python put_dryrun.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.begin_create_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PutDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link.py similarity index 92% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link.py index b9933b4c0513..8f7d389bcebd 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python put_linker.py + python put_link.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -42,13 +42,12 @@ def main(): "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db", "type": "AzureResource", }, - "vNetSolution": {"type": "serviceEndpoint"}, } }, ).result() print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PutLinker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/PutLink.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_secret_store.py similarity index 84% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_secret_store.py index be6cd1e62bbb..a88cf5f2e352 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_secret_store.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python put_connector.py + python put_link_with_secret_store.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,11 +28,9 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.connector.begin_create_or_update( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", + response = client.linker.begin_create_or_update( + resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + linker_name="linkName", parameters={ "properties": { "authInfo": {"authType": "secret"}, @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PutConnector.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/PutLinkWithSecretStore.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_service_endpoint.py similarity index 65% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_service_endpoint.py index 7caaf1938f73..d58a796f7bc6 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_service_endpoint.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python patch_connector.py + python put_link_with_service_endpoint.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,29 +28,30 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.connector.begin_update( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", + response = client.linker.begin_create_or_update( + resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", + linker_name="linkName", parameters={ "properties": { "authInfo": { - "authType": "servicePrincipalSecret", - "clientId": "name", - "principalId": "id", - "secret": "secret", + "authType": "secret", + "name": "name", + "secretInfo": { + "secretType": "keyVaultSecretUri", + "value": "https://vault-name.vault.azure.net/secrets/secret-name/00000000000000000000000000000000", + }, }, "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db", "type": "AzureResource", }, + "vNetSolution": {"type": "serviceEndpoint"}, } }, ).result() print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PatchConnector.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/PutLinkWithServiceEndpoint.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py deleted file mode 100644 index 1f848782d441..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python validate_connector_success.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_validate( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ValidateConnectorSuccess.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_link_success.py similarity index 92% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_link_success.py index 051101a14795..321b2af1e1af 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_link_success.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python validate_linker_success.py + python validate_link_success.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ValidateLinkerSuccess.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2023-05-01/examples/ValidateLinkSuccess.json if __name__ == "__main__": main()