forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeGen from PR 14984 in Azure/azure-rest-api-specs
python config (Azure#14984)
- Loading branch information
SDKAuto
committed
Jun 25, 2021
1 parent
9502e66
commit f8b6976
Showing
42 changed files
with
3,753 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Release History | ||
|
||
## 0.1.0 (1970-01-01) | ||
|
||
* Initial Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include _meta.json | ||
recursive-include tests *.py *.yaml | ||
include *.md | ||
include azure/__init__.py | ||
include azure/mgmt/__init__.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Microsoft Azure SDK for Python | ||
|
||
This is the Microsoft Azure MyService Management Client Library. | ||
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. | ||
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). | ||
|
||
|
||
# Usage | ||
|
||
|
||
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) | ||
|
||
|
||
|
||
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) | ||
Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. | ||
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) | ||
|
||
|
||
# Provide Feedback | ||
|
||
If you encounter any bugs or have suggestions, please file an issue in the | ||
[Issues](https://github.com/Azure/azure-sdk-for-python/issues) | ||
section of the project. | ||
|
||
|
||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-resourcehealth%2FREADME.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"autorest": "3.4.2", | ||
"use": [ | ||
"@autorest/[email protected]", | ||
"@autorest/[email protected]" | ||
], | ||
"commit": "8dff86df71bee429af84ea4713288ef3cdd1db2f", | ||
"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/[email protected] --use=@autorest/[email protected] --version=3.4.2", | ||
"readme": "specification/resourcehealth/resource-manager/readme.md" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__path__ = __import__("pkgutil").extend_path(__path__, __name__) |
1 change: 1 addition & 0 deletions
1
sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__path__ = __import__("pkgutil").extend_path(__path__, __name__) |
16 changes: 16 additions & 0 deletions
16
sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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 ._microsoft_resource_health import MicrosoftResourceHealth | ||
__all__ = ['MicrosoftResourceHealth'] | ||
|
||
try: | ||
from ._patch import patch_sdk # type: ignore | ||
patch_sdk() | ||
except ImportError: | ||
pass |
71 changes: 71 additions & 0 deletions
71
sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# 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 TYPE_CHECKING | ||
|
||
from azure.core.configuration import Configuration | ||
from azure.core.pipeline import policies | ||
from azure.mgmt.core.policies import 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): | ||
"""Configuration for MicrosoftResourceHealth. | ||
Note that all parameters used to create this instance are saved as instance | ||
attributes. | ||
:param credential: Credential needed for the client to connect to Azure. | ||
:type credential: ~azure.core.credentials.TokenCredential | ||
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. | ||
:type subscription_id: str | ||
""" | ||
|
||
def __init__( | ||
self, | ||
credential, # type: "TokenCredential" | ||
subscription_id, # type: str | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
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.") | ||
super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) | ||
|
||
self.credential = credential | ||
self.subscription_id = subscription_id | ||
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) | ||
kwargs.setdefault('sdk_moniker', 'azure-mgmt-resourcehealth/{}'.format(VERSION)) | ||
self._configure(**kwargs) | ||
|
||
def _configure( | ||
self, | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) | ||
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) | ||
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) | ||
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) | ||
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) | ||
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) | ||
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) | ||
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) | ||
self.authentication_policy = kwargs.get('authentication_policy') | ||
if self.credential and not self.authentication_policy: | ||
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) |
158 changes: 158 additions & 0 deletions
158
...ehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# 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 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 | ||
|
||
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): | ||
"""This is a fake class to support current implemetation of MultiApiClientMixin." | ||
Will be removed in final version of multiapi azure-core based client | ||
""" | ||
pass | ||
|
||
class MicrosoftResourceHealth(MultiApiClientMixin, _SDKClient): | ||
"""The Resource Health Client. | ||
This ready contains multiple API versions, to help you deal with all of the Azure clouds | ||
(Azure Stack, Azure Government, Azure China, etc.). | ||
By default, it uses the latest API version available on public Azure. | ||
For production, you should stick to a particular api-version and/or profile. | ||
The profile sets a mapping between an operation group and its API version. | ||
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. | ||
:type credential: ~azure.core.credentials.TokenCredential | ||
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. | ||
:type subscription_id: str | ||
:param api_version: API version to use if no profile is provided, or if missing in profile. | ||
:type api_version: str | ||
:param base_url: Service URL | ||
:type base_url: str | ||
:param profile: A profile definition, from KnownProfiles to dict. | ||
:type profile: azure.profiles.KnownProfiles | ||
""" | ||
|
||
DEFAULT_API_VERSION = '2015-01-01' | ||
_PROFILE_TAG = "azure.mgmt.resourcehealth.MicrosoftResourceHealth" | ||
LATEST_PROFILE = ProfileDefinition({ | ||
_PROFILE_TAG: { | ||
None: DEFAULT_API_VERSION, | ||
}}, | ||
_PROFILE_TAG + " latest" | ||
) | ||
|
||
def __init__( | ||
self, | ||
credential, # type: "TokenCredential" | ||
subscription_id, # type: str | ||
api_version=None, # type: Optional[str] | ||
base_url=None, # type: Optional[str] | ||
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__( | ||
api_version=api_version, | ||
profile=profile | ||
) | ||
|
||
@classmethod | ||
def _models_dict(cls, api_version): | ||
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} | ||
|
||
@classmethod | ||
def models(cls, api_version=DEFAULT_API_VERSION): | ||
"""Module depends on the API version: | ||
* 2015-01-01: :mod:`v2015_01_01.models<azure.mgmt.resourcehealth.v2015_01_01.models>` | ||
""" | ||
if api_version == '2015-01-01': | ||
from .v2015_01_01 import models | ||
return models | ||
raise ValueError("API version {} is not available".format(api_version)) | ||
|
||
@property | ||
def availability_statuses(self): | ||
"""Instance depends on the API version: | ||
* 2015-01-01: :class:`AvailabilityStatusesOperations<azure.mgmt.resourcehealth.v2015_01_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 | ||
else: | ||
raise ValueError("API version {} does not have operation group 'availability_statuses'".format(api_version)) | ||
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) | ||
|
||
@property | ||
def child_availability_statuses(self): | ||
"""Instance depends on the API version: | ||
* 2015-01-01: :class:`ChildAvailabilityStatusesOperations<azure.mgmt.resourcehealth.v2015_01_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 | ||
else: | ||
raise ValueError("API version {} does not have operation group 'child_availability_statuses'".format(api_version)) | ||
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) | ||
|
||
@property | ||
def child_resources(self): | ||
"""Instance depends on the API version: | ||
* 2015-01-01: :class:`ChildResourcesOperations<azure.mgmt.resourcehealth.v2015_01_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 | ||
else: | ||
raise ValueError("API version {} does not have operation group 'child_resources'".format(api_version)) | ||
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) | ||
|
||
@property | ||
def operations(self): | ||
"""Instance depends on the API version: | ||
* 2015-01-01: :class:`Operations<azure.mgmt.resourcehealth.v2015_01_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 | ||
else: | ||
raise ValueError("API version {} does not have operation group 'operations'".format(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): | ||
self._client.__enter__() | ||
return self | ||
def __exit__(self, *exc_details): | ||
self._client.__exit__(*exc_details) |
8 changes: 8 additions & 0 deletions
8
sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 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. | ||
# -------------------------------------------------------------------------- | ||
|
||
VERSION = "0.1.0" |
10 changes: 10 additions & 0 deletions
10
sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 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 ._microsoft_resource_health import MicrosoftResourceHealth | ||
__all__ = ['MicrosoftResourceHealth'] |
67 changes: 67 additions & 0 deletions
67
sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
from typing import Any, TYPE_CHECKING | ||
|
||
from azure.core.configuration import Configuration | ||
from azure.core.pipeline import policies | ||
from azure.mgmt.core.policies import ARMHttpLoggingPolicy | ||
|
||
from .._version import VERSION | ||
|
||
if TYPE_CHECKING: | ||
# pylint: disable=unused-import,ungrouped-imports | ||
from azure.core.credentials_async import AsyncTokenCredential | ||
|
||
class MicrosoftResourceHealthConfiguration(Configuration): | ||
"""Configuration for MicrosoftResourceHealth. | ||
Note that all parameters used to create this instance are saved as instance | ||
attributes. | ||
:param credential: Credential needed for the client to connect to Azure. | ||
:type credential: ~azure.core.credentials_async.AsyncTokenCredential | ||
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. | ||
:type subscription_id: str | ||
""" | ||
|
||
def __init__( | ||
self, | ||
credential: "AsyncTokenCredential", | ||
subscription_id: str, | ||
**kwargs # type: Any | ||
) -> None: | ||
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.") | ||
super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) | ||
|
||
self.credential = credential | ||
self.subscription_id = subscription_id | ||
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) | ||
kwargs.setdefault('sdk_moniker', 'azure-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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) |
Oops, something went wrong.