From 415d0340fbd655de1f603e2b747fe173ec370824 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 18 May 2023 08:28:20 +0000 Subject: [PATCH] CodeGen from PR 24047 in Azure/azure-rest-api-specs Merge e325747502773fa7b5892732cdb1309af41c0227 into be87927732065ef673d22746f221c111a50fdb50 --- .../azure-mgmt-resourcehealth/_meta.json | 6 +- .../azure/mgmt/resourcehealth/__init__.py | 4 +- .../mgmt/resourcehealth/_configuration.py | 8 +- ...lth.py => _resource_health_mgmt_client.py} | 83 +- .../mgmt/resourcehealth/_serialization.py | 6 +- .../azure/mgmt/resourcehealth/_version.py | 2 +- .../azure/mgmt/resourcehealth/aio/__init__.py | 4 +- .../mgmt/resourcehealth/aio/_configuration.py | 8 +- ...lth.py => _resource_health_mgmt_client.py} | 83 +- .../azure/mgmt/resourcehealth/models.py | 3 +- .../resourcehealth/v2015_01_01/__init__.py | 4 +- .../v2015_01_01/_configuration.py | 14 +- .../resourcehealth/v2015_01_01/_metadata.json | 8 +- ...lth.py => _resource_health_mgmt_client.py} | 10 +- .../resourcehealth/v2015_01_01/_version.py | 2 +- .../v2015_01_01/aio/__init__.py | 4 +- .../v2015_01_01/aio/_configuration.py | 14 +- ...lth.py => _resource_health_mgmt_client.py} | 10 +- .../_availability_statuses_operations.py | 27 +- ..._child_availability_statuses_operations.py | 17 +- .../operations/_child_resources_operations.py | 12 +- .../v2015_01_01/aio/operations/_operations.py | 12 +- .../v2015_01_01/models/__init__.py | 4 +- .../v2015_01_01/models/_models_py3.py | 36 + ... => _resource_health_mgmt_client_enums.py} | 0 .../_availability_statuses_operations.py | 35 +- ..._child_availability_statuses_operations.py | 21 +- .../operations/_child_resources_operations.py | 14 +- .../v2015_01_01/operations/_operations.py | 14 +- .../resourcehealth/v2018_07_01/__init__.py | 4 +- .../v2018_07_01/_configuration.py | 14 +- .../resourcehealth/v2018_07_01/_metadata.json | 8 +- ...lth.py => _resource_health_mgmt_client.py} | 10 +- .../resourcehealth/v2018_07_01/_version.py | 2 +- .../v2018_07_01/aio/__init__.py | 4 +- .../v2018_07_01/aio/_configuration.py | 14 +- ...lth.py => _resource_health_mgmt_client.py} | 10 +- .../_availability_statuses_operations.py | 27 +- .../operations/_emerging_issues_operations.py | 17 +- .../aio/operations/_events_operations.py | 17 +- .../aio/operations/_metadata_operations.py | 17 +- .../v2018_07_01/aio/operations/_operations.py | 12 +- .../v2018_07_01/models/__init__.py | 24 +- .../v2018_07_01/models/_models_py3.py | 64 +- ... => _resource_health_mgmt_client_enums.py} | 0 .../_availability_statuses_operations.py | 35 +- .../operations/_emerging_issues_operations.py | 21 +- .../operations/_events_operations.py | 21 +- .../operations/_metadata_operations.py | 21 +- .../v2018_07_01/operations/_operations.py | 14 +- .../resourcehealth/v2022_10_01/__init__.py | 26 + .../v2022_10_01/_configuration.py | 66 + .../resourcehealth/v2022_10_01/_metadata.json | 119 + .../mgmt/resourcehealth/v2022_10_01/_patch.py | 20 + .../_resource_health_mgmt_client.py | 142 ++ .../resourcehealth/v2022_10_01/_vendor.py | 30 + .../resourcehealth/v2022_10_01/_version.py | 9 + .../v2022_10_01/aio/__init__.py | 23 + .../v2022_10_01/aio/_configuration.py | 66 + .../resourcehealth/v2022_10_01/aio/_patch.py | 20 + .../aio/_resource_health_mgmt_client.py | 142 ++ .../v2022_10_01/aio/operations/__init__.py | 37 + .../_availability_statuses_operations.py | 425 ++++ ..._child_availability_statuses_operations.py | 225 ++ .../operations/_child_resources_operations.py | 152 ++ .../operations/_emerging_issues_operations.py | 194 ++ .../aio/operations/_event_operations.py | 324 +++ .../aio/operations/_events_operations.py | 342 +++ .../_impacted_resources_operations.py | 375 +++ .../aio/operations/_metadata_operations.py | 191 ++ .../v2022_10_01/aio/operations/_operations.py | 104 + .../v2022_10_01/aio/operations/_patch.py | 20 + ..._advisory_impacted_resources_operations.py | 245 ++ .../v2022_10_01/models/__init__.py | 125 + .../v2022_10_01/models/_models_py3.py | 2140 +++++++++++++++++ .../v2022_10_01/models/_patch.py | 20 + .../_resource_health_mgmt_client_enums.py | 121 + .../v2022_10_01/operations/__init__.py | 37 + .../_availability_statuses_operations.py | 555 +++++ ..._child_availability_statuses_operations.py | 289 +++ .../operations/_child_resources_operations.py | 185 ++ .../operations/_emerging_issues_operations.py | 237 ++ .../operations/_event_operations.py | 442 ++++ .../operations/_events_operations.py | 421 ++++ .../_impacted_resources_operations.py | 493 ++++ .../operations/_metadata_operations.py | 236 ++ .../v2022_10_01/operations/_operations.py | 126 + .../v2022_10_01/operations/_patch.py | 20 + ..._advisory_impacted_resources_operations.py | 308 +++ .../mgmt/resourcehealth/v2022_10_01/py.typed | 1 + .../availability_status_get_by_resource.py | 6 +- .../availability_statuses_list.py | 6 +- ...ability_statuses_list_by_resource_group.py | 6 +- ...bility_statuses_list_by_subscription_id.py | 6 +- ...ild_availability_status_get_by_resource.py | 40 + .../child_availability_statuses_list.py | 41 + .../generated_samples/child_resources_list.py | 41 + .../generated_samples/emerging_issues_get.py | 6 +- .../generated_samples/emerging_issues_list.py | 6 +- ...ails_by_subscription_id_and_tracking_id.py | 40 + ...ch_details_by_tenant_id_and_tracking_id.py | 40 + ..._get_by_subscription_id_and_tracking_id.py | 40 + .../event_get_by_tenant_id_and_tracking_id.py | 40 + .../events_list_by_single_resource.py | 6 +- .../events_list_by_subscription_id.py | 6 +- .../events_list_by_tenant_id.py | 39 + .../impacted_resources_get.py | 41 + .../impacted_resources_get_by_tenant_id.py | 41 + ...ist_by_subscription_id_list_by_event_id.py | 41 + ...rces_list_by_tenant_id_list_by_event_id.py | 41 + .../generated_samples/metadata_get_entity.py | 6 +- .../generated_samples/metadata_list.py | 6 +- .../generated_samples/operations_list.py | 38 + ...ist_by_subscription_id_list_by_event_id.py | 41 + ...rces_list_by_tenant_id_list_by_event_id.py | 41 + 115 files changed, 10174 insertions(+), 365 deletions(-) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/{_microsoft_resource_health.py => _resource_health_mgmt_client.py} (66%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/{_microsoft_resource_health.py => _resource_health_mgmt_client.py} (66%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/{_microsoft_resource_health.py => _resource_health_mgmt_client.py} (92%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/{_microsoft_resource_health.py => _resource_health_mgmt_client.py} (92%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/{_microsoft_resource_health_enums.py => _resource_health_mgmt_client_enums.py} (100%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/{_microsoft_resource_health.py => _resource_health_mgmt_client.py} (92%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/{_microsoft_resource_health.py => _resource_health_mgmt_client.py} (92%) rename sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/{_microsoft_resource_health_enums.py => _resource_health_mgmt_client_enums.py} (100%) create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__init__.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_patch.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_version.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/__init__.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_patch.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/__init__.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_availability_statuses_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_availability_statuses_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_emerging_issues_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_event_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_events_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_impacted_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_patch.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_security_advisory_impacted_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_patch.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/__init__.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_availability_statuses_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_availability_statuses_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_emerging_issues_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_event_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_events_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_impacted_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_patch.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_security_advisory_impacted_resources_operations.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.py create mode 100644 sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json index d1b5bdd1d22a..98a3ebaa6ac2 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json @@ -1,11 +1,11 @@ { - "commit": "51d4c24a011e300b9713179e0515fef35bf3f678", + "commit": "cec2af515b437597591a055207fd9b915d838124", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.4.0", + "@autorest/python@6.4.12", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/resourcehealth/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.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/resourcehealth/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.4.12 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/resourcehealth/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py index 6fb92846ab31..4bc541b954c5 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_resource_health import MicrosoftResourceHealth -__all__ = ['MicrosoftResourceHealth'] +from ._resource_health_mgmt_client import ResourceHealthMgmtClient +__all__ = ['ResourceHealthMgmtClient'] try: from ._patch import patch_sdk # type: ignore diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py index 1f27100b3373..773401cc549a 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py @@ -20,15 +20,15 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class MicrosoftResourceHealthConfiguration(Configuration): - """Configuration for MicrosoftResourceHealth. +class ResourceHealthMgmtClientConfiguration(Configuration): + """Configuration for ResourceHealthMgmtClient. 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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str """ @@ -42,7 +42,7 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) + super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py similarity index 66% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py index e2ddd28c66cd..f2bbdd9a0288 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_resource_health_mgmt_client.py @@ -15,7 +15,7 @@ from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from ._configuration import MicrosoftResourceHealthConfiguration +from ._configuration import ResourceHealthMgmtClientConfiguration from ._serialization import Deserializer, Serializer if TYPE_CHECKING: @@ -29,7 +29,7 @@ def __init__(self, *args, **kwargs): """ pass -class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient): +class ResourceHealthMgmtClient(MultiApiClientMixin, _SDKClient): """The Resource Health Client. This ready contains multiple API versions, to help you deal with all of the Azure clouds @@ -42,7 +42,7 @@ class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient): :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -52,13 +52,11 @@ class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient): :type profile: azure.profiles.KnownProfiles """ - DEFAULT_API_VERSION = '2018-07-01' - _PROFILE_TAG = "azure.mgmt.resourcehealth.MicrosoftResourceHealth" + DEFAULT_API_VERSION = '2022-10-01' + _PROFILE_TAG = "azure.mgmt.resourcehealth.ResourceHealthMgmtClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'child_availability_statuses': '2015-01-01', - 'child_resources': '2015-01-01', }}, _PROFILE_TAG + " latest" ) @@ -72,9 +70,9 @@ def __init__( profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): - self._config = MicrosoftResourceHealthConfiguration(credential, subscription_id, **kwargs) + self._config = ResourceHealthMgmtClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(MicrosoftResourceHealth, self).__init__( + super(ResourceHealthMgmtClient, self).__init__( api_version=api_version, profile=profile ) @@ -89,6 +87,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2015-01-01: :mod:`v2015_01_01.models` * 2018-07-01: :mod:`v2018_07_01.models` + * 2022-10-01: :mod:`v2022_10_01.models` """ if api_version == '2015-01-01': from .v2015_01_01 import models @@ -96,6 +95,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2018-07-01': from .v2018_07_01 import models return models + elif api_version == '2022-10-01': + from .v2022_10_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -104,12 +106,15 @@ def availability_statuses(self): * 2015-01-01: :class:`AvailabilityStatusesOperations` * 2018-07-01: :class:`AvailabilityStatusesOperations` + * 2022-10-01: :class:`AvailabilityStatusesOperations` """ api_version = self._get_api_version('availability_statuses') if api_version == '2015-01-01': from .v2015_01_01.operations import AvailabilityStatusesOperations as OperationClass elif api_version == '2018-07-01': from .v2018_07_01.operations import AvailabilityStatusesOperations as OperationClass + elif api_version == '2022-10-01': + from .v2022_10_01.operations import AvailabilityStatusesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'availability_statuses'".format(api_version)) self._config.api_version = api_version @@ -120,10 +125,13 @@ def child_availability_statuses(self): """Instance depends on the API version: * 2015-01-01: :class:`ChildAvailabilityStatusesOperations` + * 2022-10-01: :class:`ChildAvailabilityStatusesOperations` """ api_version = self._get_api_version('child_availability_statuses') if api_version == '2015-01-01': from .v2015_01_01.operations import ChildAvailabilityStatusesOperations as OperationClass + elif api_version == '2022-10-01': + from .v2022_10_01.operations import ChildAvailabilityStatusesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'child_availability_statuses'".format(api_version)) self._config.api_version = api_version @@ -134,10 +142,13 @@ def child_resources(self): """Instance depends on the API version: * 2015-01-01: :class:`ChildResourcesOperations` + * 2022-10-01: :class:`ChildResourcesOperations` """ api_version = self._get_api_version('child_resources') if api_version == '2015-01-01': from .v2015_01_01.operations import ChildResourcesOperations as OperationClass + elif api_version == '2022-10-01': + from .v2022_10_01.operations import ChildResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'child_resources'".format(api_version)) self._config.api_version = api_version @@ -148,38 +159,75 @@ def emerging_issues(self): """Instance depends on the API version: * 2018-07-01: :class:`EmergingIssuesOperations` + * 2022-10-01: :class:`EmergingIssuesOperations` """ api_version = self._get_api_version('emerging_issues') if api_version == '2018-07-01': from .v2018_07_01.operations import EmergingIssuesOperations as OperationClass + elif api_version == '2022-10-01': + from .v2022_10_01.operations import EmergingIssuesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'emerging_issues'".format(api_version)) self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def event(self): + """Instance depends on the API version: + + * 2022-10-01: :class:`EventOperations` + """ + api_version = self._get_api_version('event') + if api_version == '2022-10-01': + from .v2022_10_01.operations import EventOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'event'".format(api_version)) + self._config.api_version = api_version + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def events(self): """Instance depends on the API version: * 2018-07-01: :class:`EventsOperations` + * 2022-10-01: :class:`EventsOperations` """ api_version = self._get_api_version('events') if api_version == '2018-07-01': from .v2018_07_01.operations import EventsOperations as OperationClass + elif api_version == '2022-10-01': + from .v2022_10_01.operations import EventsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'events'".format(api_version)) self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def impacted_resources(self): + """Instance depends on the API version: + + * 2022-10-01: :class:`ImpactedResourcesOperations` + """ + api_version = self._get_api_version('impacted_resources') + if api_version == '2022-10-01': + from .v2022_10_01.operations import ImpactedResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'impacted_resources'".format(api_version)) + self._config.api_version = api_version + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def metadata(self): """Instance depends on the API version: * 2018-07-01: :class:`MetadataOperations` + * 2022-10-01: :class:`MetadataOperations` """ api_version = self._get_api_version('metadata') if api_version == '2018-07-01': from .v2018_07_01.operations import MetadataOperations as OperationClass + elif api_version == '2022-10-01': + from .v2022_10_01.operations import MetadataOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'metadata'".format(api_version)) self._config.api_version = api_version @@ -191,17 +239,34 @@ def operations(self): * 2015-01-01: :class:`Operations` * 2018-07-01: :class:`Operations` + * 2022-10-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-01-01': from .v2015_01_01.operations import Operations as OperationClass elif api_version == '2018-07-01': from .v2018_07_01.operations import Operations as OperationClass + elif api_version == '2022-10-01': + from .v2022_10_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def security_advisory_impacted_resources(self): + """Instance depends on the API version: + + * 2022-10-01: :class:`SecurityAdvisoryImpactedResourcesOperations` + """ + api_version = self._get_api_version('security_advisory_impacted_resources') + if api_version == '2022-10-01': + from .v2022_10_01.operations import SecurityAdvisoryImpactedResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'security_advisory_impacted_resources'".format(api_version)) + self._config.api_version = api_version + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + def close(self): self._client.close() def __enter__(self): diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py index 25467dfc00bb..e3cc6ce6ed6f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py @@ -631,7 +631,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): @@ -1273,7 +1273,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 @@ -1297,7 +1297,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): diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py index 01c327e5d6a4..a30a458f8b5b 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "0.1.0" \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py index 0333edd9e09f..63b4f89523db 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_resource_health import MicrosoftResourceHealth -__all__ = ['MicrosoftResourceHealth'] +from ._resource_health_mgmt_client import ResourceHealthMgmtClient +__all__ = ['ResourceHealthMgmtClient'] diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py index 7296d25f5a3e..2db2b6990c92 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py @@ -20,15 +20,15 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftResourceHealthConfiguration(Configuration): - """Configuration for MicrosoftResourceHealth. +class ResourceHealthMgmtClientConfiguration(Configuration): + """Configuration for ResourceHealthMgmtClient. 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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str """ @@ -42,7 +42,7 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) + super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_resource_health_mgmt_client.py similarity index 66% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_resource_health_mgmt_client.py index 2510bc1e268f..4e62c555b63c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_resource_health_mgmt_client.py @@ -16,7 +16,7 @@ from azure.profiles.multiapiclient import MultiApiClientMixin from .._serialization import Deserializer, Serializer -from ._configuration import MicrosoftResourceHealthConfiguration +from ._configuration import ResourceHealthMgmtClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -29,7 +29,7 @@ def __init__(self, *args, **kwargs): """ pass -class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient): +class ResourceHealthMgmtClient(MultiApiClientMixin, _SDKClient): """The Resource Health Client. This ready contains multiple API versions, to help you deal with all of the Azure clouds @@ -42,7 +42,7 @@ class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient): :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -52,13 +52,11 @@ class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient): :type profile: azure.profiles.KnownProfiles """ - DEFAULT_API_VERSION = '2018-07-01' - _PROFILE_TAG = "azure.mgmt.resourcehealth.MicrosoftResourceHealth" + DEFAULT_API_VERSION = '2022-10-01' + _PROFILE_TAG = "azure.mgmt.resourcehealth.ResourceHealthMgmtClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'child_availability_statuses': '2015-01-01', - 'child_resources': '2015-01-01', }}, _PROFILE_TAG + " latest" ) @@ -72,9 +70,9 @@ def __init__( profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: - self._config = MicrosoftResourceHealthConfiguration(credential, subscription_id, **kwargs) + self._config = ResourceHealthMgmtClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(MicrosoftResourceHealth, self).__init__( + super(ResourceHealthMgmtClient, self).__init__( api_version=api_version, profile=profile ) @@ -89,6 +87,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2015-01-01: :mod:`v2015_01_01.models` * 2018-07-01: :mod:`v2018_07_01.models` + * 2022-10-01: :mod:`v2022_10_01.models` """ if api_version == '2015-01-01': from ..v2015_01_01 import models @@ -96,6 +95,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2018-07-01': from ..v2018_07_01 import models return models + elif api_version == '2022-10-01': + from ..v2022_10_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -104,12 +106,15 @@ def availability_statuses(self): * 2015-01-01: :class:`AvailabilityStatusesOperations` * 2018-07-01: :class:`AvailabilityStatusesOperations` + * 2022-10-01: :class:`AvailabilityStatusesOperations` """ api_version = self._get_api_version('availability_statuses') if api_version == '2015-01-01': from ..v2015_01_01.aio.operations import AvailabilityStatusesOperations as OperationClass elif api_version == '2018-07-01': from ..v2018_07_01.aio.operations import AvailabilityStatusesOperations as OperationClass + elif api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import AvailabilityStatusesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'availability_statuses'".format(api_version)) self._config.api_version = api_version @@ -120,10 +125,13 @@ def child_availability_statuses(self): """Instance depends on the API version: * 2015-01-01: :class:`ChildAvailabilityStatusesOperations` + * 2022-10-01: :class:`ChildAvailabilityStatusesOperations` """ api_version = self._get_api_version('child_availability_statuses') if api_version == '2015-01-01': from ..v2015_01_01.aio.operations import ChildAvailabilityStatusesOperations as OperationClass + elif api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import ChildAvailabilityStatusesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'child_availability_statuses'".format(api_version)) self._config.api_version = api_version @@ -134,10 +142,13 @@ def child_resources(self): """Instance depends on the API version: * 2015-01-01: :class:`ChildResourcesOperations` + * 2022-10-01: :class:`ChildResourcesOperations` """ api_version = self._get_api_version('child_resources') if api_version == '2015-01-01': from ..v2015_01_01.aio.operations import ChildResourcesOperations as OperationClass + elif api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import ChildResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'child_resources'".format(api_version)) self._config.api_version = api_version @@ -148,38 +159,75 @@ def emerging_issues(self): """Instance depends on the API version: * 2018-07-01: :class:`EmergingIssuesOperations` + * 2022-10-01: :class:`EmergingIssuesOperations` """ api_version = self._get_api_version('emerging_issues') if api_version == '2018-07-01': from ..v2018_07_01.aio.operations import EmergingIssuesOperations as OperationClass + elif api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import EmergingIssuesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'emerging_issues'".format(api_version)) self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def event(self): + """Instance depends on the API version: + + * 2022-10-01: :class:`EventOperations` + """ + api_version = self._get_api_version('event') + if api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import EventOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'event'".format(api_version)) + self._config.api_version = api_version + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def events(self): """Instance depends on the API version: * 2018-07-01: :class:`EventsOperations` + * 2022-10-01: :class:`EventsOperations` """ api_version = self._get_api_version('events') if api_version == '2018-07-01': from ..v2018_07_01.aio.operations import EventsOperations as OperationClass + elif api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import EventsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'events'".format(api_version)) self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def impacted_resources(self): + """Instance depends on the API version: + + * 2022-10-01: :class:`ImpactedResourcesOperations` + """ + api_version = self._get_api_version('impacted_resources') + if api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import ImpactedResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'impacted_resources'".format(api_version)) + self._config.api_version = api_version + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def metadata(self): """Instance depends on the API version: * 2018-07-01: :class:`MetadataOperations` + * 2022-10-01: :class:`MetadataOperations` """ api_version = self._get_api_version('metadata') if api_version == '2018-07-01': from ..v2018_07_01.aio.operations import MetadataOperations as OperationClass + elif api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import MetadataOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'metadata'".format(api_version)) self._config.api_version = api_version @@ -191,17 +239,34 @@ def operations(self): * 2015-01-01: :class:`Operations` * 2018-07-01: :class:`Operations` + * 2022-10-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-01-01': from ..v2015_01_01.aio.operations import Operations as OperationClass elif api_version == '2018-07-01': from ..v2018_07_01.aio.operations import Operations as OperationClass + elif api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def security_advisory_impacted_resources(self): + """Instance depends on the API version: + + * 2022-10-01: :class:`SecurityAdvisoryImpactedResourcesOperations` + """ + api_version = self._get_api_version('security_advisory_impacted_resources') + if api_version == '2022-10-01': + from ..v2022_10_01.aio.operations import SecurityAdvisoryImpactedResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'security_advisory_impacted_resources'".format(api_version)) + self._config.api_version = api_version + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + async def close(self): await self._client.close() async def __aenter__(self): diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py index 23992e41107f..644705b14842 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/models.py @@ -4,5 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2015_01_01.models import * -from .v2018_07_01.models import * +from .v2022_10_01.models import * diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py index b54ca5518ef6..f1e7a4fdd09e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_resource_health import MicrosoftResourceHealth +from ._resource_health_mgmt_client import ResourceHealthMgmtClient from ._version import VERSION __version__ = VERSION @@ -19,7 +19,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftResourceHealth", + "ResourceHealthMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py index 7b34753df363..4b9e5fb82be8 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_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,18 +14,13 @@ 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 -class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftResourceHealth. +class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ResourceHealthMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -42,8 +36,8 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", "2015-01-01") + super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2015-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json index bfe48dba626e..11cff5bc1522 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json @@ -2,16 +2,16 @@ "chosen_version": "2015-01-01", "total_api_version_list": ["2015-01-01"], "client": { - "name": "MicrosoftResourceHealth", - "filename": "_microsoft_resource_health", + "name": "ResourceHealthMgmtClient", + "filename": "_resource_health_mgmt_client", "description": "The Resource Health Client.", "host_value": "\"https://management.azure.com\"", "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "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\": [\"MicrosoftResourceHealthConfiguration\"], \".._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\": [\"MicrosoftResourceHealthConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \".._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\": [\"ResourceHealthMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_resource_health_mgmt_client.py similarity index 92% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_resource_health_mgmt_client.py index f5e4c3ada41c..1fb29e989145 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_resource_health_mgmt_client.py @@ -14,7 +14,7 @@ from . import models as _models from .._serialization import Deserializer, Serializer -from ._configuration import MicrosoftResourceHealthConfiguration +from ._configuration import ResourceHealthMgmtClientConfiguration from .operations import ( AvailabilityStatusesOperations, ChildAvailabilityStatusesOperations, @@ -27,7 +27,7 @@ from azure.core.credentials import TokenCredential -class MicrosoftResourceHealth: # pylint: disable=client-accepts-api-version-keyword +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword """The Resource Health Client. :ivar availability_statuses: AvailabilityStatusesOperations operations @@ -60,10 +60,10 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = MicrosoftResourceHealthConfiguration( + self._config = ResourceHealthMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -103,7 +103,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: def close(self) -> None: self._client.close() - def __enter__(self) -> "MicrosoftResourceHealth": + def __enter__(self) -> "ResourceHealthMgmtClient": self._client.__enter__() return self diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py index 20971492f129..e5754a47ce68 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py index e02d3fbb7c52..d95ad182aa0f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_resource_health import MicrosoftResourceHealth +from ._resource_health_mgmt_client import ResourceHealthMgmtClient try: from ._patch import __all__ as _patch_all @@ -16,7 +16,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftResourceHealth", + "ResourceHealthMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py index a8d670d658ae..b6c8dafa45bd 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/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,18 +14,13 @@ 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 -class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftResourceHealth. +class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ResourceHealthMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -42,8 +36,8 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", "2015-01-01") + super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2015-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_resource_health_mgmt_client.py similarity index 92% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_resource_health_mgmt_client.py index c3fcf7a2ca8d..f0471eb572b5 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_resource_health_mgmt_client.py @@ -14,7 +14,7 @@ from .. import models as _models from ..._serialization import Deserializer, Serializer -from ._configuration import MicrosoftResourceHealthConfiguration +from ._configuration import ResourceHealthMgmtClientConfiguration from .operations import ( AvailabilityStatusesOperations, ChildAvailabilityStatusesOperations, @@ -27,7 +27,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftResourceHealth: # pylint: disable=client-accepts-api-version-keyword +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword """The Resource Health Client. :ivar availability_statuses: AvailabilityStatusesOperations operations @@ -60,10 +60,10 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = MicrosoftResourceHealthConfiguration( + self._config = ResourceHealthMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -103,7 +103,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MicrosoftResourceHealth": + async def __aenter__(self) -> "ResourceHealthMgmtClient": await self._client.__aenter__() return self diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py index 8737693a6f32..05e4b3c40b4f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_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 @@ -36,10 +35,6 @@ 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]] @@ -50,7 +45,7 @@ class AvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s :attr:`availability_statuses` attribute. """ @@ -86,7 +81,7 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -140,8 +135,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 @@ -183,7 +179,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -238,8 +234,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 @@ -292,7 +289,7 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( @@ -307,8 +304,9 @@ async def get_by_resource( 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 @@ -357,7 +355,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -411,8 +409,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py index 0e0bb70f5698..e8d52945f782 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_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 @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._child_availability_statuses_operations import build_get_by_resource_request, 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]] @@ -45,7 +40,7 @@ class ChildAvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s :attr:`child_availability_statuses` attribute. """ @@ -92,7 +87,7 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( @@ -107,8 +102,9 @@ async def get_by_resource( 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 @@ -157,7 +153,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -211,8 +207,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py index f342647ed9ea..73bbb75e9c60 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_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._child_resources_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]] @@ -44,7 +39,7 @@ class ChildResourcesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s :attr:`child_resources` attribute. """ @@ -85,7 +80,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -139,8 +134,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py index 50be7539a9ae..9f1e1eb2d1d1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/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, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,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]] @@ -42,7 +37,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.aio.ResourceHealthMgmtClient`'s :attr:`operations` attribute. """ @@ -75,7 +70,7 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -87,8 +82,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py index f254b8446c6c..4454d8321240 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py @@ -19,8 +19,8 @@ from ._models_py3 import ServiceImpactingEventIncidentProperties from ._models_py3 import ServiceImpactingEventStatus -from ._microsoft_resource_health_enums import AvailabilityStateValues -from ._microsoft_resource_health_enums import ReasonChronicityTypes +from ._resource_health_mgmt_client_enums import AvailabilityStateValues +from ._resource_health_mgmt_client_enums import ReasonChronicityTypes from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py index f109d01529e4..9a0e00300ed9 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_models_py3.py @@ -122,6 +122,16 @@ class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. :vartype reason_type: str + :ivar context: When an event is created, it can either be triggered by a customer or the + platform of the resource and this field will illustrate that. This field is connected to the + category field in this object. + :vartype context: str + :ivar category: When a context field is set to Platform, this field will reflect if the event + was planned or unplanned. If the context field does not have a value of Platform, then this + field will be ignored. + :vartype category: str + :ivar article_id: The Article Id. + :vartype article_id: str :ivar root_cause_attribution_time: When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. :vartype root_cause_attribution_time: ~datetime.datetime @@ -158,6 +168,9 @@ class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too "summary": {"key": "summary", "type": "str"}, "detailed_status": {"key": "detailedStatus", "type": "str"}, "reason_type": {"key": "reasonType", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "article_id": {"key": "articleId", "type": "str"}, "root_cause_attribution_time": {"key": "rootCauseAttributionTime", "type": "iso-8601"}, "resolution_eta": {"key": "resolutionETA", "type": "iso-8601"}, "occured_time": {"key": "occuredTime", "type": "iso-8601"}, @@ -179,6 +192,9 @@ def __init__( summary: Optional[str] = None, detailed_status: Optional[str] = None, reason_type: Optional[str] = None, + context: Optional[str] = None, + category: Optional[str] = None, + article_id: Optional[str] = None, root_cause_attribution_time: Optional[datetime.datetime] = None, resolution_eta: Optional[datetime.datetime] = None, occured_time: Optional[datetime.datetime] = None, @@ -203,6 +219,16 @@ def __init__( the health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. :paramtype reason_type: str + :keyword context: When an event is created, it can either be triggered by a customer or the + platform of the resource and this field will illustrate that. This field is connected to the + category field in this object. + :paramtype context: str + :keyword category: When a context field is set to Platform, this field will reflect if the + event was planned or unplanned. If the context field does not have a value of Platform, then + this field will be ignored. + :paramtype category: str + :keyword article_id: The Article Id. + :paramtype article_id: str :keyword root_cause_attribution_time: When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. :paramtype root_cause_attribution_time: ~datetime.datetime @@ -238,6 +264,9 @@ def __init__( self.summary = summary self.detailed_status = detailed_status self.reason_type = reason_type + self.context = context + self.category = category + self.article_id = article_id self.root_cause_attribution_time = root_cause_attribution_time self.resolution_eta = resolution_eta self.occured_time = occured_time @@ -432,6 +461,8 @@ class RecommendedAction(_serialization.Model): :vartype action: str :ivar action_url: Link to the action. :vartype action_url: str + :ivar action_url_comment: the comment for the Action. + :vartype action_url_comment: str :ivar action_url_text: Substring of action, it describes which text should host the action url. :vartype action_url_text: str """ @@ -439,6 +470,7 @@ class RecommendedAction(_serialization.Model): _attribute_map = { "action": {"key": "action", "type": "str"}, "action_url": {"key": "actionUrl", "type": "str"}, + "action_url_comment": {"key": "_ActionUrl\\.Comment", "type": "str"}, "action_url_text": {"key": "actionUrlText", "type": "str"}, } @@ -447,6 +479,7 @@ def __init__( *, action: Optional[str] = None, action_url: Optional[str] = None, + action_url_comment: Optional[str] = None, action_url_text: Optional[str] = None, **kwargs: Any ) -> None: @@ -455,6 +488,8 @@ def __init__( :paramtype action: str :keyword action_url: Link to the action. :paramtype action_url: str + :keyword action_url_comment: the comment for the Action. + :paramtype action_url_comment: str :keyword action_url_text: Substring of action, it describes which text should host the action url. :paramtype action_url_text: str @@ -462,6 +497,7 @@ def __init__( super().__init__(**kwargs) self.action = action self.action_url = action_url + self.action_url_comment = action_url_comment self.action_url_text = action_url_text diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_microsoft_resource_health_enums.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_resource_health_mgmt_client_enums.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_microsoft_resource_health_enums.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/_resource_health_mgmt_client_enums.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py index 1ce93cd468f1..76c52d3f11d4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_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, _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]] @@ -47,7 +42,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +79,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +113,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +143,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +173,7 @@ class AvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s :attr:`availability_statuses` attribute. """ @@ -214,7 +209,7 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -268,8 +263,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 @@ -311,7 +307,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -366,8 +362,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 @@ -420,7 +417,7 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( @@ -435,8 +432,9 @@ def get_by_resource( 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 +483,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -539,8 +537,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py index 90588fa60598..b548ec7525ab 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_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, _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]] @@ -47,7 +42,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +74,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +104,7 @@ class ChildAvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s :attr:`child_availability_statuses` attribute. """ @@ -156,7 +151,7 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( @@ -171,8 +166,9 @@ def get_by_resource( 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 @@ -221,7 +217,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -275,8 +271,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py index fbd77461c4a6..ca0729a00893 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_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, _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]] @@ -47,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +72,7 @@ class ChildResourcesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s :attr:`child_resources` attribute. """ @@ -118,7 +113,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -172,8 +167,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py index f0f98c1335c4..19afc3e49089 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,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]] @@ -43,7 +38,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["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2015_01_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2015_01_01.ResourceHealthMgmtClient`'s :attr:`operations` attribute. """ @@ -97,7 +92,7 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -109,8 +104,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py index b54ca5518ef6..f1e7a4fdd09e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_resource_health import MicrosoftResourceHealth +from ._resource_health_mgmt_client import ResourceHealthMgmtClient from ._version import VERSION __version__ = VERSION @@ -19,7 +19,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftResourceHealth", + "ResourceHealthMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py index d0da50c9730c..2a6c7a41ebd8 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_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,18 +14,13 @@ 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 -class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftResourceHealth. +class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ResourceHealthMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -42,8 +36,8 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", "2018-07-01") + super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2018-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json index a37a96571b5d..a19822ee1888 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json @@ -2,16 +2,16 @@ "chosen_version": "2018-07-01", "total_api_version_list": ["2018-07-01"], "client": { - "name": "MicrosoftResourceHealth", - "filename": "_microsoft_resource_health", + "name": "ResourceHealthMgmtClient", + "filename": "_resource_health_mgmt_client", "description": "The Resource Health Client.", "host_value": "\"https://management.azure.com\"", "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "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\": [\"MicrosoftResourceHealthConfiguration\"], \".._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\": [\"MicrosoftResourceHealthConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceHealthMgmtClientConfiguration\"], \".._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\": [\"ResourceHealthMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_resource_health_mgmt_client.py similarity index 92% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_resource_health_mgmt_client.py index 6a1ea00b4935..27ea200df321 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_resource_health_mgmt_client.py @@ -14,7 +14,7 @@ from . import models as _models from .._serialization import Deserializer, Serializer -from ._configuration import MicrosoftResourceHealthConfiguration +from ._configuration import ResourceHealthMgmtClientConfiguration from .operations import ( AvailabilityStatusesOperations, EmergingIssuesOperations, @@ -28,7 +28,7 @@ from azure.core.credentials import TokenCredential -class MicrosoftResourceHealth: # pylint: disable=client-accepts-api-version-keyword +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword """The Resource Health Client. :ivar events: EventsOperations operations @@ -62,10 +62,10 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = MicrosoftResourceHealthConfiguration( + self._config = ResourceHealthMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -104,7 +104,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: def close(self) -> None: self._client.close() - def __enter__(self) -> "MicrosoftResourceHealth": + def __enter__(self) -> "ResourceHealthMgmtClient": self._client.__enter__() return self diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py index 20971492f129..e5754a47ce68 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py index e02d3fbb7c52..d95ad182aa0f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_resource_health import MicrosoftResourceHealth +from ._resource_health_mgmt_client import ResourceHealthMgmtClient try: from ._patch import __all__ as _patch_all @@ -16,7 +16,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftResourceHealth", + "ResourceHealthMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py index 7a5f1b7fc164..1252777a1917 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/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,18 +14,13 @@ 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 -class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftResourceHealth. +class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ResourceHealthMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -42,8 +36,8 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", "2018-07-01") + super(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2018-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_resource_health_mgmt_client.py similarity index 92% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_resource_health_mgmt_client.py index 0cdb7f1e8b84..03f50a61e6f5 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_resource_health_mgmt_client.py @@ -14,7 +14,7 @@ from .. import models as _models from ..._serialization import Deserializer, Serializer -from ._configuration import MicrosoftResourceHealthConfiguration +from ._configuration import ResourceHealthMgmtClientConfiguration from .operations import ( AvailabilityStatusesOperations, EmergingIssuesOperations, @@ -28,7 +28,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftResourceHealth: # pylint: disable=client-accepts-api-version-keyword +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword """The Resource Health Client. :ivar events: EventsOperations operations @@ -62,10 +62,10 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = MicrosoftResourceHealthConfiguration( + self._config = ResourceHealthMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -104,7 +104,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MicrosoftResourceHealth": + async def __aenter__(self) -> "ResourceHealthMgmtClient": await self._client.__aenter__() return self diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py index 4366f2918f1e..c9f530bf4c4a 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_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 @@ -36,10 +35,6 @@ 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]] @@ -50,7 +45,7 @@ class AvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s :attr:`availability_statuses` attribute. """ @@ -87,7 +82,7 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -141,8 +136,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 @@ -185,7 +181,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -240,8 +236,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 @@ -296,7 +293,7 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( @@ -311,8 +308,9 @@ async def get_by_resource( 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 @@ -362,7 +360,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -416,8 +414,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py index 1f19c1c2e295..276f63767bf1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_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, Union import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._emerging_issues_operations import build_get_request, 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]] @@ -45,7 +40,7 @@ class EmergingIssuesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s :attr:`emerging_issues` attribute. """ @@ -80,7 +75,7 @@ async def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) request = build_get_request( @@ -93,8 +88,9 @@ async def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _mo 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 @@ -127,7 +123,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) error_map = { @@ -178,8 +174,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py index cf5fd38ee99b..971e3e075e31 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_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 @@ -33,10 +32,6 @@ build_list_by_subscription_id_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]] @@ -47,7 +42,7 @@ class EventsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s :attr:`events` attribute. """ @@ -91,7 +86,7 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { @@ -146,8 +141,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 @@ -194,7 +190,7 @@ def list_by_single_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { @@ -248,8 +244,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py index 03b44476404e..8ba02caf94cc 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_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 @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._metadata_operations import build_get_entity_request, 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]] @@ -45,7 +40,7 @@ class MetadataOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s :attr:`metadata` attribute. """ @@ -71,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) error_map = { @@ -122,8 +117,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 @@ -160,7 +156,7 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) request = build_get_entity_request( @@ -173,8 +169,9 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py index e4ff11a438ea..3463eaca98cb 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/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, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,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]] @@ -42,7 +37,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.aio.ResourceHealthMgmtClient`'s :attr:`operations` attribute. """ @@ -75,7 +70,7 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -87,8 +82,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py index 54f19b7e4f22..cff572f1f903 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py @@ -40,18 +40,18 @@ from ._models_py3 import StatusBanner from ._models_py3 import Update -from ._microsoft_resource_health_enums import AvailabilityStateValues -from ._microsoft_resource_health_enums import Enum8 -from ._microsoft_resource_health_enums import EventLevelValues -from ._microsoft_resource_health_enums import EventSourceValues -from ._microsoft_resource_health_enums import EventStatusValues -from ._microsoft_resource_health_enums import EventTypeValues -from ._microsoft_resource_health_enums import LevelValues -from ._microsoft_resource_health_enums import LinkTypeValues -from ._microsoft_resource_health_enums import ReasonChronicityTypes -from ._microsoft_resource_health_enums import Scenario -from ._microsoft_resource_health_enums import SeverityValues -from ._microsoft_resource_health_enums import StageValues +from ._resource_health_mgmt_client_enums import AvailabilityStateValues +from ._resource_health_mgmt_client_enums import Enum8 +from ._resource_health_mgmt_client_enums import EventLevelValues +from ._resource_health_mgmt_client_enums import EventSourceValues +from ._resource_health_mgmt_client_enums import EventStatusValues +from ._resource_health_mgmt_client_enums import EventTypeValues +from ._resource_health_mgmt_client_enums import LevelValues +from ._resource_health_mgmt_client_enums import LinkTypeValues +from ._resource_health_mgmt_client_enums import ReasonChronicityTypes +from ._resource_health_mgmt_client_enums import Scenario +from ._resource_health_mgmt_client_enums import SeverityValues +from ._resource_health_mgmt_client_enums import StageValues from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py index d7a7ef94362f..aa775b795005 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_models_py3.py @@ -130,6 +130,16 @@ class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. :vartype reason_type: str + :ivar context: When an event is created, it can either be triggered by a customer or the + platform of the resource and this field will illustrate that. This field is connected to the + category field in this object. + :vartype context: str + :ivar category: When a context field is set to Platform, this field will reflect if the event + was planned or unplanned. If the context field does not have a value of Platform, then this + field will be ignored. + :vartype category: str + :ivar article_id: The Article Id. + :vartype article_id: str :ivar root_cause_attribution_time: When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. :vartype root_cause_attribution_time: ~datetime.datetime @@ -175,6 +185,9 @@ class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too "summary": {"key": "summary", "type": "str"}, "detailed_status": {"key": "detailedStatus", "type": "str"}, "reason_type": {"key": "reasonType", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "article_id": {"key": "articleId", "type": "str"}, "root_cause_attribution_time": {"key": "rootCauseAttributionTime", "type": "iso-8601"}, "health_event_type": {"key": "healthEventType", "type": "str"}, "health_event_cause": {"key": "healthEventCause", "type": "str"}, @@ -196,6 +209,9 @@ def __init__( summary: Optional[str] = None, detailed_status: Optional[str] = None, reason_type: Optional[str] = None, + context: Optional[str] = None, + category: Optional[str] = None, + article_id: Optional[str] = None, root_cause_attribution_time: Optional[datetime.datetime] = None, health_event_type: Optional[str] = None, health_event_cause: Optional[str] = None, @@ -224,6 +240,16 @@ def __init__( the health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. :paramtype reason_type: str + :keyword context: When an event is created, it can either be triggered by a customer or the + platform of the resource and this field will illustrate that. This field is connected to the + category field in this object. + :paramtype context: str + :keyword category: When a context field is set to Platform, this field will reflect if the + event was planned or unplanned. If the context field does not have a value of Platform, then + this field will be ignored. + :paramtype category: str + :keyword article_id: The Article Id. + :paramtype article_id: str :keyword root_cause_attribution_time: When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. :paramtype root_cause_attribution_time: ~datetime.datetime @@ -268,6 +294,9 @@ def __init__( self.summary = summary self.detailed_status = detailed_status self.reason_type = reason_type + self.context = context + self.category = category + self.article_id = article_id self.root_cause_attribution_time = root_cause_attribution_time self.health_event_type = health_event_type self.health_event_cause = health_event_cause @@ -555,6 +584,8 @@ class Event(Resource): # pylint: disable=too-many-instance-attributes :ivar event_level: Level of event. Known values are: "Critical", "Error", "Warning", and "Informational". :vartype event_level: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventLevelValues + :ivar reason: The reason for the Incident. + :vartype reason: str :ivar article: Article of event. :vartype article: ~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesArticle :ivar links: Useful links of event. @@ -614,6 +645,7 @@ class Event(Resource): # pylint: disable=too-many-instance-attributes "header": {"key": "properties.header", "type": "str"}, "level": {"key": "properties.level", "type": "str"}, "event_level": {"key": "properties.eventLevel", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, "article": {"key": "properties.article", "type": "EventPropertiesArticle"}, "links": {"key": "properties.links", "type": "[Link]"}, "impact_start_time": {"key": "properties.impactStartTime", "type": "iso-8601"}, @@ -642,6 +674,7 @@ def __init__( # pylint: disable=too-many-locals header: Optional[str] = None, level: Optional[Union[str, "_models.LevelValues"]] = None, event_level: Optional[Union[str, "_models.EventLevelValues"]] = None, + reason: Optional[str] = None, article: Optional["_models.EventPropertiesArticle"] = None, links: Optional[List["_models.Link"]] = None, impact_start_time: Optional[datetime.datetime] = None, @@ -678,6 +711,8 @@ def __init__( # pylint: disable=too-many-locals :keyword event_level: Level of event. Known values are: "Critical", "Error", "Warning", and "Informational". :paramtype event_level: str or ~azure.mgmt.resourcehealth.v2018_07_01.models.EventLevelValues + :keyword reason: The reason for the Incident. + :paramtype reason: str :keyword article: Article of event. :paramtype article: ~azure.mgmt.resourcehealth.v2018_07_01.models.EventPropertiesArticle :keyword links: Useful links of event. @@ -728,6 +763,7 @@ def __init__( # pylint: disable=too-many-locals self.header = header self.level = level self.event_level = event_level + self.reason = reason self.article = article self.links = links self.impact_start_time = impact_start_time @@ -750,19 +786,38 @@ class EventPropertiesArticle(_serialization.Model): :ivar article_content: Article content of event. :vartype article_content: str + :ivar article_id: Article Id. + :vartype article_id: str + :ivar parameters: It provides a map of parameter name and value. + :vartype parameters: JSON """ _attribute_map = { "article_content": {"key": "articleContent", "type": "str"}, + "article_id": {"key": "articleId", "type": "str"}, + "parameters": {"key": "parameters", "type": "object"}, } - def __init__(self, *, article_content: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + article_content: Optional[str] = None, + article_id: Optional[str] = None, + parameters: Optional[JSON] = None, + **kwargs: Any + ) -> None: """ :keyword article_content: Article content of event. :paramtype article_content: str + :keyword article_id: Article Id. + :paramtype article_id: str + :keyword parameters: It provides a map of parameter name and value. + :paramtype parameters: JSON """ super().__init__(**kwargs) self.article_content = article_content + self.article_id = article_id + self.parameters = parameters class EventPropertiesRecommendedActions(_serialization.Model): @@ -1348,6 +1403,8 @@ class RecommendedAction(_serialization.Model): :vartype action: str :ivar action_url: Link to the action. :vartype action_url: str + :ivar action_url_comment: the comment for the Action. + :vartype action_url_comment: str :ivar action_url_text: Substring of action, it describes which text should host the action url. :vartype action_url_text: str """ @@ -1355,6 +1412,7 @@ class RecommendedAction(_serialization.Model): _attribute_map = { "action": {"key": "action", "type": "str"}, "action_url": {"key": "actionUrl", "type": "str"}, + "action_url_comment": {"key": "_ActionUrl\\.Comment", "type": "str"}, "action_url_text": {"key": "actionUrlText", "type": "str"}, } @@ -1363,6 +1421,7 @@ def __init__( *, action: Optional[str] = None, action_url: Optional[str] = None, + action_url_comment: Optional[str] = None, action_url_text: Optional[str] = None, **kwargs: Any ) -> None: @@ -1371,6 +1430,8 @@ def __init__( :paramtype action: str :keyword action_url: Link to the action. :paramtype action_url: str + :keyword action_url_comment: the comment for the Action. + :paramtype action_url_comment: str :keyword action_url_text: Substring of action, it describes which text should host the action url. :paramtype action_url_text: str @@ -1378,6 +1439,7 @@ def __init__( super().__init__(**kwargs) self.action = action self.action_url = action_url + self.action_url_comment = action_url_comment self.action_url_text = action_url_text diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_microsoft_resource_health_enums.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_resource_health_mgmt_client_enums.py similarity index 100% rename from sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_microsoft_resource_health_enums.py rename to sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/_resource_health_mgmt_client_enums.py diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py index 0d8204da04f8..c9487f9aea51 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_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, _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]] @@ -47,7 +42,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +79,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +113,7 @@ def build_get_by_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +143,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +173,7 @@ class AvailabilityStatusesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s :attr:`availability_statuses` attribute. """ @@ -215,7 +210,7 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -269,8 +264,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 @@ -313,7 +309,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -368,8 +364,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 @@ -424,7 +421,7 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( @@ -439,8 +436,9 @@ def get_by_resource( 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 @@ -490,7 +488,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -544,8 +542,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py index 67e0e64497e4..03790aaabe60 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_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, Union import urllib.parse @@ -30,10 +29,6 @@ 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]] @@ -45,7 +40,7 @@ def build_get_request(issue_name: Union[str, _models.Enum8], **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +64,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["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +85,7 @@ class EmergingIssuesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s :attr:`emerging_issues` attribute. """ @@ -125,7 +120,7 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) request = build_get_request( @@ -138,8 +133,9 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E 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 @@ -172,7 +168,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) error_map = { @@ -223,8 +219,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py index 2fc1b98f4827..e5f4c4992b75 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_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, _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]] @@ -52,7 +47,7 @@ def build_list_by_subscription_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +79,7 @@ def build_list_by_single_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +109,7 @@ class EventsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s :attr:`events` attribute. """ @@ -157,7 +152,7 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { @@ -212,8 +207,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 @@ -259,7 +255,7 @@ def list_by_single_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { @@ -313,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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py index 1636ab55b347..f58b3d2d1228 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_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, _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]] @@ -45,7 +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["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,7 @@ def build_get_entity_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +85,7 @@ class MetadataOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s :attr:`metadata` attribute. """ @@ -116,7 +111,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) error_map = { @@ -167,8 +162,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 @@ -205,7 +201,7 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) request = build_get_entity_request( @@ -218,8 +214,9 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py index 6f8c3f7b5fbd..07d9a37dd47b 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,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]] @@ -43,7 +38,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["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.resourcehealth.v2018_07_01.MicrosoftResourceHealth`'s + :class:`~azure.mgmt.resourcehealth.v2018_07_01.ResourceHealthMgmtClient`'s :attr:`operations` attribute. """ @@ -97,7 +92,7 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -109,8 +104,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__init__.py new file mode 100644 index 000000000000..f1e7a4fdd09e --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/__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 ._resource_health_mgmt_client import ResourceHealthMgmtClient +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__ = [ + "ResourceHealthMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py new file mode 100644 index 000000000000..db8ec5454a31 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ResourceHealthMgmtClient. + + 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: The ID of the target subscription. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-10-01". 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(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2022-10-01") + + 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-resourcehealth/{}".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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json new file mode 100644 index 000000000000..ed81da05bb5b --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_metadata.json @@ -0,0 +1,119 @@ +{ + "chosen_version": "2022-10-01", + "total_api_version_list": ["2022-10-01"], + "client": { + "name": "ResourceHealthMgmtClient", + "filename": "_resource_health_mgmt_client", + "description": "The Resource Health Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": false, + "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\": [\"ResourceHealthMgmtClientConfiguration\"], \".._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\": [\"ResourceHealthMgmtClientConfiguration\"], \"..._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": "The ID of the target subscription. 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": "The ID of the target subscription. 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": { + "availability_statuses": "AvailabilityStatusesOperations", + "operations": "Operations", + "metadata": "MetadataOperations", + "impacted_resources": "ImpactedResourcesOperations", + "security_advisory_impacted_resources": "SecurityAdvisoryImpactedResourcesOperations", + "events": "EventsOperations", + "event": "EventOperations", + "child_availability_statuses": "ChildAvailabilityStatusesOperations", + "child_resources": "ChildResourcesOperations", + "emerging_issues": "EmergingIssuesOperations" + } +} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py new file mode 100644 index 000000000000..ba0ff2c9df59 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_resource_health_mgmt_client.py @@ -0,0 +1,142 @@ +# 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 ResourceHealthMgmtClientConfiguration +from .operations import ( + AvailabilityStatusesOperations, + ChildAvailabilityStatusesOperations, + ChildResourcesOperations, + EmergingIssuesOperations, + EventOperations, + EventsOperations, + ImpactedResourcesOperations, + MetadataOperations, + Operations, + SecurityAdvisoryImpactedResourcesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Resource Health Client. + + :ivar availability_statuses: AvailabilityStatusesOperations operations + :vartype availability_statuses: + azure.mgmt.resourcehealth.v2022_10_01.operations.AvailabilityStatusesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resourcehealth.v2022_10_01.operations.Operations + :ivar metadata: MetadataOperations operations + :vartype metadata: azure.mgmt.resourcehealth.v2022_10_01.operations.MetadataOperations + :ivar impacted_resources: ImpactedResourcesOperations operations + :vartype impacted_resources: + azure.mgmt.resourcehealth.v2022_10_01.operations.ImpactedResourcesOperations + :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations + operations + :vartype security_advisory_impacted_resources: + azure.mgmt.resourcehealth.v2022_10_01.operations.SecurityAdvisoryImpactedResourcesOperations + :ivar events: EventsOperations operations + :vartype events: azure.mgmt.resourcehealth.v2022_10_01.operations.EventsOperations + :ivar event: EventOperations operations + :vartype event: azure.mgmt.resourcehealth.v2022_10_01.operations.EventOperations + :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations + :vartype child_availability_statuses: + azure.mgmt.resourcehealth.v2022_10_01.operations.ChildAvailabilityStatusesOperations + :ivar child_resources: ChildResourcesOperations operations + :vartype child_resources: + azure.mgmt.resourcehealth.v2022_10_01.operations.ChildResourcesOperations + :ivar emerging_issues: EmergingIssuesOperations operations + :vartype emerging_issues: + azure.mgmt.resourcehealth.v2022_10_01.operations.EmergingIssuesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. 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 "2022-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ResourceHealthMgmtClientConfiguration( + 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.availability_statuses = AvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize) + self.impacted_resources = ImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize) + self.child_availability_statuses = ChildAvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.child_resources = ChildResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.emerging_issues = EmergingIssuesOperations(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. + + >>> 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) -> "ResourceHealthMgmtClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py new file mode 100644 index 000000000000..bd0df84f5319 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_vendor.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------- +# 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 List, cast + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/_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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/__init__.py new file mode 100644 index 000000000000..d95ad182aa0f --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/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 ._resource_health_mgmt_client import ResourceHealthMgmtClient + +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__ = [ + "ResourceHealthMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py new file mode 100644 index 000000000000..b820b5733897 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ResourceHealthMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ResourceHealthMgmtClient. + + 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: The ID of the target subscription. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-10-01". 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(ResourceHealthMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2022-10-01") + + 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-resourcehealth/{}".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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py new file mode 100644 index 000000000000..4a24fd2c9c22 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/_resource_health_mgmt_client.py @@ -0,0 +1,142 @@ +# 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 ResourceHealthMgmtClientConfiguration +from .operations import ( + AvailabilityStatusesOperations, + ChildAvailabilityStatusesOperations, + ChildResourcesOperations, + EmergingIssuesOperations, + EventOperations, + EventsOperations, + ImpactedResourcesOperations, + MetadataOperations, + Operations, + SecurityAdvisoryImpactedResourcesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ResourceHealthMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Resource Health Client. + + :ivar availability_statuses: AvailabilityStatusesOperations operations + :vartype availability_statuses: + azure.mgmt.resourcehealth.v2022_10_01.aio.operations.AvailabilityStatusesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.Operations + :ivar metadata: MetadataOperations operations + :vartype metadata: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.MetadataOperations + :ivar impacted_resources: ImpactedResourcesOperations operations + :vartype impacted_resources: + azure.mgmt.resourcehealth.v2022_10_01.aio.operations.ImpactedResourcesOperations + :ivar security_advisory_impacted_resources: SecurityAdvisoryImpactedResourcesOperations + operations + :vartype security_advisory_impacted_resources: + azure.mgmt.resourcehealth.v2022_10_01.aio.operations.SecurityAdvisoryImpactedResourcesOperations + :ivar events: EventsOperations operations + :vartype events: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.EventsOperations + :ivar event: EventOperations operations + :vartype event: azure.mgmt.resourcehealth.v2022_10_01.aio.operations.EventOperations + :ivar child_availability_statuses: ChildAvailabilityStatusesOperations operations + :vartype child_availability_statuses: + azure.mgmt.resourcehealth.v2022_10_01.aio.operations.ChildAvailabilityStatusesOperations + :ivar child_resources: ChildResourcesOperations operations + :vartype child_resources: + azure.mgmt.resourcehealth.v2022_10_01.aio.operations.ChildResourcesOperations + :ivar emerging_issues: EmergingIssuesOperations operations + :vartype emerging_issues: + azure.mgmt.resourcehealth.v2022_10_01.aio.operations.EmergingIssuesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. 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 "2022-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ResourceHealthMgmtClientConfiguration( + 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.availability_statuses = AvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize) + self.impacted_resources = ImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.security_advisory_impacted_resources = SecurityAdvisoryImpactedResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event = EventOperations(self._client, self._config, self._serialize, self._deserialize) + self.child_availability_statuses = ChildAvailabilityStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.child_resources = ChildResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.emerging_issues = EmergingIssuesOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/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) -> "ResourceHealthMgmtClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/__init__.py new file mode 100644 index 000000000000..5ef1b5084a40 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/__init__.py @@ -0,0 +1,37 @@ +# 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 ._availability_statuses_operations import AvailabilityStatusesOperations +from ._operations import Operations +from ._metadata_operations import MetadataOperations +from ._impacted_resources_operations import ImpactedResourcesOperations +from ._security_advisory_impacted_resources_operations import SecurityAdvisoryImpactedResourcesOperations +from ._events_operations import EventsOperations +from ._event_operations import EventOperations +from ._child_availability_statuses_operations import ChildAvailabilityStatusesOperations +from ._child_resources_operations import ChildResourcesOperations +from ._emerging_issues_operations import EmergingIssuesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AvailabilityStatusesOperations", + "Operations", + "MetadataOperations", + "ImpactedResourcesOperations", + "SecurityAdvisoryImpactedResourcesOperations", + "EventsOperations", + "EventOperations", + "ChildAvailabilityStatusesOperations", + "ChildResourcesOperations", + "EmergingIssuesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_availability_statuses_operations.py new file mode 100644 index 000000000000..7c1074661418 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_availability_statuses_operations.py @@ -0,0 +1,425 @@ +# 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 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.tracing.decorator_async import distributed_trace_async +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._availability_statuses_operations import ( + build_get_by_resource_request, + build_list_by_resource_group_request, + build_list_by_subscription_id_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AvailabilityStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`availability_statuses` 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_by_subscription_id( + self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AvailabilityStatus"]: + """Lists the current availability status for all the resources in the subscription. + + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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_by_subscription_id_request( + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + api_version=api_version, + template_url=self.list_by_subscription_id.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("AvailabilityStatusListResult", 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) + 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_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AvailabilityStatus"]: + """Lists the current availability status for all the resources in the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } + + @distributed_trace_async + async def get_by_resource( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> _models.AvailabilityStatus: + """Gets current availability status for a single resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API support not nested and one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + and + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) + + request = build_get_by_resource_request( + resource_uri=resource_uri, + filter=filter, + expand=expand, + api_version=api_version, + template_url=self.get_by_resource.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} + + @distributed_trace + def list( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AvailabilityStatus"]: + """Lists all historical availability transitions and impacting events for a single resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API support not nested and one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + and + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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( + resource_uri=resource_uri, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_availability_statuses_operations.py new file mode 100644 index 000000000000..e8fd034549bd --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_availability_statuses_operations.py @@ -0,0 +1,225 @@ +# 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 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.tracing.decorator_async import distributed_trace_async +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._child_availability_statuses_operations import build_get_by_resource_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ChildAvailabilityStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`child_availability_statuses` 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_async + async def get_by_resource( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> _models.AvailabilityStatus: + """Gets current availability status for a single resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API only support one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) + + request = build_get_by_resource_request( + resource_uri=resource_uri, + filter=filter, + expand=expand, + api_version=api_version, + template_url=self.get_by_resource.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_resource.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + } + + @distributed_trace + def list( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AvailabilityStatus"]: + """Lists the historical availability statuses for a single child resource. Use the nextLink + property in the response to get the next page of availability status. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API only support one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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( + resource_uri=resource_uri, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_resources_operations.py new file mode 100644 index 000000000000..d1670fc6246a --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_child_resources_operations.py @@ -0,0 +1,152 @@ +# 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 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._child_resources_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ChildResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`child_resources` 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, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AvailabilityStatus"]: + """Lists the all the children and its current health status for a parent resource. Use the + nextLink property in the response to get the next page of children current health. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API only support not nested parent resource type: + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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( + resource_uri=resource_uri, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_emerging_issues_operations.py new file mode 100644 index 000000000000..0d130fb393dd --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_emerging_issues_operations.py @@ -0,0 +1,194 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +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.tracing.decorator_async import distributed_trace_async +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._emerging_issues_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EmergingIssuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`emerging_issues` 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, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult"]: + """Lists Azure services' emerging issues. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EmergingIssuesGetResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] + :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", "2022-10-01")) + cls: ClsType[_models.EmergingIssueListResult] = 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( + 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("EmergingIssueListResult", 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) + 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.ResourceHealth/emergingIssues"} + + @distributed_trace_async + async def get( + self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any + ) -> _models.EmergingIssuesGetResult: + """Gets Azure services' emerging issues. + + :param issue_name: The name of the emerging issue. "default" Required. + :type issue_name: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.IssueNameParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EmergingIssuesGetResult or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult + :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", "2022-10-01")) + cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) + + request = build_get_request( + issue_name=issue_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) + + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_event_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_event_operations.py new file mode 100644 index 000000000000..c78a67e0eaf8 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_event_operations.py @@ -0,0 +1,324 @@ +# 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 typing import Any, Callable, Dict, Optional, TypeVar + +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_async import distributed_trace_async +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._event_operations import ( + build_fetch_details_by_subscription_id_and_tracking_id_request, + build_fetch_details_by_tenant_id_and_tracking_id_request, + build_get_by_subscription_id_and_tracking_id_request, + build_get_by_tenant_id_and_tracking_id_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EventOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`event` 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_async + async def get_by_subscription_id_and_tracking_id( + self, + event_tracking_id: str, + filter: Optional[str] = None, + query_start_time: Optional[str] = None, + **kwargs: Any + ) -> _models.Event: + """Service health event in the subscription by event tracking id. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_get_by_subscription_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.get_by_subscription_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_subscription_id_and_tracking_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" + } + + @distributed_trace_async + async def fetch_details_by_subscription_id_and_tracking_id( + self, event_tracking_id: str, **kwargs: Any + ) -> _models.Event: + """Service health event details in the subscription by event tracking id. This can be used to + fetch sensitive properties for Security Advisory events. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_fetch_details_by_subscription_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.fetch_details_by_subscription_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + fetch_details_by_subscription_id_and_tracking_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" + } + + @distributed_trace_async + async def get_by_tenant_id_and_tracking_id( + self, + event_tracking_id: str, + filter: Optional[str] = None, + query_start_time: Optional[str] = None, + **kwargs: Any + ) -> _models.Event: + """Service health event in the tenant by event tracking id. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_get_by_tenant_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.get_by_tenant_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_tenant_id_and_tracking_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"} + + @distributed_trace_async + async def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: + """Service health event details in the tenant by event tracking id. This can be used to fetch + sensitive properties for Security Advisory events. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_fetch_details_by_tenant_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + api_version=api_version, + template_url=self.fetch_details_by_tenant_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + fetch_details_by_tenant_id_and_tracking_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" + } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_events_operations.py new file mode 100644 index 000000000000..aadb256df1fb --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_events_operations.py @@ -0,0 +1,342 @@ +# 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 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._events_operations import ( + build_list_by_single_resource_request, + build_list_by_subscription_id_request, + build_list_by_tenant_id_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EventsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`events` 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_by_subscription_id( + self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Event"]: + """Lists service health events in the subscription. + + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :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", "2022-10-01")) + cls: ClsType[_models.Events] = 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_by_subscription_id_request( + subscription_id=self._config.subscription_id, + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.list_by_subscription_id.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("Events", 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) + 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_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" + } + + @distributed_trace + def list_by_tenant_id( + self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Event"]: + """Lists current service health events in the tenant. + + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :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", "2022-10-01")) + cls: ClsType[_models.Events] = 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_by_tenant_id_request( + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.list_by_tenant_id.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("Events", 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) + 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_by_tenant_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events"} + + @distributed_trace + def list_by_single_resource( + self, resource_uri: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Event"]: + """Lists current service health events for given resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API support not nested and one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + and + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :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", "2022-10-01")) + cls: ClsType[_models.Events] = 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_by_single_resource_request( + resource_uri=resource_uri, + filter=filter, + api_version=api_version, + template_url=self.list_by_single_resource.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("Events", 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) + 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_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_impacted_resources_operations.py new file mode 100644 index 000000000000..bed481914cde --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_impacted_resources_operations.py @@ -0,0 +1,375 @@ +# 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 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.tracing.decorator_async import distributed_trace_async +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._impacted_resources_operations import ( + build_get_by_tenant_id_request, + build_get_request, + build_list_by_subscription_id_and_event_id_request, + build_list_by_tenant_id_and_event_id_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ImpactedResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`impacted_resources` 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_by_subscription_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.EventImpactedResource"]: + """Lists impacted resources in the subscription by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_subscription_id_and_event_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_subscription_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_subscription_id_and_event_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" + } + + @distributed_trace_async + async def get( + self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any + ) -> _models.EventImpactedResource: + """Gets the specific impacted resource in the subscription by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param impacted_resource_name: Name of the Impacted Resource. Required. + :type impacted_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventImpactedResource or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) + + request = build_get_request( + event_tracking_id=event_tracking_id, + impacted_resource_name=impacted_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EventImpactedResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" + } + + @distributed_trace + def list_by_tenant_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.EventImpactedResource"]: + """Lists impacted resources in the tenant by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_tenant_id_and_event_id_request( + event_tracking_id=event_tracking_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_tenant_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_tenant_id_and_event_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" + } + + @distributed_trace_async + async def get_by_tenant_id( + self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any + ) -> _models.EventImpactedResource: + """Gets the specific impacted resource in the tenant by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param impacted_resource_name: Name of the Impacted Resource. Required. + :type impacted_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventImpactedResource or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) + + request = build_get_by_tenant_id_request( + event_tracking_id=event_tracking_id, + impacted_resource_name=impacted_resource_name, + api_version=api_version, + template_url=self.get_by_tenant_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EventImpactedResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_tenant_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" + } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py new file mode 100644 index 000000000000..09875675d015 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_metadata_operations.py @@ -0,0 +1,191 @@ +# 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 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.tracing.decorator_async import distributed_trace_async +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._metadata_operations import build_get_entity_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`metadata` 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, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: + """Gets the list of metadata entities. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetadataEntity or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] + :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", "2022-10-01")) + cls: ClsType[_models.MetadataEntityListResult] = 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( + 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("MetadataEntityListResult", 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) + 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.ResourceHealth/metadata"} + + @distributed_trace_async + async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: + """Gets the list of metadata entities. + + :param name: Name of metadata entity. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataEntity or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity + :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", "2022-10-01")) + cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) + + request = build_get_entity_request( + name=name, + api_version=api_version, + template_url=self.get_entity.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MetadataEntity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py new file mode 100644 index 000000000000..be645058def4 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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 typing import Any, Callable, Dict, Optional, TypeVar + +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_async import distributed_trace_async +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._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`operations` 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_async + async def list(self, **kwargs: Any) -> _models.OperationListResult: + """Lists available operations for the resourcehealth resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationListResult + :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", "2022-10-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + request = build_list_request( + 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) + + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_security_advisory_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_security_advisory_impacted_resources_operations.py new file mode 100644 index 000000000000..3aa7d5d9e321 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/aio/operations/_security_advisory_impacted_resources_operations.py @@ -0,0 +1,245 @@ +# 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 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._security_advisory_impacted_resources_operations import ( + build_list_by_subscription_id_and_event_id_request, + build_list_by_tenant_id_and_event_id_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SecurityAdvisoryImpactedResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.aio.ResourceHealthMgmtClient`'s + :attr:`security_advisory_impacted_resources` 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_by_subscription_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.EventImpactedResource"]: + """Lists impacted resources in the subscription by an event (Security Advisory). + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_subscription_id_and_event_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_subscription_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_subscription_id_and_event_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" + } + + @distributed_trace + def list_by_tenant_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.EventImpactedResource"]: + """Lists impacted resources in the tenant by an event (Security Advisory). + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_tenant_id_and_event_id_request( + event_tracking_id=event_tracking_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_tenant_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_tenant_id_and_event_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" + } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py new file mode 100644 index 000000000000..c1d58bb250a4 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/__init__.py @@ -0,0 +1,125 @@ +# 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 AvailabilityStatus +from ._models_py3 import AvailabilityStatusListResult +from ._models_py3 import AvailabilityStatusProperties +from ._models_py3 import AvailabilityStatusPropertiesRecentlyResolved +from ._models_py3 import EmergingIssueImpact +from ._models_py3 import EmergingIssueListResult +from ._models_py3 import EmergingIssuesGetResult +from ._models_py3 import ErrorResponse +from ._models_py3 import Event +from ._models_py3 import EventImpactedResource +from ._models_py3 import EventImpactedResourceListResult +from ._models_py3 import EventPropertiesAdditionalInformation +from ._models_py3 import EventPropertiesArticle +from ._models_py3 import EventPropertiesRecommendedActions +from ._models_py3 import EventPropertiesRecommendedActionsItem +from ._models_py3 import Events +from ._models_py3 import Faq +from ._models_py3 import Impact +from ._models_py3 import ImpactedRegion +from ._models_py3 import ImpactedResourceStatus +from ._models_py3 import ImpactedServiceRegion +from ._models_py3 import KeyValueItem +from ._models_py3 import Link +from ._models_py3 import LinkDisplayText +from ._models_py3 import MetadataEntity +from ._models_py3 import MetadataEntityListResult +from ._models_py3 import MetadataSupportedValueDetail +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource +from ._models_py3 import RecommendedAction +from ._models_py3 import Resource +from ._models_py3 import ServiceImpactingEvent +from ._models_py3 import ServiceImpactingEventIncidentProperties +from ._models_py3 import ServiceImpactingEventStatus +from ._models_py3 import StatusActiveEvent +from ._models_py3 import StatusBanner +from ._models_py3 import SystemData +from ._models_py3 import Update + +from ._resource_health_mgmt_client_enums import AvailabilityStateValues +from ._resource_health_mgmt_client_enums import CreatedByType +from ._resource_health_mgmt_client_enums import EventLevelValues +from ._resource_health_mgmt_client_enums import EventSourceValues +from ._resource_health_mgmt_client_enums import EventStatusValues +from ._resource_health_mgmt_client_enums import EventTypeValues +from ._resource_health_mgmt_client_enums import IssueNameParameter +from ._resource_health_mgmt_client_enums import LevelValues +from ._resource_health_mgmt_client_enums import LinkTypeValues +from ._resource_health_mgmt_client_enums import ReasonChronicityTypes +from ._resource_health_mgmt_client_enums import ReasonTypeValues +from ._resource_health_mgmt_client_enums import Scenario +from ._resource_health_mgmt_client_enums import SeverityValues +from ._resource_health_mgmt_client_enums import StageValues +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AvailabilityStatus", + "AvailabilityStatusListResult", + "AvailabilityStatusProperties", + "AvailabilityStatusPropertiesRecentlyResolved", + "EmergingIssueImpact", + "EmergingIssueListResult", + "EmergingIssuesGetResult", + "ErrorResponse", + "Event", + "EventImpactedResource", + "EventImpactedResourceListResult", + "EventPropertiesAdditionalInformation", + "EventPropertiesArticle", + "EventPropertiesRecommendedActions", + "EventPropertiesRecommendedActionsItem", + "Events", + "Faq", + "Impact", + "ImpactedRegion", + "ImpactedResourceStatus", + "ImpactedServiceRegion", + "KeyValueItem", + "Link", + "LinkDisplayText", + "MetadataEntity", + "MetadataEntityListResult", + "MetadataSupportedValueDetail", + "Operation", + "OperationDisplay", + "OperationListResult", + "ProxyResource", + "RecommendedAction", + "Resource", + "ServiceImpactingEvent", + "ServiceImpactingEventIncidentProperties", + "ServiceImpactingEventStatus", + "StatusActiveEvent", + "StatusBanner", + "SystemData", + "Update", + "AvailabilityStateValues", + "CreatedByType", + "EventLevelValues", + "EventSourceValues", + "EventStatusValues", + "EventTypeValues", + "IssueNameParameter", + "LevelValues", + "LinkTypeValues", + "ReasonChronicityTypes", + "ReasonTypeValues", + "Scenario", + "SeverityValues", + "StageValues", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py new file mode 100644 index 000000000000..d508bfdb1967 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_models_py3.py @@ -0,0 +1,2140 @@ +# 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 +import sys +from typing import Any, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AvailabilityStatus(_serialization.Model): + """availabilityStatus of a resource. + + :ivar id: Azure Resource Manager Identity for the availabilityStatuses resource. + :vartype id: str + :ivar name: current. + :vartype name: str + :ivar type: Microsoft.ResourceHealth/AvailabilityStatuses. + :vartype type: str + :ivar location: Azure Resource Manager geo location of the resource. + :vartype location: str + :ivar properties: Properties of availability state. + :vartype properties: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusProperties + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "AvailabilityStatusProperties"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.AvailabilityStatusProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Azure Resource Manager Identity for the availabilityStatuses resource. + :paramtype id: str + :keyword name: current. + :paramtype name: str + :keyword type: Microsoft.ResourceHealth/AvailabilityStatuses. + :paramtype type: str + :keyword location: Azure Resource Manager geo location of the resource. + :paramtype location: str + :keyword properties: Properties of availability state. + :paramtype properties: + ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusProperties + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.location = location + self.properties = properties + + +class AvailabilityStatusListResult(_serialization.Model): + """The List availabilityStatus operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The list of availabilityStatuses. Required. + :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :ivar next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() with + this URI to fetch the next page of availabilityStatuses. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AvailabilityStatus]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AvailabilityStatus"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of availabilityStatuses. Required. + :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :keyword next_link: The URI to fetch the next page of availabilityStatuses. Call ListNext() + with this URI to fetch the next page of availabilityStatuses. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailabilityStatusProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Properties of availability state. + + :ivar availability_state: Availability status of the resource. When it is null, this + availabilityStatus object represents an availability impacting event. Known values are: + "Available", "Unavailable", "Degraded", and "Unknown". + :vartype availability_state: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues + :ivar title: Title description of the availability status. + :vartype title: str + :ivar summary: Summary description of the availability status. + :vartype summary: str + :ivar detailed_status: Details of the availability status. + :vartype detailed_status: str + :ivar reason_type: When the resource's availabilityState is Unavailable, it describes where the + health impacting event was originated. Examples are planned, unplanned, user initiated or an + outage etc. + :vartype reason_type: str + :ivar context: When an event is created, it can either be triggered by a customer or the + platform of the resource and this field will illustrate that. This field is connected to the + category field in this object. + :vartype context: str + :ivar category: When a context field is set to Platform, this field will reflect if the event + was planned or unplanned. If the context field does not have a value of Platform, then this + field will be ignored. + :vartype category: str + :ivar article_id: The Article Id. + :vartype article_id: str + :ivar root_cause_attribution_time: When the resource's availabilityState is Unavailable, it + provides the Timestamp for when the health impacting event was received. + :vartype root_cause_attribution_time: ~datetime.datetime + :ivar health_event_type: In case of an availability impacting event, it describes when the + health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. + :vartype health_event_type: str + :ivar health_event_cause: In case of an availability impacting event, it describes where the + health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. + :vartype health_event_cause: str + :ivar health_event_category: In case of an availability impacting event, it describes the + category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. + :vartype health_event_category: str + :ivar health_event_id: It is a unique Id that identifies the event. + :vartype health_event_id: str + :ivar resolution_eta: When the resource's availabilityState is Unavailable and the reasonType + is not User Initiated, it provides the date and time for when the issue is expected to be + resolved. + :vartype resolution_eta: ~datetime.datetime + :ivar occured_time: Timestamp for when last change in health status occurred. + :vartype occured_time: ~datetime.datetime + :ivar reason_chronicity: Chronicity of the availability transition. Known values are: + "Transient" and "Persistent". + :vartype reason_chronicity: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonChronicityTypes + :ivar reported_time: Timestamp for when the health was last checked. + :vartype reported_time: ~datetime.datetime + :ivar recently_resolved: An annotation describing a change in the availabilityState to + Available from Unavailable with a reasonType of type Unplanned. + :vartype recently_resolved: + ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusPropertiesRecentlyResolved + :ivar recommended_actions: Lists actions the user can take based on the current + availabilityState of the resource. + :vartype recommended_actions: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.RecommendedAction] + :ivar service_impacting_events: Lists the service impacting events that may be affecting the + health of the resource. + :vartype service_impacting_events: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEvent] + """ + + _attribute_map = { + "availability_state": {"key": "availabilityState", "type": "str"}, + "title": {"key": "title", "type": "str"}, + "summary": {"key": "summary", "type": "str"}, + "detailed_status": {"key": "detailedStatus", "type": "str"}, + "reason_type": {"key": "reasonType", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "article_id": {"key": "articleId", "type": "str"}, + "root_cause_attribution_time": {"key": "rootCauseAttributionTime", "type": "iso-8601"}, + "health_event_type": {"key": "healthEventType", "type": "str"}, + "health_event_cause": {"key": "healthEventCause", "type": "str"}, + "health_event_category": {"key": "healthEventCategory", "type": "str"}, + "health_event_id": {"key": "healthEventId", "type": "str"}, + "resolution_eta": {"key": "resolutionETA", "type": "iso-8601"}, + "occured_time": {"key": "occuredTime", "type": "iso-8601"}, + "reason_chronicity": {"key": "reasonChronicity", "type": "str"}, + "reported_time": {"key": "reportedTime", "type": "iso-8601"}, + "recently_resolved": {"key": "recentlyResolved", "type": "AvailabilityStatusPropertiesRecentlyResolved"}, + "recommended_actions": {"key": "recommendedActions", "type": "[RecommendedAction]"}, + "service_impacting_events": {"key": "serviceImpactingEvents", "type": "[ServiceImpactingEvent]"}, + } + + def __init__( + self, + *, + availability_state: Optional[Union[str, "_models.AvailabilityStateValues"]] = None, + title: Optional[str] = None, + summary: Optional[str] = None, + detailed_status: Optional[str] = None, + reason_type: Optional[str] = None, + context: Optional[str] = None, + category: Optional[str] = None, + article_id: Optional[str] = None, + root_cause_attribution_time: Optional[datetime.datetime] = None, + health_event_type: Optional[str] = None, + health_event_cause: Optional[str] = None, + health_event_category: Optional[str] = None, + health_event_id: Optional[str] = None, + resolution_eta: Optional[datetime.datetime] = None, + occured_time: Optional[datetime.datetime] = None, + reason_chronicity: Optional[Union[str, "_models.ReasonChronicityTypes"]] = None, + reported_time: Optional[datetime.datetime] = None, + recently_resolved: Optional["_models.AvailabilityStatusPropertiesRecentlyResolved"] = None, + recommended_actions: Optional[List["_models.RecommendedAction"]] = None, + service_impacting_events: Optional[List["_models.ServiceImpactingEvent"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword availability_state: Availability status of the resource. When it is null, this + availabilityStatus object represents an availability impacting event. Known values are: + "Available", "Unavailable", "Degraded", and "Unknown". + :paramtype availability_state: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues + :keyword title: Title description of the availability status. + :paramtype title: str + :keyword summary: Summary description of the availability status. + :paramtype summary: str + :keyword detailed_status: Details of the availability status. + :paramtype detailed_status: str + :keyword reason_type: When the resource's availabilityState is Unavailable, it describes where + the health impacting event was originated. Examples are planned, unplanned, user initiated or + an outage etc. + :paramtype reason_type: str + :keyword context: When an event is created, it can either be triggered by a customer or the + platform of the resource and this field will illustrate that. This field is connected to the + category field in this object. + :paramtype context: str + :keyword category: When a context field is set to Platform, this field will reflect if the + event was planned or unplanned. If the context field does not have a value of Platform, then + this field will be ignored. + :paramtype category: str + :keyword article_id: The Article Id. + :paramtype article_id: str + :keyword root_cause_attribution_time: When the resource's availabilityState is Unavailable, it + provides the Timestamp for when the health impacting event was received. + :paramtype root_cause_attribution_time: ~datetime.datetime + :keyword health_event_type: In case of an availability impacting event, it describes when the + health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. + :paramtype health_event_type: str + :keyword health_event_cause: In case of an availability impacting event, it describes where the + health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. + :paramtype health_event_cause: str + :keyword health_event_category: In case of an availability impacting event, it describes the + category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. + :paramtype health_event_category: str + :keyword health_event_id: It is a unique Id that identifies the event. + :paramtype health_event_id: str + :keyword resolution_eta: When the resource's availabilityState is Unavailable and the + reasonType is not User Initiated, it provides the date and time for when the issue is expected + to be resolved. + :paramtype resolution_eta: ~datetime.datetime + :keyword occured_time: Timestamp for when last change in health status occurred. + :paramtype occured_time: ~datetime.datetime + :keyword reason_chronicity: Chronicity of the availability transition. Known values are: + "Transient" and "Persistent". + :paramtype reason_chronicity: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonChronicityTypes + :keyword reported_time: Timestamp for when the health was last checked. + :paramtype reported_time: ~datetime.datetime + :keyword recently_resolved: An annotation describing a change in the availabilityState to + Available from Unavailable with a reasonType of type Unplanned. + :paramtype recently_resolved: + ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatusPropertiesRecentlyResolved + :keyword recommended_actions: Lists actions the user can take based on the current + availabilityState of the resource. + :paramtype recommended_actions: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.RecommendedAction] + :keyword service_impacting_events: Lists the service impacting events that may be affecting the + health of the resource. + :paramtype service_impacting_events: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEvent] + """ + super().__init__(**kwargs) + self.availability_state = availability_state + self.title = title + self.summary = summary + self.detailed_status = detailed_status + self.reason_type = reason_type + self.context = context + self.category = category + self.article_id = article_id + self.root_cause_attribution_time = root_cause_attribution_time + self.health_event_type = health_event_type + self.health_event_cause = health_event_cause + self.health_event_category = health_event_category + self.health_event_id = health_event_id + self.resolution_eta = resolution_eta + self.occured_time = occured_time + self.reason_chronicity = reason_chronicity + self.reported_time = reported_time + self.recently_resolved = recently_resolved + self.recommended_actions = recommended_actions + self.service_impacting_events = service_impacting_events + + +class AvailabilityStatusPropertiesRecentlyResolved(_serialization.Model): + """An annotation describing a change in the availabilityState to Available from Unavailable with a + reasonType of type Unplanned. + + :ivar unavailable_occured_time: Timestamp for when the availabilityState changed to + Unavailable. + :vartype unavailable_occured_time: ~datetime.datetime + :ivar resolved_time: Timestamp when the availabilityState changes to Available. + :vartype resolved_time: ~datetime.datetime + :ivar unavailable_summary: Brief description of cause of the resource becoming unavailable. + :vartype unavailable_summary: str + """ + + _attribute_map = { + "unavailable_occured_time": {"key": "unavailableOccuredTime", "type": "iso-8601"}, + "resolved_time": {"key": "resolvedTime", "type": "iso-8601"}, + "unavailable_summary": {"key": "unavailableSummary", "type": "str"}, + } + + def __init__( + self, + *, + unavailable_occured_time: Optional[datetime.datetime] = None, + resolved_time: Optional[datetime.datetime] = None, + unavailable_summary: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword unavailable_occured_time: Timestamp for when the availabilityState changed to + Unavailable. + :paramtype unavailable_occured_time: ~datetime.datetime + :keyword resolved_time: Timestamp when the availabilityState changes to Available. + :paramtype resolved_time: ~datetime.datetime + :keyword unavailable_summary: Brief description of cause of the resource becoming unavailable. + :paramtype unavailable_summary: str + """ + super().__init__(**kwargs) + self.unavailable_occured_time = unavailable_occured_time + self.resolved_time = resolved_time + self.unavailable_summary = unavailable_summary + + +class EmergingIssueImpact(_serialization.Model): + """Object of the emerging issue impact on services and regions. + + :ivar id: The impacted service id. + :vartype id: str + :ivar name: The impacted service name. + :vartype name: str + :ivar regions: The list of impacted regions for corresponding emerging issues. + :vartype regions: list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedRegion] + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "regions": {"key": "regions", "type": "[ImpactedRegion]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + regions: Optional[List["_models.ImpactedRegion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The impacted service id. + :paramtype id: str + :keyword name: The impacted service name. + :paramtype name: str + :keyword regions: The list of impacted regions for corresponding emerging issues. + :paramtype regions: list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedRegion] + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.regions = regions + + +class EmergingIssueListResult(_serialization.Model): + """The list of emerging issues. + + :ivar value: The list of emerging issues. + :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] + :ivar next_link: The link used to get the next page of emerging issues. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[EmergingIssuesGetResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.EmergingIssuesGetResult"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of emerging issues. + :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] + :keyword next_link: The link used to get the next page of emerging issues. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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.resourcehealth.v2022_10_01.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: Any) -> None: + """ """ + 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.resourcehealth.v2022_10_01.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: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class EmergingIssuesGetResult(ProxyResource): + """The Get EmergingIssues operation response. + + 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.resourcehealth.v2022_10_01.models.SystemData + :ivar refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. + :vartype refresh_timestamp: ~datetime.datetime + :ivar status_banners: The list of emerging issues of banner type. + :vartype status_banners: list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusBanner] + :ivar status_active_events: The list of emerging issues of active event type. + :vartype status_active_events: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusActiveEvent] + """ + + _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"}, + "refresh_timestamp": {"key": "properties.refreshTimestamp", "type": "iso-8601"}, + "status_banners": {"key": "properties.statusBanners", "type": "[StatusBanner]"}, + "status_active_events": {"key": "properties.statusActiveEvents", "type": "[StatusActiveEvent]"}, + } + + def __init__( + self, + *, + refresh_timestamp: Optional[datetime.datetime] = None, + status_banners: Optional[List["_models.StatusBanner"]] = None, + status_active_events: Optional[List["_models.StatusActiveEvent"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword refresh_timestamp: Timestamp for when last time refreshed for ongoing emerging issue. + :paramtype refresh_timestamp: ~datetime.datetime + :keyword status_banners: The list of emerging issues of banner type. + :paramtype status_banners: list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusBanner] + :keyword status_active_events: The list of emerging issues of active event type. + :paramtype status_active_events: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.StatusActiveEvent] + """ + super().__init__(**kwargs) + self.refresh_timestamp = refresh_timestamp + self.status_banners = status_banners + self.status_active_events = status_active_events + + +class ErrorResponse(_serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class Event(ProxyResource): # pylint: disable=too-many-instance-attributes + """Service health event. + + 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.resourcehealth.v2022_10_01.models.SystemData + :ivar event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", + "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". + :vartype event_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventTypeValues + :ivar event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". + :vartype event_source: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventSourceValues + :ivar status: Current status of event. Known values are: "Active" and "Resolved". + :vartype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues + :ivar title: Title text of event. + :vartype title: str + :ivar summary: Summary text of event. + :vartype summary: str + :ivar header: Header text of event. + :vartype header: str + :ivar level: Level of insight. Known values are: "Critical" and "Warning". + :vartype level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LevelValues + :ivar event_level: Level of event. Known values are: "Critical", "Error", "Warning", and + "Informational". + :vartype event_level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventLevelValues + :ivar external_incident_id: The id of the Incident. + :vartype external_incident_id: str + :ivar reason: The reason for the Incident. + :vartype reason: str + :ivar article: Article of event. + :vartype article: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesArticle + :ivar links: Useful links of event. + :vartype links: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Link] + :ivar impact_start_time: It provides the Timestamp for when the health impacting event started. + :vartype impact_start_time: ~datetime.datetime + :ivar impact_mitigation_time: It provides the Timestamp for when the health impacting event + resolved. + :vartype impact_mitigation_time: ~datetime.datetime + :ivar impact: List services impacted by the service health event. + :vartype impact: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Impact] + :ivar recommended_actions: Recommended actions of event. + :vartype recommended_actions: + ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActions + :ivar faqs: Frequently asked questions for the service health event. + :vartype faqs: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Faq] + :ivar is_hir: It provides information if the event is High incident rate event or not. + :vartype is_hir: bool + :ivar enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for + this event. + :vartype enable_microsoft_support: bool + :ivar description: Contains the communication message for the event, that could include + summary, root cause and other details. + :vartype description: str + :ivar platform_initiated: Is true if the event is platform initiated. + :vartype platform_initiated: bool + :ivar enable_chat_with_us: Tells if we want to enable or disable Microsoft Support for this + event. + :vartype enable_chat_with_us: bool + :ivar priority: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + Service issue events have higher priority followed by planned maintenance and health advisory. + Critical events have higher priority followed by error, warning and informational. Furthermore, + active events have higher priority than resolved. + :vartype priority: int + :ivar last_update_time: It provides the Timestamp for when the health impacting event was last + updated. + :vartype last_update_time: ~datetime.datetime + :ivar hir_stage: Stage for HIR Document. + :vartype hir_stage: str + :ivar additional_information: Additional information. + :vartype additional_information: + ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesAdditionalInformation + :ivar duration: duration in seconds. + :vartype duration: int + :ivar impact_type: The type of the impact. + :vartype impact_type: str + """ + + _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"}, + "event_type": {"key": "properties.eventType", "type": "str"}, + "event_source": {"key": "properties.eventSource", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "title": {"key": "properties.title", "type": "str"}, + "summary": {"key": "properties.summary", "type": "str"}, + "header": {"key": "properties.header", "type": "str"}, + "level": {"key": "properties.level", "type": "str"}, + "event_level": {"key": "properties.eventLevel", "type": "str"}, + "external_incident_id": {"key": "properties.externalIncidentId", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + "article": {"key": "properties.article", "type": "EventPropertiesArticle"}, + "links": {"key": "properties.links", "type": "[Link]"}, + "impact_start_time": {"key": "properties.impactStartTime", "type": "iso-8601"}, + "impact_mitigation_time": {"key": "properties.impactMitigationTime", "type": "iso-8601"}, + "impact": {"key": "properties.impact", "type": "[Impact]"}, + "recommended_actions": {"key": "properties.recommendedActions", "type": "EventPropertiesRecommendedActions"}, + "faqs": {"key": "properties.faqs", "type": "[Faq]"}, + "is_hir": {"key": "properties.isHIR", "type": "bool"}, + "enable_microsoft_support": {"key": "properties.enableMicrosoftSupport", "type": "bool"}, + "description": {"key": "properties.description", "type": "str"}, + "platform_initiated": {"key": "properties.platformInitiated", "type": "bool"}, + "enable_chat_with_us": {"key": "properties.enableChatWithUs", "type": "bool"}, + "priority": {"key": "properties.priority", "type": "int"}, + "last_update_time": {"key": "properties.lastUpdateTime", "type": "iso-8601"}, + "hir_stage": {"key": "properties.hirStage", "type": "str"}, + "additional_information": { + "key": "properties.additionalInformation", + "type": "EventPropertiesAdditionalInformation", + }, + "duration": {"key": "properties.duration", "type": "int"}, + "impact_type": {"key": "properties.impactType", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + event_type: Optional[Union[str, "_models.EventTypeValues"]] = None, + event_source: Optional[Union[str, "_models.EventSourceValues"]] = None, + status: Optional[Union[str, "_models.EventStatusValues"]] = None, + title: Optional[str] = None, + summary: Optional[str] = None, + header: Optional[str] = None, + level: Optional[Union[str, "_models.LevelValues"]] = None, + event_level: Optional[Union[str, "_models.EventLevelValues"]] = None, + external_incident_id: Optional[str] = None, + reason: Optional[str] = None, + article: Optional["_models.EventPropertiesArticle"] = None, + links: Optional[List["_models.Link"]] = None, + impact_start_time: Optional[datetime.datetime] = None, + impact_mitigation_time: Optional[datetime.datetime] = None, + impact: Optional[List["_models.Impact"]] = None, + recommended_actions: Optional["_models.EventPropertiesRecommendedActions"] = None, + faqs: Optional[List["_models.Faq"]] = None, + is_hir: Optional[bool] = None, + enable_microsoft_support: Optional[bool] = None, + description: Optional[str] = None, + platform_initiated: Optional[bool] = None, + enable_chat_with_us: Optional[bool] = None, + priority: Optional[int] = None, + last_update_time: Optional[datetime.datetime] = None, + hir_stage: Optional[str] = None, + additional_information: Optional["_models.EventPropertiesAdditionalInformation"] = None, + duration: Optional[int] = None, + impact_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword event_type: Type of event. Known values are: "ServiceIssue", "PlannedMaintenance", + "HealthAdvisory", "RCA", "EmergingIssues", and "SecurityAdvisory". + :paramtype event_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventTypeValues + :keyword event_source: Source of event. Known values are: "ResourceHealth" and "ServiceHealth". + :paramtype event_source: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventSourceValues + :keyword status: Current status of event. Known values are: "Active" and "Resolved". + :paramtype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues + :keyword title: Title text of event. + :paramtype title: str + :keyword summary: Summary text of event. + :paramtype summary: str + :keyword header: Header text of event. + :paramtype header: str + :keyword level: Level of insight. Known values are: "Critical" and "Warning". + :paramtype level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LevelValues + :keyword event_level: Level of event. Known values are: "Critical", "Error", "Warning", and + "Informational". + :paramtype event_level: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventLevelValues + :keyword external_incident_id: The id of the Incident. + :paramtype external_incident_id: str + :keyword reason: The reason for the Incident. + :paramtype reason: str + :keyword article: Article of event. + :paramtype article: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesArticle + :keyword links: Useful links of event. + :paramtype links: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Link] + :keyword impact_start_time: It provides the Timestamp for when the health impacting event + started. + :paramtype impact_start_time: ~datetime.datetime + :keyword impact_mitigation_time: It provides the Timestamp for when the health impacting event + resolved. + :paramtype impact_mitigation_time: ~datetime.datetime + :keyword impact: List services impacted by the service health event. + :paramtype impact: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Impact] + :keyword recommended_actions: Recommended actions of event. + :paramtype recommended_actions: + ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActions + :keyword faqs: Frequently asked questions for the service health event. + :paramtype faqs: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Faq] + :keyword is_hir: It provides information if the event is High incident rate event or not. + :paramtype is_hir: bool + :keyword enable_microsoft_support: Tells if we want to enable or disable Microsoft Support for + this event. + :paramtype enable_microsoft_support: bool + :keyword description: Contains the communication message for the event, that could include + summary, root cause and other details. + :paramtype description: str + :keyword platform_initiated: Is true if the event is platform initiated. + :paramtype platform_initiated: bool + :keyword enable_chat_with_us: Tells if we want to enable or disable Microsoft Support for this + event. + :paramtype enable_chat_with_us: bool + :keyword priority: Priority level of the event. Has value from 0 to 23. 0 is the highest + priority. Service issue events have higher priority followed by planned maintenance and health + advisory. Critical events have higher priority followed by error, warning and informational. + Furthermore, active events have higher priority than resolved. + :paramtype priority: int + :keyword last_update_time: It provides the Timestamp for when the health impacting event was + last updated. + :paramtype last_update_time: ~datetime.datetime + :keyword hir_stage: Stage for HIR Document. + :paramtype hir_stage: str + :keyword additional_information: Additional information. + :paramtype additional_information: + ~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesAdditionalInformation + :keyword duration: duration in seconds. + :paramtype duration: int + :keyword impact_type: The type of the impact. + :paramtype impact_type: str + """ + super().__init__(**kwargs) + self.event_type = event_type + self.event_source = event_source + self.status = status + self.title = title + self.summary = summary + self.header = header + self.level = level + self.event_level = event_level + self.external_incident_id = external_incident_id + self.reason = reason + self.article = article + self.links = links + self.impact_start_time = impact_start_time + self.impact_mitigation_time = impact_mitigation_time + self.impact = impact + self.recommended_actions = recommended_actions + self.faqs = faqs + self.is_hir = is_hir + self.enable_microsoft_support = enable_microsoft_support + self.description = description + self.platform_initiated = platform_initiated + self.enable_chat_with_us = enable_chat_with_us + self.priority = priority + self.last_update_time = last_update_time + self.hir_stage = hir_stage + self.additional_information = additional_information + self.duration = duration + self.impact_type = impact_type + + +class EventImpactedResource(ProxyResource): + """Impacted resource for an event. + + 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.resourcehealth.v2022_10_01.models.SystemData + :ivar target_resource_type: Resource type within Microsoft cloud. + :vartype target_resource_type: str + :ivar target_resource_id: Identity for resource within Microsoft cloud. + :vartype target_resource_id: str + :ivar target_region: Impacted resource region name. + :vartype target_region: str + :ivar info: Additional information. + :vartype info: list[~azure.mgmt.resourcehealth.v2022_10_01.models.KeyValueItem] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "target_resource_type": {"readonly": True}, + "target_resource_id": {"readonly": True}, + "target_region": {"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"}, + "target_resource_type": {"key": "properties.targetResourceType", "type": "str"}, + "target_resource_id": {"key": "properties.targetResourceId", "type": "str"}, + "target_region": {"key": "properties.targetRegion", "type": "str"}, + "info": {"key": "properties.info", "type": "[KeyValueItem]"}, + } + + def __init__(self, *, info: Optional[List["_models.KeyValueItem"]] = None, **kwargs: Any) -> None: + """ + :keyword info: Additional information. + :paramtype info: list[~azure.mgmt.resourcehealth.v2022_10_01.models.KeyValueItem] + """ + super().__init__(**kwargs) + self.target_resource_type = None + self.target_resource_id = None + self.target_region = None + self.info = info + + +class EventImpactedResourceListResult(_serialization.Model): + """The List of eventImpactedResources operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The list of eventImpactedResources. Required. + :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :ivar next_link: The URI to fetch the next page of events. Call ListNext() with this URI to + fetch the next page of impacted resource. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[EventImpactedResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.EventImpactedResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of eventImpactedResources. Required. + :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :keyword next_link: The URI to fetch the next page of events. Call ListNext() with this URI to + fetch the next page of impacted resource. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class EventPropertiesAdditionalInformation(_serialization.Model): + """Additional information. + + :ivar message: Additional information Message. + :vartype message: str + """ + + _attribute_map = { + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword message: Additional information Message. + :paramtype message: str + """ + super().__init__(**kwargs) + self.message = message + + +class EventPropertiesArticle(_serialization.Model): + """Article of event. + + :ivar article_content: Article content of event. + :vartype article_content: str + :ivar article_id: Article Id. + :vartype article_id: str + :ivar parameters: It provides a map of parameter name and value. + :vartype parameters: JSON + """ + + _attribute_map = { + "article_content": {"key": "articleContent", "type": "str"}, + "article_id": {"key": "articleId", "type": "str"}, + "parameters": {"key": "parameters", "type": "object"}, + } + + def __init__( + self, + *, + article_content: Optional[str] = None, + article_id: Optional[str] = None, + parameters: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword article_content: Article content of event. + :paramtype article_content: str + :keyword article_id: Article Id. + :paramtype article_id: str + :keyword parameters: It provides a map of parameter name and value. + :paramtype parameters: JSON + """ + super().__init__(**kwargs) + self.article_content = article_content + self.article_id = article_id + self.parameters = parameters + + +class EventPropertiesRecommendedActions(_serialization.Model): + """Recommended actions of event. + + :ivar message: Recommended action title for the service health event. + :vartype message: str + :ivar actions: Recommended actions for the service health event. + :vartype actions: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActionsItem] + :ivar locale_code: Recommended action locale for the service health event. + :vartype locale_code: str + """ + + _attribute_map = { + "message": {"key": "message", "type": "str"}, + "actions": {"key": "actions", "type": "[EventPropertiesRecommendedActionsItem]"}, + "locale_code": {"key": "localeCode", "type": "str"}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + actions: Optional[List["_models.EventPropertiesRecommendedActionsItem"]] = None, + locale_code: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword message: Recommended action title for the service health event. + :paramtype message: str + :keyword actions: Recommended actions for the service health event. + :paramtype actions: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.EventPropertiesRecommendedActionsItem] + :keyword locale_code: Recommended action locale for the service health event. + :paramtype locale_code: str + """ + super().__init__(**kwargs) + self.message = message + self.actions = actions + self.locale_code = locale_code + + +class EventPropertiesRecommendedActionsItem(_serialization.Model): + """Recommended action for the service health event. + + :ivar group_id: Recommended action group Id for the service health event. + :vartype group_id: int + :ivar action_text: Recommended action text. + :vartype action_text: str + """ + + _attribute_map = { + "group_id": {"key": "groupId", "type": "int"}, + "action_text": {"key": "actionText", "type": "str"}, + } + + def __init__(self, *, group_id: Optional[int] = None, action_text: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword group_id: Recommended action group Id for the service health event. + :paramtype group_id: int + :keyword action_text: Recommended action text. + :paramtype action_text: str + """ + super().__init__(**kwargs) + self.group_id = group_id + self.action_text = action_text + + +class Events(_serialization.Model): + """The List events operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The list of event. Required. + :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :ivar next_link: The URI to fetch the next page of events. Call ListNext() with this URI to + fetch the next page of events. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Event]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Event"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of event. Required. + :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :keyword next_link: The URI to fetch the next page of events. Call ListNext() with this URI to + fetch the next page of events. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Faq(_serialization.Model): + """Frequently asked question for the service health event. + + :ivar question: FAQ question for the service health event. + :vartype question: str + :ivar answer: FAQ answer for the service health event. + :vartype answer: str + :ivar locale_code: FAQ locale for the service health event. + :vartype locale_code: str + """ + + _attribute_map = { + "question": {"key": "question", "type": "str"}, + "answer": {"key": "answer", "type": "str"}, + "locale_code": {"key": "localeCode", "type": "str"}, + } + + def __init__( + self, + *, + question: Optional[str] = None, + answer: Optional[str] = None, + locale_code: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword question: FAQ question for the service health event. + :paramtype question: str + :keyword answer: FAQ answer for the service health event. + :paramtype answer: str + :keyword locale_code: FAQ locale for the service health event. + :paramtype locale_code: str + """ + super().__init__(**kwargs) + self.question = question + self.answer = answer + self.locale_code = locale_code + + +class Impact(_serialization.Model): + """Azure service impacted by the service health event. + + :ivar impacted_service: Impacted service name. + :vartype impacted_service: str + :ivar impacted_regions: List regions impacted by the service health event. + :vartype impacted_regions: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedServiceRegion] + """ + + _attribute_map = { + "impacted_service": {"key": "impactedService", "type": "str"}, + "impacted_regions": {"key": "impactedRegions", "type": "[ImpactedServiceRegion]"}, + } + + def __init__( + self, + *, + impacted_service: Optional[str] = None, + impacted_regions: Optional[List["_models.ImpactedServiceRegion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword impacted_service: Impacted service name. + :paramtype impacted_service: str + :keyword impacted_regions: List regions impacted by the service health event. + :paramtype impacted_regions: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.ImpactedServiceRegion] + """ + super().__init__(**kwargs) + self.impacted_service = impacted_service + self.impacted_regions = impacted_regions + + +class ImpactedRegion(_serialization.Model): + """Object of impacted region. + + :ivar id: The impacted region id. + :vartype id: str + :ivar name: The impacted region name. + :vartype name: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The impacted region id. + :paramtype id: str + :keyword name: The impacted region name. + :paramtype name: str + """ + super().__init__(**kwargs) + self.id = id + self.name = name + + +class ImpactedResourceStatus(ProxyResource): + """impactedResource with health status. + + 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.resourcehealth.v2022_10_01.models.SystemData + :ivar availability_state: Impacted resource status of the resource. Known values are: + "Available", "Unavailable", "Degraded", and "Unknown". + :vartype availability_state: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues + :ivar title: Title description of the impacted resource status. + :vartype title: str + :ivar summary: Summary description of the impacted resource status. + :vartype summary: str + :ivar reason_type: When the resource's availabilityState is Unavailable, it describes where the + health impacting event was originated. Known values are: "Unplanned", "Planned", and + "UserInitiated". + :vartype reason_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonTypeValues + :ivar occurred_time: Timestamp for when last change in health status occurred. + :vartype occurred_time: ~datetime.datetime + """ + + _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"}, + "availability_state": {"key": "properties.availabilityState", "type": "str"}, + "title": {"key": "properties.title", "type": "str"}, + "summary": {"key": "properties.summary", "type": "str"}, + "reason_type": {"key": "properties.reasonType", "type": "str"}, + "occurred_time": {"key": "properties.occurredTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + availability_state: Optional[Union[str, "_models.AvailabilityStateValues"]] = None, + title: Optional[str] = None, + summary: Optional[str] = None, + reason_type: Optional[Union[str, "_models.ReasonTypeValues"]] = None, + occurred_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword availability_state: Impacted resource status of the resource. Known values are: + "Available", "Unavailable", "Degraded", and "Unknown". + :paramtype availability_state: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStateValues + :keyword title: Title description of the impacted resource status. + :paramtype title: str + :keyword summary: Summary description of the impacted resource status. + :paramtype summary: str + :keyword reason_type: When the resource's availabilityState is Unavailable, it describes where + the health impacting event was originated. Known values are: "Unplanned", "Planned", and + "UserInitiated". + :paramtype reason_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.ReasonTypeValues + :keyword occurred_time: Timestamp for when last change in health status occurred. + :paramtype occurred_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.availability_state = availability_state + self.title = title + self.summary = summary + self.reason_type = reason_type + self.occurred_time = occurred_time + + +class ImpactedServiceRegion(_serialization.Model): + """Azure region impacted by the service health event. + + :ivar impacted_region: Impacted region name. + :vartype impacted_region: str + :ivar status: Current status of event in the region. Known values are: "Active" and "Resolved". + :vartype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues + :ivar impacted_subscriptions: List subscription impacted by the service health event. + :vartype impacted_subscriptions: list[str] + :ivar impacted_tenants: List tenant impacted by the service health event. + :vartype impacted_tenants: list[str] + :ivar last_update_time: It provides the Timestamp for when the last update for the service + health event. + :vartype last_update_time: ~datetime.datetime + :ivar updates: List of updates for given service health event. + :vartype updates: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Update] + """ + + _attribute_map = { + "impacted_region": {"key": "impactedRegion", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "impacted_subscriptions": {"key": "impactedSubscriptions", "type": "[str]"}, + "impacted_tenants": {"key": "impactedTenants", "type": "[str]"}, + "last_update_time": {"key": "lastUpdateTime", "type": "iso-8601"}, + "updates": {"key": "updates", "type": "[Update]"}, + } + + def __init__( + self, + *, + impacted_region: Optional[str] = None, + status: Optional[Union[str, "_models.EventStatusValues"]] = None, + impacted_subscriptions: Optional[List[str]] = None, + impacted_tenants: Optional[List[str]] = None, + last_update_time: Optional[datetime.datetime] = None, + updates: Optional[List["_models.Update"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword impacted_region: Impacted region name. + :paramtype impacted_region: str + :keyword status: Current status of event in the region. Known values are: "Active" and + "Resolved". + :paramtype status: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.EventStatusValues + :keyword impacted_subscriptions: List subscription impacted by the service health event. + :paramtype impacted_subscriptions: list[str] + :keyword impacted_tenants: List tenant impacted by the service health event. + :paramtype impacted_tenants: list[str] + :keyword last_update_time: It provides the Timestamp for when the last update for the service + health event. + :paramtype last_update_time: ~datetime.datetime + :keyword updates: List of updates for given service health event. + :paramtype updates: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Update] + """ + super().__init__(**kwargs) + self.impacted_region = impacted_region + self.status = status + self.impacted_subscriptions = impacted_subscriptions + self.impacted_tenants = impacted_tenants + self.last_update_time = last_update_time + self.updates = updates + + +class KeyValueItem(_serialization.Model): + """Key value tuple. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key: Key of tuple. + :vartype key: str + :ivar value: Value of tuple. + :vartype value: str + """ + + _validation = { + "key": {"readonly": True}, + "value": {"readonly": True}, + } + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.key = None + self.value = None + + +class Link(_serialization.Model): + """Useful links for service health event. + + :ivar type: Type of link. Known values are: "Button" and "Hyperlink". + :vartype type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkTypeValues + :ivar display_text: Display text of link. + :vartype display_text: ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkDisplayText + :ivar extension_name: It provides the name of portal extension to produce link for given + service health event. + :vartype extension_name: str + :ivar blade_name: It provides the name of portal extension blade to produce link for given + service health event. + :vartype blade_name: str + :ivar parameters: It provides a map of parameter name and value for portal extension blade to + produce lik for given service health event. + :vartype parameters: JSON + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "display_text": {"key": "displayText", "type": "LinkDisplayText"}, + "extension_name": {"key": "extensionName", "type": "str"}, + "blade_name": {"key": "bladeName", "type": "str"}, + "parameters": {"key": "parameters", "type": "object"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.LinkTypeValues"]] = None, + display_text: Optional["_models.LinkDisplayText"] = None, + extension_name: Optional[str] = None, + blade_name: Optional[str] = None, + parameters: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of link. Known values are: "Button" and "Hyperlink". + :paramtype type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkTypeValues + :keyword display_text: Display text of link. + :paramtype display_text: ~azure.mgmt.resourcehealth.v2022_10_01.models.LinkDisplayText + :keyword extension_name: It provides the name of portal extension to produce link for given + service health event. + :paramtype extension_name: str + :keyword blade_name: It provides the name of portal extension blade to produce link for given + service health event. + :paramtype blade_name: str + :keyword parameters: It provides a map of parameter name and value for portal extension blade + to produce lik for given service health event. + :paramtype parameters: JSON + """ + super().__init__(**kwargs) + self.type = type + self.display_text = display_text + self.extension_name = extension_name + self.blade_name = blade_name + self.parameters = parameters + + +class LinkDisplayText(_serialization.Model): + """Display text of link. + + :ivar value: Display text of link. + :vartype value: str + :ivar localized_value: Localized display text of link. + :vartype localized_value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: Display text of link. + :paramtype value: str + :keyword localized_value: Localized display text of link. + :paramtype localized_value: str + """ + super().__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class MetadataEntity(ProxyResource): + """The metadata entity contract. + + 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.resourcehealth.v2022_10_01.models.SystemData + :ivar display_name: The display name. + :vartype display_name: str + :ivar depends_on: The list of keys on which this entity depends on. + :vartype depends_on: list[str] + :ivar applicable_scenarios: The list of scenarios applicable to this metadata entity. + :vartype applicable_scenarios: list[str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.Scenario] + :ivar supported_values: The list of supported values. + :vartype supported_values: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataSupportedValueDetail] + """ + + _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"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "depends_on": {"key": "properties.dependsOn", "type": "[str]"}, + "applicable_scenarios": {"key": "properties.applicableScenarios", "type": "[str]"}, + "supported_values": {"key": "properties.supportedValues", "type": "[MetadataSupportedValueDetail]"}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + depends_on: Optional[List[str]] = None, + applicable_scenarios: Optional[List[Union[str, "_models.Scenario"]]] = None, + supported_values: Optional[List["_models.MetadataSupportedValueDetail"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword display_name: The display name. + :paramtype display_name: str + :keyword depends_on: The list of keys on which this entity depends on. + :paramtype depends_on: list[str] + :keyword applicable_scenarios: The list of scenarios applicable to this metadata entity. + :paramtype applicable_scenarios: list[str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.Scenario] + :keyword supported_values: The list of supported values. + :paramtype supported_values: + list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataSupportedValueDetail] + """ + super().__init__(**kwargs) + self.display_name = display_name + self.depends_on = depends_on + self.applicable_scenarios = applicable_scenarios + self.supported_values = supported_values + + +class MetadataEntityListResult(_serialization.Model): + """The list of metadata entities. + + :ivar value: The list of metadata entities. + :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] + :ivar next_link: The link used to get the next page of metadata. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[MetadataEntity]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.MetadataEntity"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of metadata entities. + :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] + :keyword next_link: The link used to get the next page of metadata. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MetadataSupportedValueDetail(_serialization.Model): + """The metadata supported value detail. + + :ivar id: The id. + :vartype id: str + :ivar display_name: The display name. + :vartype display_name: str + :ivar resource_types: The list of associated resource types. + :vartype resource_types: list[str] + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "resource_types": {"key": "resourceTypes", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + display_name: Optional[str] = None, + resource_types: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The id. + :paramtype id: str + :keyword display_name: The display name. + :paramtype display_name: str + :keyword resource_types: The list of associated resource types. + :paramtype resource_types: list[str] + """ + super().__init__(**kwargs) + self.id = id + self.display_name = display_name + self.resource_types = resource_types + + +class Operation(_serialization.Model): + """Operation available in the Microsoft.ResourceHealth resource provider. + + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties of the operation. + :vartype display: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationDisplay + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + } + + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties of the operation. + :paramtype display: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(_serialization.Model): + """Properties of the operation. + + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: Resource name. + :vartype resource: str + :ivar operation: Operation name. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: Resource name. + :paramtype resource: str + :keyword operation: Operation name. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(_serialization.Model): + """Lists the operations response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: List of operations available in the Microsoft.ResourceHealth resource provider. + Required. + :vartype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Operation] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + } + + def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: + """ + :keyword value: List of operations available in the Microsoft.ResourceHealth resource provider. + Required. + :paramtype value: list[~azure.mgmt.resourcehealth.v2022_10_01.models.Operation] + """ + super().__init__(**kwargs) + self.value = value + + +class RecommendedAction(_serialization.Model): + """Lists actions the user can take based on the current availabilityState of the resource. + + :ivar action: Recommended action. + :vartype action: str + :ivar action_url: Link to the action. + :vartype action_url: str + :ivar action_url_comment: the comment for the Action. + :vartype action_url_comment: str + :ivar action_url_text: Substring of action, it describes which text should host the action URL. + :vartype action_url_text: str + """ + + _attribute_map = { + "action": {"key": "action", "type": "str"}, + "action_url": {"key": "actionUrl", "type": "str"}, + "action_url_comment": {"key": "_ActionUrl\\.Comment", "type": "str"}, + "action_url_text": {"key": "actionUrlText", "type": "str"}, + } + + def __init__( + self, + *, + action: Optional[str] = None, + action_url: Optional[str] = None, + action_url_comment: Optional[str] = None, + action_url_text: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword action: Recommended action. + :paramtype action: str + :keyword action_url: Link to the action. + :paramtype action_url: str + :keyword action_url_comment: the comment for the Action. + :paramtype action_url_comment: str + :keyword action_url_text: Substring of action, it describes which text should host the action + URL. + :paramtype action_url_text: str + """ + super().__init__(**kwargs) + self.action = action + self.action_url = action_url + self.action_url_comment = action_url_comment + self.action_url_text = action_url_text + + +class ServiceImpactingEvent(_serialization.Model): + """Lists the service impacting events that may be affecting the health of the resource. + + :ivar event_start_time: Timestamp for when the event started. + :vartype event_start_time: ~datetime.datetime + :ivar event_status_last_modified_time: Timestamp for when event was submitted/detected. + :vartype event_status_last_modified_time: ~datetime.datetime + :ivar correlation_id: Correlation id for the event. + :vartype correlation_id: str + :ivar status: Status of the service impacting event. + :vartype status: ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventStatus + :ivar incident_properties: Properties of the service impacting event. + :vartype incident_properties: + ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventIncidentProperties + """ + + _attribute_map = { + "event_start_time": {"key": "eventStartTime", "type": "iso-8601"}, + "event_status_last_modified_time": {"key": "eventStatusLastModifiedTime", "type": "iso-8601"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "status": {"key": "status", "type": "ServiceImpactingEventStatus"}, + "incident_properties": {"key": "incidentProperties", "type": "ServiceImpactingEventIncidentProperties"}, + } + + def __init__( + self, + *, + event_start_time: Optional[datetime.datetime] = None, + event_status_last_modified_time: Optional[datetime.datetime] = None, + correlation_id: Optional[str] = None, + status: Optional["_models.ServiceImpactingEventStatus"] = None, + incident_properties: Optional["_models.ServiceImpactingEventIncidentProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword event_start_time: Timestamp for when the event started. + :paramtype event_start_time: ~datetime.datetime + :keyword event_status_last_modified_time: Timestamp for when event was submitted/detected. + :paramtype event_status_last_modified_time: ~datetime.datetime + :keyword correlation_id: Correlation id for the event. + :paramtype correlation_id: str + :keyword status: Status of the service impacting event. + :paramtype status: ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventStatus + :keyword incident_properties: Properties of the service impacting event. + :paramtype incident_properties: + ~azure.mgmt.resourcehealth.v2022_10_01.models.ServiceImpactingEventIncidentProperties + """ + super().__init__(**kwargs) + self.event_start_time = event_start_time + self.event_status_last_modified_time = event_status_last_modified_time + self.correlation_id = correlation_id + self.status = status + self.incident_properties = incident_properties + + +class ServiceImpactingEventIncidentProperties(_serialization.Model): + """Properties of the service impacting event. + + :ivar title: Title of the incident. + :vartype title: str + :ivar service: Service impacted by the event. + :vartype service: str + :ivar region: Region impacted by the event. + :vartype region: str + :ivar incident_type: Type of Event. + :vartype incident_type: str + """ + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "service": {"key": "service", "type": "str"}, + "region": {"key": "region", "type": "str"}, + "incident_type": {"key": "incidentType", "type": "str"}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + service: Optional[str] = None, + region: Optional[str] = None, + incident_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: Title of the incident. + :paramtype title: str + :keyword service: Service impacted by the event. + :paramtype service: str + :keyword region: Region impacted by the event. + :paramtype region: str + :keyword incident_type: Type of Event. + :paramtype incident_type: str + """ + super().__init__(**kwargs) + self.title = title + self.service = service + self.region = region + self.incident_type = incident_type + + +class ServiceImpactingEventStatus(_serialization.Model): + """Status of the service impacting event. + + :ivar value: Current status of the event. + :vartype value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: Current status of the event. + :paramtype value: str + """ + super().__init__(**kwargs) + self.value = value + + +class StatusActiveEvent(_serialization.Model): + """Active event type of emerging issue. + + :ivar title: The active event title. + :vartype title: str + :ivar description: The details of active event. + :vartype description: str + :ivar tracking_id: The tracking id of this active event. + :vartype tracking_id: str + :ivar start_time: The impact start time on this active event. + :vartype start_time: ~datetime.datetime + :ivar cloud: The cloud type of this active event. + :vartype cloud: str + :ivar severity: The severity level of this active event. Known values are: "Information", + "Warning", and "Error". + :vartype severity: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.SeverityValues + :ivar stage: The stage of this active event. Known values are: "Active", "Resolve", and + "Archived". + :vartype stage: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.StageValues + :ivar published: The boolean value of this active event if published or not. + :vartype published: bool + :ivar last_modified_time: The last time modified on this banner. + :vartype last_modified_time: ~datetime.datetime + :ivar impacts: The list of emerging issues impacts. + :vartype impacts: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssueImpact] + """ + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "cloud": {"key": "cloud", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "stage": {"key": "stage", "type": "str"}, + "published": {"key": "published", "type": "bool"}, + "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, + "impacts": {"key": "impacts", "type": "[EmergingIssueImpact]"}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + tracking_id: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + cloud: Optional[str] = None, + severity: Optional[Union[str, "_models.SeverityValues"]] = None, + stage: Optional[Union[str, "_models.StageValues"]] = None, + published: Optional[bool] = None, + last_modified_time: Optional[datetime.datetime] = None, + impacts: Optional[List["_models.EmergingIssueImpact"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: The active event title. + :paramtype title: str + :keyword description: The details of active event. + :paramtype description: str + :keyword tracking_id: The tracking id of this active event. + :paramtype tracking_id: str + :keyword start_time: The impact start time on this active event. + :paramtype start_time: ~datetime.datetime + :keyword cloud: The cloud type of this active event. + :paramtype cloud: str + :keyword severity: The severity level of this active event. Known values are: "Information", + "Warning", and "Error". + :paramtype severity: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.SeverityValues + :keyword stage: The stage of this active event. Known values are: "Active", "Resolve", and + "Archived". + :paramtype stage: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.StageValues + :keyword published: The boolean value of this active event if published or not. + :paramtype published: bool + :keyword last_modified_time: The last time modified on this banner. + :paramtype last_modified_time: ~datetime.datetime + :keyword impacts: The list of emerging issues impacts. + :paramtype impacts: list[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssueImpact] + """ + super().__init__(**kwargs) + self.title = title + self.description = description + self.tracking_id = tracking_id + self.start_time = start_time + self.cloud = cloud + self.severity = severity + self.stage = stage + self.published = published + self.last_modified_time = last_modified_time + self.impacts = impacts + + +class StatusBanner(_serialization.Model): + """Banner type of emerging issue. + + :ivar title: The banner title. + :vartype title: str + :ivar message: The details of banner. + :vartype message: str + :ivar cloud: The cloud type of this banner. + :vartype cloud: str + :ivar last_modified_time: The last time modified on this banner. + :vartype last_modified_time: ~datetime.datetime + """ + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "cloud": {"key": "cloud", "type": "str"}, + "last_modified_time": {"key": "lastModifiedTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + message: Optional[str] = None, + cloud: Optional[str] = None, + last_modified_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: The banner title. + :paramtype title: str + :keyword message: The details of banner. + :paramtype message: str + :keyword cloud: The cloud type of this banner. + :paramtype cloud: str + :keyword last_modified_time: The last time modified on this banner. + :paramtype last_modified_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.title = title + self.message = message + self.cloud = cloud + self.last_modified_time = last_modified_time + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.resourcehealth.v2022_10_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Update(_serialization.Model): + """Update for service health event. + + :ivar summary: Summary text for the given update for the service health event. + :vartype summary: str + :ivar update_date_time: It provides the Timestamp for the given update for the service health + event. + :vartype update_date_time: ~datetime.datetime + """ + + _attribute_map = { + "summary": {"key": "summary", "type": "str"}, + "update_date_time": {"key": "updateDateTime", "type": "iso-8601"}, + } + + def __init__( + self, *, summary: Optional[str] = None, update_date_time: Optional[datetime.datetime] = None, **kwargs: Any + ) -> None: + """ + :keyword summary: Summary text for the given update for the service health event. + :paramtype summary: str + :keyword update_date_time: It provides the Timestamp for the given update for the service + health event. + :paramtype update_date_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.summary = summary + self.update_date_time = update_date_time diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py new file mode 100644 index 000000000000..84a38989e29b --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/models/_resource_health_mgmt_client_enums.py @@ -0,0 +1,121 @@ +# 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 AvailabilityStateValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Impacted resource status of the resource.""" + + AVAILABLE = "Available" + UNAVAILABLE = "Unavailable" + DEGRADED = "Degraded" + UNKNOWN = "Unknown" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class EventLevelValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of event.""" + + CRITICAL = "Critical" + ERROR = "Error" + WARNING = "Warning" + INFORMATIONAL = "Informational" + + +class EventSourceValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Source of event.""" + + RESOURCE_HEALTH = "ResourceHealth" + SERVICE_HEALTH = "ServiceHealth" + + +class EventStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current status of event.""" + + ACTIVE = "Active" + RESOLVED = "Resolved" + + +class EventTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of event.""" + + SERVICE_ISSUE = "ServiceIssue" + PLANNED_MAINTENANCE = "PlannedMaintenance" + HEALTH_ADVISORY = "HealthAdvisory" + RCA = "RCA" + EMERGING_ISSUES = "EmergingIssues" + SECURITY_ADVISORY = "SecurityAdvisory" + + +class IssueNameParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IssueNameParameter.""" + + DEFAULT = "default" + + +class LevelValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of insight.""" + + CRITICAL = "Critical" + WARNING = "Warning" + + +class LinkTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of link.""" + + BUTTON = "Button" + HYPERLINK = "Hyperlink" + + +class ReasonChronicityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Chronicity of the availability transition.""" + + TRANSIENT = "Transient" + PERSISTENT = "Persistent" + + +class ReasonTypeValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """When the resource's availabilityState is Unavailable, it describes where the health impacting + event was originated. + """ + + UNPLANNED = "Unplanned" + PLANNED = "Planned" + USER_INITIATED = "UserInitiated" + + +class Scenario(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Scenario.""" + + ALERTS = "Alerts" + + +class SeverityValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The severity level of this active event.""" + + INFORMATION = "Information" + WARNING = "Warning" + ERROR = "Error" + + +class StageValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The stage of this active event.""" + + ACTIVE = "Active" + RESOLVE = "Resolve" + ARCHIVED = "Archived" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/__init__.py new file mode 100644 index 000000000000..5ef1b5084a40 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/__init__.py @@ -0,0 +1,37 @@ +# 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 ._availability_statuses_operations import AvailabilityStatusesOperations +from ._operations import Operations +from ._metadata_operations import MetadataOperations +from ._impacted_resources_operations import ImpactedResourcesOperations +from ._security_advisory_impacted_resources_operations import SecurityAdvisoryImpactedResourcesOperations +from ._events_operations import EventsOperations +from ._event_operations import EventOperations +from ._child_availability_statuses_operations import ChildAvailabilityStatusesOperations +from ._child_resources_operations import ChildResourcesOperations +from ._emerging_issues_operations import EmergingIssuesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AvailabilityStatusesOperations", + "Operations", + "MetadataOperations", + "ImpactedResourcesOperations", + "SecurityAdvisoryImpactedResourcesOperations", + "EventsOperations", + "EventOperations", + "ChildAvailabilityStatusesOperations", + "ChildResourcesOperations", + "EmergingIssuesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_availability_statuses_operations.py new file mode 100644 index 000000000000..65f22fef7955 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_availability_statuses_operations.py @@ -0,0 +1,555 @@ +# 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 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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_id_request( + subscription_id: str, *, filter: Optional[str] = None, expand: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses", + ) # 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 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # 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 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_get_by_resource_request( + resource_uri: str, *, filter: Optional[str] = None, expand: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current") + 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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_list_request( + resource_uri: str, *, filter: Optional[str] = None, expand: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses") + 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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) + + +class AvailabilityStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`availability_statuses` 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_by_subscription_id( + self, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AvailabilityStatus"]: + """Lists the current availability status for all the resources in the subscription. + + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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_by_subscription_id_request( + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + api_version=api_version, + template_url=self.list_by_subscription_id.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("AvailabilityStatusListResult", 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) + 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_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AvailabilityStatus"]: + """Lists the current availability status for all the resources in the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } + + @distributed_trace + def get_by_resource( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> _models.AvailabilityStatus: + """Gets current availability status for a single resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API support not nested and one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + and + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) + + request = build_get_by_resource_request( + resource_uri=resource_uri, + filter=filter, + expand=expand, + api_version=api_version, + template_url=self.get_by_resource.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} + + @distributed_trace + def list( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AvailabilityStatus"]: + """Lists all historical availability transitions and impacting events for a single resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API support not nested and one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + and + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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( + resource_uri=resource_uri, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_availability_statuses_operations.py new file mode 100644 index 000000000000..b9d7306faf15 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_availability_statuses_operations.py @@ -0,0 +1,289 @@ +# 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 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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_by_resource_request( + resource_uri: str, *, filter: Optional[str] = None, expand: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + ) + 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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_list_request( + resource_uri: str, *, filter: Optional[str] = None, expand: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses") + 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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) + + +class ChildAvailabilityStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`child_availability_statuses` 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 get_by_resource( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> _models.AvailabilityStatus: + """Gets current availability status for a single resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API only support one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilityStatus or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) + + request = build_get_by_resource_request( + resource_uri=resource_uri, + filter=filter, + expand=expand, + api_version=api_version, + template_url=self.get_by_resource.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AvailabilityStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_resource.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + } + + @distributed_trace + def list( + self, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AvailabilityStatus"]: + """Lists the historical availability statuses for a single child resource. Use the nextLink + property in the response to get the next page of availability status. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API only support one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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( + resource_uri=resource_uri, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py new file mode 100644 index 000000000000..388fdcab4010 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_child_resources_operations.py @@ -0,0 +1,185 @@ +# 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 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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_uri: str, *, filter: Optional[str] = None, expand: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources") + 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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) + + +class ChildResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`child_resources` 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, resource_uri: str, filter: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AvailabilityStatus"]: + """Lists the all the children and its current health status for a parent resource. Use the + nextLink property in the response to get the next page of children current health. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API only support not nested parent resource type: + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param expand: Setting $expand=recommendedactions in url query expands the recommendedactions + in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilityStatus or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.AvailabilityStatus] + :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", "2022-10-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = 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( + resource_uri=resource_uri, + filter=filter, + expand=expand, + 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("AvailabilityStatusListResult", 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) + 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": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_emerging_issues_operations.py new file mode 100644 index 000000000000..18ad945e5f1e --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_emerging_issues_operations.py @@ -0,0 +1,237 @@ +# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/emergingIssues") + + # 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(issue_name: Union[str, _models.IssueNameParameter], **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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}") + path_format_arguments = { + "issueName": _SERIALIZER.url("issue_name", issue_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) + + +class EmergingIssuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`emerging_issues` 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, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: + """Lists Azure services' emerging issues. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EmergingIssuesGetResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult] + :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", "2022-10-01")) + cls: ClsType[_models.EmergingIssueListResult] = 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( + 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("EmergingIssueListResult", 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) + 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.ResourceHealth/emergingIssues"} + + @distributed_trace + def get(self, issue_name: Union[str, _models.IssueNameParameter], **kwargs: Any) -> _models.EmergingIssuesGetResult: + """Gets Azure services' emerging issues. + + :param issue_name: The name of the emerging issue. "default" Required. + :type issue_name: str or ~azure.mgmt.resourcehealth.v2022_10_01.models.IssueNameParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EmergingIssuesGetResult or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EmergingIssuesGetResult + :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", "2022-10-01")) + cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) + + request = build_get_request( + issue_name=issue_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) + + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EmergingIssuesGetResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_event_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_event_operations.py new file mode 100644 index 000000000000..e91f5dcff250 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_event_operations.py @@ -0,0 +1,442 @@ +# 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 typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_by_subscription_id_and_tracking_id_request( + event_tracking_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + query_start_time: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # 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 query_start_time is not None: + _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fetch_details_by_subscription_id_and_tracking_id_request( + event_tracking_id: 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "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_get_by_tenant_id_and_tracking_id_request( + event_tracking_id: str, *, filter: Optional[str] = None, query_start_time: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}") + path_format_arguments = { + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # 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 query_start_time is not None: + _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fetch_details_by_tenant_id_and_tracking_id_request(event_tracking_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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails") + path_format_arguments = { + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "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) + + +class EventOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`event` 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 get_by_subscription_id_and_tracking_id( + self, + event_tracking_id: str, + filter: Optional[str] = None, + query_start_time: Optional[str] = None, + **kwargs: Any + ) -> _models.Event: + """Service health event in the subscription by event tracking id. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_get_by_subscription_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.get_by_subscription_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_subscription_id_and_tracking_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}" + } + + @distributed_trace + def fetch_details_by_subscription_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: + """Service health event details in the subscription by event tracking id. This can be used to + fetch sensitive properties for Security Advisory events. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_fetch_details_by_subscription_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.fetch_details_by_subscription_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + fetch_details_by_subscription_id_and_tracking_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" + } + + @distributed_trace + def get_by_tenant_id_and_tracking_id( + self, + event_tracking_id: str, + filter: Optional[str] = None, + query_start_time: Optional[str] = None, + **kwargs: Any + ) -> _models.Event: + """Service health event in the tenant by event tracking id. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_get_by_tenant_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.get_by_tenant_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_tenant_id_and_tracking_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"} + + @distributed_trace + def fetch_details_by_tenant_id_and_tracking_id(self, event_tracking_id: str, **kwargs: Any) -> _models.Event: + """Service health event details in the tenant by event tracking id. This can be used to fetch + sensitive properties for Security Advisory events. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Event or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.Event + :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", "2022-10-01")) + cls: ClsType[_models.Event] = kwargs.pop("cls", None) + + request = build_fetch_details_by_tenant_id_and_tracking_id_request( + event_tracking_id=event_tracking_id, + api_version=api_version, + template_url=self.fetch_details_by_tenant_id_and_tracking_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Event", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + fetch_details_by_tenant_id_and_tracking_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails" + } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_events_operations.py new file mode 100644 index 000000000000..b063fecb493f --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_events_operations.py @@ -0,0 +1,421 @@ +# 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 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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_id_request( + subscription_id: str, *, filter: Optional[str] = None, query_start_time: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if query_start_time is not None: + _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_tenant_id_request( + *, filter: Optional[str] = None, query_start_time: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events") + + # 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 query_start_time is not None: + _params["queryStartTime"] = _SERIALIZER.query("query_start_time", query_start_time, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_single_resource_request( + resource_uri: str, *, filter: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ResourceHealth/events") + 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class EventsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`events` 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_by_subscription_id( + self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.Event"]: + """Lists service health events in the subscription. + + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :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", "2022-10-01")) + cls: ClsType[_models.Events] = 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_by_subscription_id_request( + subscription_id=self._config.subscription_id, + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.list_by_subscription_id.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("Events", 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) + 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_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" + } + + @distributed_trace + def list_by_tenant_id( + self, filter: Optional[str] = None, query_start_time: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.Event"]: + """Lists current service health events in the tenant. + + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :param query_start_time: Specifies from when to return events, based on the lastUpdateTime + property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. Default + value is None. + :type query_start_time: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :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", "2022-10-01")) + cls: ClsType[_models.Events] = 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_by_tenant_id_request( + filter=filter, + query_start_time=query_start_time, + api_version=api_version, + template_url=self.list_by_tenant_id.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("Events", 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) + 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_by_tenant_id.metadata = {"url": "/providers/Microsoft.ResourceHealth/events"} + + @distributed_trace + def list_by_single_resource( + self, resource_uri: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.Event"]: + """Lists current service health events for given resource. + + :param resource_uri: The fully qualified ID of the resource, including the resource name and + resource type. Currently the API support not nested and one nesting level resource types : + /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + and + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + Required. + :type resource_uri: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Event or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.Event] + :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", "2022-10-01")) + cls: ClsType[_models.Events] = 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_by_single_resource_request( + resource_uri=resource_uri, + filter=filter, + api_version=api_version, + template_url=self.list_by_single_resource.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("Events", 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) + 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_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_impacted_resources_operations.py new file mode 100644 index 000000000000..580ea78fe17a --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_impacted_resources_operations.py @@ -0,0 +1,493 @@ +# 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 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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_id_and_event_id_request( + event_tracking_id: str, subscription_id: str, *, filter: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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( + event_tracking_id: str, impacted_resource_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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + "impactedResourceName": _SERIALIZER.url( + "impacted_resource_name", impacted_resource_name, "str", pattern=r"^[^*#&+:<>%?]+$" + ), + } + + _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_list_by_tenant_id_and_event_id_request( + event_tracking_id: str, *, filter: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources") + path_format_arguments = { + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_by_tenant_id_request(event_tracking_id: str, impacted_resource_name: 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + "impactedResourceName": _SERIALIZER.url( + "impacted_resource_name", impacted_resource_name, "str", pattern=r"^[^*#&+:<>%?]+$" + ), + } + + _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) + + +class ImpactedResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`impacted_resources` 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_by_subscription_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.EventImpactedResource"]: + """Lists impacted resources in the subscription by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_subscription_id_and_event_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_subscription_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_subscription_id_and_event_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" + } + + @distributed_trace + def get(self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any) -> _models.EventImpactedResource: + """Gets the specific impacted resource in the subscription by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param impacted_resource_name: Name of the Impacted Resource. Required. + :type impacted_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventImpactedResource or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) + + request = build_get_request( + event_tracking_id=event_tracking_id, + impacted_resource_name=impacted_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EventImpactedResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" + } + + @distributed_trace + def list_by_tenant_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.EventImpactedResource"]: + """Lists impacted resources in the tenant by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_tenant_id_and_event_id_request( + event_tracking_id=event_tracking_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_tenant_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_tenant_id_and_event_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources" + } + + @distributed_trace + def get_by_tenant_id( + self, event_tracking_id: str, impacted_resource_name: str, **kwargs: Any + ) -> _models.EventImpactedResource: + """Gets the specific impacted resource in the tenant by an event. + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param impacted_resource_name: Name of the Impacted Resource. Required. + :type impacted_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventImpactedResource or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResource] = kwargs.pop("cls", None) + + request = build_get_by_tenant_id_request( + event_tracking_id=event_tracking_id, + impacted_resource_name=impacted_resource_name, + api_version=api_version, + template_url=self.get_by_tenant_id.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EventImpactedResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_tenant_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}" + } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py new file mode 100644 index 000000000000..93e80d6b74fc --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_metadata_operations.py @@ -0,0 +1,236 @@ +# 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 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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/metadata") + + # 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_entity_request(name: 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/metadata/{name}") + path_format_arguments = { + "name": _SERIALIZER.url("name", 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) + + +class MetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`metadata` 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, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: + """Gets the list of metadata entities. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetadataEntity or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity] + :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", "2022-10-01")) + cls: ClsType[_models.MetadataEntityListResult] = 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( + 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("MetadataEntityListResult", 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) + 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.ResourceHealth/metadata"} + + @distributed_trace + def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: + """Gets the list of metadata entities. + + :param name: Name of metadata entity. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataEntity or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.MetadataEntity + :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", "2022-10-01")) + cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) + + request = build_get_entity_request( + name=name, + api_version=api_version, + template_url=self.get_entity.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MetadataEntity", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py new file mode 100644 index 000000000000..9e49943e4a03 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_operations.py @@ -0,0 +1,126 @@ +# 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 typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +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(**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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceHealth/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> _models.OperationListResult: + """Lists available operations for the resourcehealth resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.resourcehealth.v2022_10_01.models.OperationListResult + :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", "2022-10-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + request = build_list_request( + 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) + + _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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_patch.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_security_advisory_impacted_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_security_advisory_impacted_resources_operations.py new file mode 100644 index 000000000000..01d33373dc44 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/operations/_security_advisory_impacted_resources_operations.py @@ -0,0 +1,308 @@ +# 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 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, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_id_and_event_id_request( + event_tracking_id: str, subscription_id: str, *, filter: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_tenant_id_and_event_id_request( + event_tracking_id: str, *, filter: Optional[str] = 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", "2022-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "eventTrackingId": _SERIALIZER.url("event_tracking_id", event_tracking_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SecurityAdvisoryImpactedResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resourcehealth.v2022_10_01.ResourceHealthMgmtClient`'s + :attr:`security_advisory_impacted_resources` 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_by_subscription_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.EventImpactedResource"]: + """Lists impacted resources in the subscription by an event (Security Advisory). + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_subscription_id_and_event_id_request( + event_tracking_id=event_tracking_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_subscription_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_subscription_id_and_event_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" + } + + @distributed_trace + def list_by_tenant_id_and_event_id( + self, event_tracking_id: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.EventImpactedResource"]: + """Lists impacted resources in the tenant by an event (Security Advisory). + + :param event_tracking_id: Event Id which uniquely identifies ServiceHealth event. Required. + :type event_tracking_id: str + :param filter: The filter to apply on the operation. For more information please see + https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventImpactedResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resourcehealth.v2022_10_01.models.EventImpactedResource] + :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", "2022-10-01")) + cls: ClsType[_models.EventImpactedResourceListResult] = 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_by_tenant_id_and_event_id_request( + event_tracking_id=event_tracking_id, + filter=filter, + api_version=api_version, + template_url=self.list_by_tenant_id_and_event_id.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("EventImpactedResourceListResult", 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) + 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_by_tenant_id_and_event_id.metadata = { + "url": "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources" + } diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2022_10_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py index 281dc008ac4f..060ece11cd85 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_status_get_by_resource.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatus_GetByResource.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py index a2bb74c30de5..6e628013cc21 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatuses_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py index f0795344557a..f907ef544ed2 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_resource_group.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="subscriptionId", ) @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatuses_ListByResourceGroup.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py index 7647ed2e9b81..905f30275f84 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/availability_statuses_list_by_subscription_id.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="subscriptionId", ) @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/AvailabilityStatuses_ListBySubscriptionId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py new file mode 100644 index 000000000000..6884d75546e5 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_status_get_by_resource.py @@ -0,0 +1,40 @@ +# 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.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python child_availability_status_get_by_resource.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.child_availability_statuses.get_by_resource( + resource_uri="subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.py new file mode 100644 index 000000000000..add2314fa3da --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_availability_statuses_list.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python child_availability_statuses_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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.child_availability_statuses.list( + resource_uri="subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.py new file mode 100644 index 000000000000..81d9bb4f894a --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/child_resources_list.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python child_resources_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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.child_resources.list( + resource_uri="resourceUri", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py index 552cb4f02fdb..8843d5dfc561 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/EmergingIssues_Get.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py index 3bb728fc15cd..4118e3a4c788 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/emerging_issues_list.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/EmergingIssues_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py new file mode 100644 index 000000000000..5efff406fa4d --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_subscription_id_and_tracking_id.py @@ -0,0 +1,40 @@ +# 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.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python event_fetch_details_by_subscription_id_and_tracking_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.event.fetch_details_by_subscription_id_and_tracking_id( + event_tracking_id="eventTrackingId", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py new file mode 100644 index 000000000000..cbe49e95e720 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_fetch_details_by_tenant_id_and_tracking_id.py @@ -0,0 +1,40 @@ +# 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.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python event_fetch_details_by_tenant_id_and_tracking_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.event.fetch_details_by_tenant_id_and_tracking_id( + event_tracking_id="eventTrackingId", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py new file mode 100644 index 000000000000..c2fce01bd69c --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_subscription_id_and_tracking_id.py @@ -0,0 +1,40 @@ +# 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.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python event_get_by_subscription_id_and_tracking_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.event.get_by_subscription_id_and_tracking_id( + event_tracking_id="eventTrackingId", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py new file mode 100644 index 000000000000..280e71177e55 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/event_get_by_tenant_id_and_tracking_id.py @@ -0,0 +1,40 @@ +# 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.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python event_get_by_tenant_id_and_tracking_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.event.get_by_tenant_id_and_tracking_id( + event_tracking_id="eventTrackingId", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py index fca2086b83ee..8f71a82bc399 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_single_resource.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Events_ListBySingleResource.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py index 363292a6ff69..cc3f33929be3 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_subscription_id.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="subscriptionId", ) @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Events_ListBySubscriptionId.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py new file mode 100644 index 000000000000..6db93d535f47 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/events_list_by_tenant_id.py @@ -0,0 +1,39 @@ +# 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.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python events_list_by_tenant_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.events.list_by_tenant_id() + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.py new file mode 100644 index 000000000000..f545a642cd87 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python impacted_resources_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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.impacted_resources.get( + event_tracking_id="BC_1-FXZ", + impacted_resource_name="abc-123-ghj-456", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.py new file mode 100644 index 000000000000..3b6775d59c98 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_get_by_tenant_id.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python impacted_resources_get_by_tenant_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.impacted_resources.get_by_tenant_id( + event_tracking_id="BC_1-FXZ", + impacted_resource_name="abc-123-ghj-456", + ) + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.py new file mode 100644 index 000000000000..f1a6b6732bba --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_subscription_id_list_by_event_id.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python impacted_resources_list_by_subscription_id_list_by_event_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.impacted_resources.list_by_subscription_id_and_event_id( + event_tracking_id="BC_1-FXZ", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.py new file mode 100644 index 000000000000..b68ae5f56bc1 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/impacted_resources_list_by_tenant_id_list_by_event_id.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python impacted_resources_list_by_tenant_id_list_by_event_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.impacted_resources.list_by_tenant_id_and_event_id( + event_tracking_id="BC_1-FXZ", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py index f76c69b15f9c..d8a91fa56540 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_get_entity.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Metadata_GetEntity.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py index b5fd97aea687..42685da8b418 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/metadata_list.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.resourcehealth import MicrosoftResourceHealth +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient """ # PREREQUISITES @@ -24,7 +24,7 @@ def main(): - client = MicrosoftResourceHealth( + client = ResourceHealthMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2018-07-01/examples/Metadata_List.json +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json if __name__ == "__main__": main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py new file mode 100644 index 000000000000..0a9a7c892324 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/operations_list.py @@ -0,0 +1,38 @@ +# 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.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python operations_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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + print(response) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.py new file mode 100644 index 000000000000..a89b53135f84 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python security_advisory_impacted_resources_list_by_subscription_id_list_by_event_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="subscriptionId", + ) + + response = client.security_advisory_impacted_resources.list_by_subscription_id_and_event_id( + event_tracking_id="BC_1-FXZ", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json +if __name__ == "__main__": + main() diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.py new file mode 100644 index 000000000000..a12174028160 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/generated_samples/security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.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 azure.identity import DefaultAzureCredential +from azure.mgmt.resourcehealth import ResourceHealthMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-resourcehealth +# USAGE + python security_advisory_impacted_resources_list_by_tenant_id_list_by_event_id.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 = ResourceHealthMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.security_advisory_impacted_resources.list_by_tenant_id_and_event_id( + event_tracking_id="BC_1-FXZ", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json +if __name__ == "__main__": + main()