Skip to content

Commit

Permalink
CodeGen from PR 18156 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 7e3db63daff3f90e431d6ce8ce605ccf25b24d18 into 791255f0c5dd775015cd51f3e642549190fb3803
  • Loading branch information
SDKAuto committed Mar 10, 2022
1 parent 4083a32 commit e69627d
Show file tree
Hide file tree
Showing 521 changed files with 40,385 additions and 39,497 deletions.
10 changes: 5 additions & 5 deletions sdk/monitor/azure-mgmt-monitor/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.4.5",
"autorest": "3.7.2",
"use": [
"@autorest/python@5.8.4",
"@autorest/[email protected].2"
"@autorest/python@5.12.0",
"@autorest/[email protected].3"
],
"commit": "a81eaccc23c98d2effd62f1a80b81394be30d2c5",
"commit": "36a4534fc8ec2e5f514607814da1c52175ac5a6a",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/monitor/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.4 --use=@autorest/[email protected].2 --version=3.4.5",
"autorest_command": "autorest specification/monitor/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/[email protected].3 --version=3.7.2",
"readme": "specification/monitor/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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

Expand Down Expand Up @@ -68,4 +68,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 @@ -23,7 +23,6 @@
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 Down Expand Up @@ -105,12 +104,10 @@ def __init__(
credential, # type: "TokenCredential"
subscription_id, # type: str
api_version=None, # type: Optional[str]
base_url=None, # type: Optional[str]
base_url="https://management.azure.com", # type: str
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if not base_url:
base_url = 'https://management.azure.com'
self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(MonitorManagementClient, self).__init__(
Expand Down Expand Up @@ -151,6 +148,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2021-04-01: :mod:`v2021_04_01.models<azure.mgmt.monitor.v2021_04_01.models>`
* 2021-05-01-preview: :mod:`v2021_05_01_preview.models<azure.mgmt.monitor.v2021_05_01_preview.models>`
* 2021-09-01: :mod:`v2021_09_01.models<azure.mgmt.monitor.v2021_09_01.models>`
* 2021-09-01-preview: :mod:`v2022_02_01_preview.models<azure.mgmt.monitor.v2022_02_01_preview.models>`
"""
if api_version == '2015-04-01':
from .v2015_04_01 import models
Expand Down Expand Up @@ -227,6 +225,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2021-09-01':
from .v2021_09_01 import models
return models
elif api_version == '2021-09-01-preview':
from .v2022_02_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
Expand Down Expand Up @@ -368,10 +369,13 @@ def data_collection_endpoints(self):
"""Instance depends on the API version:
* 2021-04-01: :class:`DataCollectionEndpointsOperations<azure.mgmt.monitor.v2021_04_01.operations.DataCollectionEndpointsOperations>`
* 2021-09-01-preview: :class:`DataCollectionEndpointsOperations<azure.mgmt.monitor.v2022_02_01_preview.operations.DataCollectionEndpointsOperations>`
"""
api_version = self._get_api_version('data_collection_endpoints')
if api_version == '2021-04-01':
from .v2021_04_01.operations import DataCollectionEndpointsOperations as OperationClass
elif api_version == '2021-09-01-preview':
from .v2022_02_01_preview.operations import DataCollectionEndpointsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_collection_endpoints'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -382,12 +386,15 @@ def data_collection_rule_associations(self):
* 2019-11-01-preview: :class:`DataCollectionRuleAssociationsOperations<azure.mgmt.monitor.v2019_11_01_preview.operations.DataCollectionRuleAssociationsOperations>`
* 2021-04-01: :class:`DataCollectionRuleAssociationsOperations<azure.mgmt.monitor.v2021_04_01.operations.DataCollectionRuleAssociationsOperations>`
* 2021-09-01-preview: :class:`DataCollectionRuleAssociationsOperations<azure.mgmt.monitor.v2022_02_01_preview.operations.DataCollectionRuleAssociationsOperations>`
"""
api_version = self._get_api_version('data_collection_rule_associations')
if api_version == '2019-11-01-preview':
from .v2019_11_01_preview.operations import DataCollectionRuleAssociationsOperations as OperationClass
elif api_version == '2021-04-01':
from .v2021_04_01.operations import DataCollectionRuleAssociationsOperations as OperationClass
elif api_version == '2021-09-01-preview':
from .v2022_02_01_preview.operations import DataCollectionRuleAssociationsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_collection_rule_associations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -398,12 +405,15 @@ def data_collection_rules(self):
* 2019-11-01-preview: :class:`DataCollectionRulesOperations<azure.mgmt.monitor.v2019_11_01_preview.operations.DataCollectionRulesOperations>`
* 2021-04-01: :class:`DataCollectionRulesOperations<azure.mgmt.monitor.v2021_04_01.operations.DataCollectionRulesOperations>`
* 2021-09-01-preview: :class:`DataCollectionRulesOperations<azure.mgmt.monitor.v2022_02_01_preview.operations.DataCollectionRulesOperations>`
"""
api_version = self._get_api_version('data_collection_rules')
if api_version == '2019-11-01-preview':
from .v2019_11_01_preview.operations import DataCollectionRulesOperations as OperationClass
elif api_version == '2021-04-01':
from .v2021_04_01.operations import DataCollectionRulesOperations as OperationClass
elif api_version == '2021-09-01-preview':
from .v2022_02_01_preview.operations import DataCollectionRulesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_collection_rules'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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 ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy

from .._version import VERSION

Expand Down Expand Up @@ -64,4 +64,4 @@ def _configure(
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)
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from typing import Any, Optional, TYPE_CHECKING

from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
Expand All @@ -21,6 +20,7 @@

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
from azure.core.credentials_async import AsyncTokenCredential

class _SDKClient(object):
Expand Down Expand Up @@ -103,12 +103,10 @@ def __init__(
credential: "AsyncTokenCredential",
subscription_id: str,
api_version: Optional[str] = None,
base_url: Optional[str] = None,
base_url: str = "https://management.azure.com",
profile: KnownProfiles = KnownProfiles.default,
**kwargs # type: Any
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(MonitorManagementClient, self).__init__(
Expand Down Expand Up @@ -149,6 +147,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2021-04-01: :mod:`v2021_04_01.models<azure.mgmt.monitor.v2021_04_01.models>`
* 2021-05-01-preview: :mod:`v2021_05_01_preview.models<azure.mgmt.monitor.v2021_05_01_preview.models>`
* 2021-09-01: :mod:`v2021_09_01.models<azure.mgmt.monitor.v2021_09_01.models>`
* 2021-09-01-preview: :mod:`v2022_02_01_preview.models<azure.mgmt.monitor.v2022_02_01_preview.models>`
"""
if api_version == '2015-04-01':
from ..v2015_04_01 import models
Expand Down Expand Up @@ -225,6 +224,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2021-09-01':
from ..v2021_09_01 import models
return models
elif api_version == '2021-09-01-preview':
from ..v2022_02_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
Expand Down Expand Up @@ -366,10 +368,13 @@ def data_collection_endpoints(self):
"""Instance depends on the API version:
* 2021-04-01: :class:`DataCollectionEndpointsOperations<azure.mgmt.monitor.v2021_04_01.aio.operations.DataCollectionEndpointsOperations>`
* 2021-09-01-preview: :class:`DataCollectionEndpointsOperations<azure.mgmt.monitor.v2022_02_01_preview.aio.operations.DataCollectionEndpointsOperations>`
"""
api_version = self._get_api_version('data_collection_endpoints')
if api_version == '2021-04-01':
from ..v2021_04_01.aio.operations import DataCollectionEndpointsOperations as OperationClass
elif api_version == '2021-09-01-preview':
from ..v2022_02_01_preview.aio.operations import DataCollectionEndpointsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_collection_endpoints'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -380,12 +385,15 @@ def data_collection_rule_associations(self):
* 2019-11-01-preview: :class:`DataCollectionRuleAssociationsOperations<azure.mgmt.monitor.v2019_11_01_preview.aio.operations.DataCollectionRuleAssociationsOperations>`
* 2021-04-01: :class:`DataCollectionRuleAssociationsOperations<azure.mgmt.monitor.v2021_04_01.aio.operations.DataCollectionRuleAssociationsOperations>`
* 2021-09-01-preview: :class:`DataCollectionRuleAssociationsOperations<azure.mgmt.monitor.v2022_02_01_preview.aio.operations.DataCollectionRuleAssociationsOperations>`
"""
api_version = self._get_api_version('data_collection_rule_associations')
if api_version == '2019-11-01-preview':
from ..v2019_11_01_preview.aio.operations import DataCollectionRuleAssociationsOperations as OperationClass
elif api_version == '2021-04-01':
from ..v2021_04_01.aio.operations import DataCollectionRuleAssociationsOperations as OperationClass
elif api_version == '2021-09-01-preview':
from ..v2022_02_01_preview.aio.operations import DataCollectionRuleAssociationsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_collection_rule_associations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -396,12 +404,15 @@ def data_collection_rules(self):
* 2019-11-01-preview: :class:`DataCollectionRulesOperations<azure.mgmt.monitor.v2019_11_01_preview.aio.operations.DataCollectionRulesOperations>`
* 2021-04-01: :class:`DataCollectionRulesOperations<azure.mgmt.monitor.v2021_04_01.aio.operations.DataCollectionRulesOperations>`
* 2021-09-01-preview: :class:`DataCollectionRulesOperations<azure.mgmt.monitor.v2022_02_01_preview.aio.operations.DataCollectionRulesOperations>`
"""
api_version = self._get_api_version('data_collection_rules')
if api_version == '2019-11-01-preview':
from ..v2019_11_01_preview.aio.operations import DataCollectionRulesOperations as OperationClass
elif api_version == '2021-04-01':
from ..v2021_04_01.aio.operations import DataCollectionRulesOperations as OperationClass
elif api_version == '2021-09-01-preview':
from ..v2022_02_01_preview.aio.operations import DataCollectionRulesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_collection_rules'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
__version__ = VERSION
__all__ = ['MonitorManagementClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,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


Expand All @@ -35,16 +33,15 @@ class MonitorManagementClientConfiguration(Configuration):

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
super(MonitorManagementClientConfiguration, self).__init__(**kwargs)
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(MonitorManagementClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
Expand All @@ -67,4 +64,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)
Loading

0 comments on commit e69627d

Please sign in to comment.