Skip to content

Commit

Permalink
CodeGen from PR 21286 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.ResourceHealth to add version preview/2022-05-01 (Azure#21286)

* Adds base for updating Microsoft.ResourceHealth from version stable/2020-05-01 to version 2022-05-01

* Updates readme

* Updates API version in new specs and examples

* made the changes for tenant level and impacted resources similarly to the private repo

* changed api version to 2022-05-01-preview

* changed api version to 2022-05-01-preview

* updated readme to reflect new filename

* updated example to use targetRegion instead of region in filter condition

* changed the default version back to 2020 as i found that all previous defaults were ga versions. thus will be updated when this goes to GA
  • Loading branch information
SDKAuto committed Nov 14, 2022
1 parent b50b038 commit 0efeeb5
Show file tree
Hide file tree
Showing 34 changed files with 4,137 additions and 1,761 deletions.
12 changes: 6 additions & 6 deletions sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.4.2",
"commit": "d94dd5df1891680d12e0a11f150abe3ca6afabc4",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@5.8.1",
"@autorest/modelerfour@4.19.2"
"@autorest/python@6.2.1",
"@autorest/modelerfour@4.24.3"
],
"commit": "8816b8568ee46dae94967bfadb97e19301604667",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/resourcehealth/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2",
"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.2.1 --use=@autorest/modelerfour@4.24.3 --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 @@ -14,3 +14,7 @@
patch_sdk()
except ImportError:
pass

from ._version import VERSION

__version__ = VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from typing import TYPE_CHECKING
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
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

class MicrosoftResourceHealthConfiguration(Configuration):
Expand All @@ -28,16 +26,16 @@ class MicrosoftResourceHealthConfiguration(Configuration):
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.
: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.
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
credential: "TokenCredential",
subscription_id: str,
**kwargs # type: Any
):
# type: (...) -> None
Expand Down Expand Up @@ -68,4 +66,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@
# regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
from typing import Any, Optional, TYPE_CHECKING

from azure.mgmt.core import ARMPipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from msrest import Deserializer, Serializer

from ._configuration import MicrosoftResourceHealthConfiguration
from ._serialization import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

class _SDKClient(object):
def __init__(self, *args, **kwargs):
Expand All @@ -43,9 +40,9 @@ class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient):
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
: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.
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
Expand All @@ -66,15 +63,13 @@ class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient):

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
credential: "TokenCredential",
subscription_id: str,
api_version=None, # type: Optional[str]
base_url=None, # type: Optional[str]
base_url: str = "https://management.azure.com",
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if not base_url:
base_url = 'https://management.azure.com'
self._config = MicrosoftResourceHealthConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(MicrosoftResourceHealth, self).__init__(
Expand Down Expand Up @@ -108,6 +103,7 @@ def availability_statuses(self):
from .v2015_01_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
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
Expand All @@ -121,6 +117,7 @@ def child_availability_statuses(self):
from .v2015_01_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
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
Expand All @@ -134,6 +131,7 @@ def child_resources(self):
from .v2015_01_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
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
Expand All @@ -147,6 +145,7 @@ def operations(self):
from .v2015_01_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)))

def close(self):
Expand Down
Loading

0 comments on commit 0efeeb5

Please sign in to comment.