Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "51d4c24a011e300b9713179e0515fef35bf3f678",
"commit": "cec2af515b437597591a055207fd9b915d838124",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/[email protected].0",
"@autorest/[email protected].12",
"@autorest/[email protected]"
],
"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/[email protected].0 --use=@autorest/[email protected] --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/[email protected].12 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/resourcehealth/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
)
Expand All @@ -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
)
Expand All @@ -89,13 +87,17 @@ def models(cls, api_version=DEFAULT_API_VERSION):

* 2015-01-01: :mod:`v2015_01_01.models<azure.mgmt.resourcehealth.v2015_01_01.models>`
* 2018-07-01: :mod:`v2018_07_01.models<azure.mgmt.resourcehealth.v2018_07_01.models>`
* 2022-10-01: :mod:`v2022_10_01.models<azure.mgmt.resourcehealth.v2022_10_01.models>`
"""
if api_version == '2015-01-01':
from .v2015_01_01 import models
return models
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
Expand All @@ -104,12 +106,15 @@ def availability_statuses(self):

* 2015-01-01: :class:`AvailabilityStatusesOperations<azure.mgmt.resourcehealth.v2015_01_01.operations.AvailabilityStatusesOperations>`
* 2018-07-01: :class:`AvailabilityStatusesOperations<azure.mgmt.resourcehealth.v2018_07_01.operations.AvailabilityStatusesOperations>`
* 2022-10-01: :class:`AvailabilityStatusesOperations<azure.mgmt.resourcehealth.v2022_10_01.operations.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
Expand All @@ -120,10 +125,13 @@ def child_availability_statuses(self):
"""Instance depends on the API version:

* 2015-01-01: :class:`ChildAvailabilityStatusesOperations<azure.mgmt.resourcehealth.v2015_01_01.operations.ChildAvailabilityStatusesOperations>`
* 2022-10-01: :class:`ChildAvailabilityStatusesOperations<azure.mgmt.resourcehealth.v2022_10_01.operations.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
Expand All @@ -134,10 +142,13 @@ def child_resources(self):
"""Instance depends on the API version:

* 2015-01-01: :class:`ChildResourcesOperations<azure.mgmt.resourcehealth.v2015_01_01.operations.ChildResourcesOperations>`
* 2022-10-01: :class:`ChildResourcesOperations<azure.mgmt.resourcehealth.v2022_10_01.operations.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
Expand All @@ -148,38 +159,75 @@ def emerging_issues(self):
"""Instance depends on the API version:

* 2018-07-01: :class:`EmergingIssuesOperations<azure.mgmt.resourcehealth.v2018_07_01.operations.EmergingIssuesOperations>`
* 2022-10-01: :class:`EmergingIssuesOperations<azure.mgmt.resourcehealth.v2022_10_01.operations.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<azure.mgmt.resourcehealth.v2022_10_01.operations.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<azure.mgmt.resourcehealth.v2018_07_01.operations.EventsOperations>`
* 2022-10-01: :class:`EventsOperations<azure.mgmt.resourcehealth.v2022_10_01.operations.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<azure.mgmt.resourcehealth.v2022_10_01.operations.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<azure.mgmt.resourcehealth.v2018_07_01.operations.MetadataOperations>`
* 2022-10-01: :class:`MetadataOperations<azure.mgmt.resourcehealth.v2022_10_01.operations.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
Expand All @@ -191,17 +239,34 @@ def operations(self):

* 2015-01-01: :class:`Operations<azure.mgmt.resourcehealth.v2015_01_01.operations.Operations>`
* 2018-07-01: :class:`Operations<azure.mgmt.resourcehealth.v2018_07_01.operations.Operations>`
* 2022-10-01: :class:`Operations<azure.mgmt.resourcehealth.v2022_10_01.operations.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<azure.mgmt.resourcehealth.v2022_10_01.operations.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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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


Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# license information.
# --------------------------------------------------------------------------

VERSION = "1.0.0b3"
VERSION = "0.1.0"
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand All @@ -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
Expand Down
Loading