diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/_meta.json b/sdk/dynatrace/azure-mgmt-dynatrace/_meta.json index 2ac86be63aa6..973d9d5c1a85 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/_meta.json +++ b/sdk/dynatrace/azure-mgmt-dynatrace/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "11830d3ce01db4f39a41dc37a86075b125c87fdc", + "commit": "ed2c4344050c9ab02f0f3e0dba5c76c706996e8a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/dynatrace/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/dynatrace/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/dynatrace/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py index ad16de1b3395..1a81a1a8653a 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['DynatraceObservability'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._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() +_patch_sdk() diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py index 21c0c63a167f..5ae1b5d766e5 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py @@ -60,10 +60,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on = SingleSignOnOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.tag_rules = TagRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.single_sign_on = SingleSignOnOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json deleted file mode 100644 index 4d59dd1fd4d2..000000000000 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "chosen_version": "2021-09-01-preview", - "total_api_version_list": ["2021-09-01-preview"], - "client": { - "name": "DynatraceObservability", - "filename": "_dynatrace_observability", - "description": "DynatraceObservability.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DynatraceObservabilityConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DynatraceObservabilityConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "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 - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "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": { - "monitors": "MonitorsOperations", - "operations": "Operations", - "tag_rules": "TagRulesOperations", - "single_sign_on": "SingleSignOnOperations" - } -} \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py index 88d055335ba5..30aed9a2e7fe 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._dynatrace_observability import DynatraceObservability + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['DynatraceObservability'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._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() +_patch_sdk() diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py index 9b9b13f386d9..a9ca29c91c5c 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py @@ -60,10 +60,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on = SingleSignOnOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.tag_rules = TagRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.single_sign_on = SingleSignOnOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py index 8fbbc8d96450..188f24c6fe8d 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py @@ -11,9 +11,14 @@ from ._tag_rules_operations import TagRulesOperations from ._single_sign_on_operations import SingleSignOnOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'MonitorsOperations', 'Operations', 'TagRulesOperations', 'SingleSignOnOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py index 068a5c1ae748..a59d9a816f33 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py @@ -6,7 +6,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MonitorsOperations: - """MonitorsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.aio.DynatraceObservability`'s + :attr:`monitors` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_account_credentials( @@ -53,7 +52,7 @@ async def get_account_credentials( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.AccountInfoSecure": + ) -> _models.AccountInfoSecure: """Gets the user account credentials for a Monitor. Gets the user account credentials for a Monitor. @@ -67,13 +66,16 @@ async def get_account_credentials( :rtype: ~azure.mgmt.dynatrace.models.AccountInfoSecure :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountInfoSecure"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AccountInfoSecure] request = build_get_account_credentials_request( @@ -82,11 +84,13 @@ async def get_account_credentials( monitor_name=monitor_name, api_version=api_version, template_url=self.get_account_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,7 +118,7 @@ def list_monitored_resources( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MonitoredResourceListResponse"]: + ) -> AsyncIterable[_models.MonitoredResourceListResponse]: """List the resources currently being monitored by the Dynatrace monitor resource. List the resources currently being monitored by the Dynatrace monitor resource. @@ -130,13 +134,16 @@ def list_monitored_resources( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.MonitoredResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitoredResourceListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -146,9 +153,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list_monitored_resources.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -200,7 +211,7 @@ async def get_vm_host_payload( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.VMExtensionPayload": + ) -> _models.VMExtensionPayload: """Returns the payload that needs to be passed in the request body for installing Dynatrace agent on a VM. @@ -216,13 +227,16 @@ async def get_vm_host_payload( :rtype: ~azure.mgmt.dynatrace.models.VMExtensionPayload :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VMExtensionPayload"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VMExtensionPayload] request = build_get_vm_host_payload_request( @@ -231,11 +245,13 @@ async def get_vm_host_payload( monitor_name=monitor_name, api_version=api_version, template_url=self.get_vm_host_payload.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,7 +279,7 @@ async def get( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.MonitorResource": + ) -> _models.MonitorResource: """Get a MonitorResource. Get a MonitorResource. @@ -277,13 +293,16 @@ async def get( :rtype: ~azure.mgmt.dynatrace.models.MonitorResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] request = build_get_request( @@ -292,11 +311,13 @@ async def get( monitor_name=monitor_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -322,17 +343,20 @@ async def _create_or_update_initial( self, resource_group_name: str, monitor_name: str, - resource: "_models.MonitorResource", + resource: _models.MonitorResource, **kwargs: Any - ) -> "_models.MonitorResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + ) -> _models.MonitorResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] _json = self._serialize.body(resource, 'MonitorResource') @@ -344,11 +368,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -378,9 +404,9 @@ async def begin_create_or_update( self, resource_group_name: str, monitor_name: str, - resource: "_models.MonitorResource", + resource: _models.MonitorResource, **kwargs: Any - ) -> AsyncLROPoller["_models.MonitorResource"]: + ) -> AsyncLROPoller[_models.MonitorResource]: """Create a MonitorResource. Create a MonitorResource. @@ -404,37 +430,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dynatrace.models.MonitorResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, resource=resource, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitorResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -452,9 +488,9 @@ async def update( self, resource_group_name: str, monitor_name: str, - resource: "_models.MonitorResourceUpdate", + resource: _models.MonitorResourceUpdate, **kwargs: Any - ) -> "_models.MonitorResource": + ) -> _models.MonitorResource: """Update a MonitorResource. Update a MonitorResource. @@ -470,14 +506,17 @@ async def update( :rtype: ~azure.mgmt.dynatrace.models.MonitorResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] _json = self._serialize.body(resource, 'MonitorResourceUpdate') @@ -489,11 +528,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,13 +562,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements monitor_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -536,11 +580,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements monitor_name=monitor_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -584,20 +630,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -607,8 +658,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -625,7 +682,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription_id( self, **kwargs: Any - ) -> AsyncIterable["_models.MonitorResourceListResult"]: + ) -> AsyncIterable[_models.MonitorResourceListResult]: """List all MonitorResource by subscriptionId. List all MonitorResource by subscriptionId. @@ -637,13 +694,16 @@ def list_by_subscription_id( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -651,9 +711,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -661,9 +723,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -702,7 +766,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MonitorResourceListResult"]: + ) -> AsyncIterable[_models.MonitorResourceListResult]: """List MonitorResource resources by resource group. List MonitorResource resources by resource group. @@ -716,13 +780,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -731,9 +798,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -742,9 +811,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -784,7 +855,7 @@ def list_hosts( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VMHostsListResponse"]: + ) -> AsyncIterable[_models.VMHostsListResponse]: """List the compute resources currently being monitored by the Dynatrace resource. List the compute resources currently being monitored by the Dynatrace resource. @@ -799,13 +870,16 @@ def list_hosts( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.VMHostsListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VMHostsListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VMHostsListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -815,9 +889,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list_hosts.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -827,9 +903,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -869,7 +947,7 @@ def list_app_services( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AppServiceListResponse"]: + ) -> AsyncIterable[_models.AppServiceListResponse]: """Gets list of App Services with Dynatrace PaaS OneAgent enabled. Gets list of App Services with Dynatrace PaaS OneAgent enabled. @@ -885,13 +963,16 @@ def list_app_services( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.AppServiceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AppServiceListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppServiceListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -901,9 +982,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list_app_services.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -913,9 +996,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -954,9 +1039,9 @@ async def get_sso_details( self, resource_group_name: str, monitor_name: str, - request: Optional["_models.SSODetailsRequest"] = None, + request: Optional[_models.SSODetailsRequest] = None, **kwargs: Any - ) -> "_models.SSODetailsResponse": + ) -> _models.SSODetailsResponse: """Gets the SSO configuration details from the partner. Gets the SSO configuration details from the partner. @@ -972,14 +1057,17 @@ async def get_sso_details( :rtype: ~azure.mgmt.dynatrace.models.SSODetailsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SSODetailsResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SSODetailsResponse] if request is not None: _json = self._serialize.body(request, 'SSODetailsRequest') @@ -994,11 +1082,13 @@ async def get_sso_details( content_type=content_type, json=_json, template_url=self.get_sso_details.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1025,9 +1115,9 @@ def list_linkable_environments( self, resource_group_name: str, monitor_name: str, - request: "_models.LinkableEnvironmentRequest", + request: _models.LinkableEnvironmentRequest, **kwargs: Any - ) -> AsyncIterable["_models.LinkableEnvironmentListResponse"]: + ) -> AsyncIterable[_models.LinkableEnvironmentListResponse]: """Gets all the Dynatrace environments that a user can link a azure resource to. Gets all the Dynatrace environments that a user can link a azure resource to. @@ -1045,14 +1135,17 @@ def list_linkable_environments( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.LinkableEnvironmentListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkableEnvironmentListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkableEnvironmentListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: _json = self._serialize.body(request, 'LinkableEnvironmentRequest') @@ -1065,9 +1158,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, template_url=self.list_linkable_environments.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: _json = self._serialize.body(request, 'LinkableEnvironmentRequest') @@ -1080,9 +1175,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py index 49b4dade1bbe..c7e534d42a6b 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.aio.DynatraceObservability`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """List the operations for Dynatrace.Observability. List the operations for Dynatrace.Observability. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_patch.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# 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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py index 77defc5d9d61..456d55448742 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py @@ -6,7 +6,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,43 +27,44 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SingleSignOnOperations: - """SingleSignOnOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.aio.DynatraceObservability`'s + :attr:`single_sign_on` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, monitor_name: str, configuration_name: str, - resource: "_models.DynatraceSingleSignOnResource", + resource: _models.DynatraceSingleSignOnResource, **kwargs: Any - ) -> "_models.DynatraceSingleSignOnResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + ) -> _models.DynatraceSingleSignOnResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResource] _json = self._serialize.body(resource, 'DynatraceSingleSignOnResource') @@ -75,11 +77,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -110,9 +114,9 @@ async def begin_create_or_update( resource_group_name: str, monitor_name: str, configuration_name: str, - resource: "_models.DynatraceSingleSignOnResource", + resource: _models.DynatraceSingleSignOnResource, **kwargs: Any - ) -> AsyncLROPoller["_models.DynatraceSingleSignOnResource"]: + ) -> AsyncLROPoller[_models.DynatraceSingleSignOnResource]: """Create a DynatraceSingleSignOnResource. Create a DynatraceSingleSignOnResource. @@ -139,17 +143,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, @@ -157,20 +164,27 @@ async def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -190,7 +204,7 @@ async def get( monitor_name: str, configuration_name: str, **kwargs: Any - ) -> "_models.DynatraceSingleSignOnResource": + ) -> _models.DynatraceSingleSignOnResource: """Get a DynatraceSingleSignOnResource. Get a DynatraceSingleSignOnResource. @@ -206,13 +220,16 @@ async def get( :rtype: ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResource] request = build_get_request( @@ -222,11 +239,13 @@ async def get( configuration_name=configuration_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -254,7 +273,7 @@ def list( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DynatraceSingleSignOnResourceListResult"]: + ) -> AsyncIterable[_models.DynatraceSingleSignOnResourceListResult]: """List all DynatraceSingleSignOnResource by monitorName. List all DynatraceSingleSignOnResource by monitorName. @@ -270,13 +289,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -286,9 +308,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -298,9 +322,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py index 13641a350556..afd4d213c258 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py @@ -6,7 +6,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class TagRulesOperations: - """TagRulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.aio.DynatraceObservability`'s + :attr:`tag_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -54,7 +53,7 @@ async def get( monitor_name: str, rule_set_name: str, **kwargs: Any - ) -> "_models.TagRule": + ) -> _models.TagRule: """Get a TagRule. Get a TagRule. @@ -70,13 +69,16 @@ async def get( :rtype: ~azure.mgmt.dynatrace.models.TagRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] request = build_get_request( @@ -86,11 +88,13 @@ async def get( rule_set_name=rule_set_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -117,17 +121,20 @@ async def _create_or_update_initial( resource_group_name: str, monitor_name: str, rule_set_name: str, - resource: "_models.TagRule", + resource: _models.TagRule, **kwargs: Any - ) -> "_models.TagRule": - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + ) -> _models.TagRule: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] _json = self._serialize.body(resource, 'TagRule') @@ -140,11 +147,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -175,9 +184,9 @@ async def begin_create_or_update( resource_group_name: str, monitor_name: str, rule_set_name: str, - resource: "_models.TagRule", + resource: _models.TagRule, **kwargs: Any - ) -> AsyncLROPoller["_models.TagRule"]: + ) -> AsyncLROPoller[_models.TagRule]: """Create a TagRule. Create a TagRule. @@ -203,17 +212,20 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dynatrace.models.TagRule] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, @@ -221,20 +233,27 @@ async def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('TagRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -253,9 +272,9 @@ async def update( resource_group_name: str, monitor_name: str, rule_set_name: str, - resource: "_models.TagRuleUpdate", + resource: _models.TagRuleUpdate, **kwargs: Any - ) -> "_models.TagRule": + ) -> _models.TagRule: """Update a TagRule. Update a TagRule. @@ -273,14 +292,17 @@ async def update( :rtype: ~azure.mgmt.dynatrace.models.TagRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] _json = self._serialize.body(resource, 'TagRuleUpdate') @@ -293,11 +315,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -326,13 +350,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements rule_set_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -342,11 +369,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements rule_set_name=rule_set_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -393,21 +422,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -417,8 +451,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -437,7 +477,7 @@ def list( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TagRuleListResult"]: + ) -> AsyncIterable[_models.TagRuleListResult]: """List all TagRule by monitorName. List all TagRule by monitorName. @@ -451,13 +491,16 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.TagRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRuleListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -467,9 +510,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -479,9 +524,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py index 32a7f2f7e73e..933ef48292e9 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py @@ -73,7 +73,9 @@ TagAction, UpdateStatus, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccountInfo', 'AccountInfoSecure', @@ -139,3 +141,5 @@ 'TagAction', 'UpdateStatus', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py index 002ece5008f2..2d39097fadee 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py @@ -7,24 +7,23 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class AutoUpdateSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AutoUpdateSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Update settings of OneAgent. """ ENABLED = "ENABLED" DISABLED = "DISABLED" -class AvailabilityState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AvailabilityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The availability state of OneAgent. """ @@ -37,7 +36,7 @@ class AvailabilityState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNKNOWN = "UNKNOWN" UNMONITORED = "UNMONITORED" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -46,21 +45,21 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LiftrResourceCategories(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LiftrResourceCategories(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Liftr resource category """ UNKNOWN = "Unknown" MONITOR_LOGS = "MonitorLogs" -class LogModule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LogModule(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether log modules are enabled or not """ ENABLED = "ENABLED" DISABLED = "DISABLED" -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of managed identity assigned to this resource. """ @@ -68,7 +67,7 @@ class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_AND_USER_ASSIGNED = "SystemAndUserAssigned" -class MarketplaceSubscriptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MarketplaceSubscriptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. """ @@ -76,21 +75,21 @@ class MarketplaceSubscriptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, ACTIVE = "Active" SUSPENDED = "Suspended" -class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Flag specifying if the resource monitoring is enabled or disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class MonitoringType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The monitoring mode of OneAgent """ CLOUD_INFRASTRUCTURE = "CLOUD_INFRASTRUCTURE" FULL_STACK = "FULL_STACK" -class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" """ @@ -99,7 +98,7 @@ class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" USER_SYSTEM = "user,system" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the monitoring resource """ @@ -113,42 +112,42 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" NOT_SPECIFIED = "NotSpecified" -class SendAadLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SendAadLogsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether AAD logs are being sent. """ ENABLED = "Enabled" DISABLED = "Disabled" -class SendActivityLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SendActivityLogsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether activity logs are being sent. """ ENABLED = "Enabled" DISABLED = "Disabled" -class SendingLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SendingLogsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether logs are being sent. """ ENABLED = "Enabled" DISABLED = "Disabled" -class SendingMetricsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SendingMetricsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether metrics are being sent. """ ENABLED = "Enabled" DISABLED = "Disabled" -class SendSubscriptionLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SendSubscriptionLogsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether subscription logs are being sent. """ ENABLED = "Enabled" DISABLED = "Disabled" -class SingleSignOnStates(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SingleSignOnStates(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Various states of the SSO resource """ @@ -157,21 +156,21 @@ class SingleSignOnStates(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DISABLE = "Disable" EXISTING = "Existing" -class SSOStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SSOStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether SSO is enabled or not """ ENABLED = "Enabled" DISABLED = "Disabled" -class TagAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TagAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Valid actions for a filtering tag. Exclusion takes priority over inclusion. """ INCLUDE = "Include" EXCLUDE = "Exclude" -class UpdateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current update status of OneAgent. """ diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py index 9f3d93f14fc6..63036707e127 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._dynatrace_observability_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccountInfo(msrest.serialization.Model): @@ -91,22 +93,22 @@ class AppServiceInfo(msrest.serialization.Model): :vartype resource_id: str :ivar version: Version of the Dynatrace agent installed on the App Service. :vartype version: str - :ivar monitoring_type: The monitoring mode of OneAgent. Possible values include: + :ivar monitoring_type: The monitoring mode of OneAgent. Known values are: "CLOUD_INFRASTRUCTURE", "FULL_STACK". :vartype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType - :ivar auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + :ivar auto_update_setting: Update settings of OneAgent. Known values are: "ENABLED", "DISABLED". :vartype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting - :ivar update_status: The current update status of OneAgent. Possible values include: - "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", - "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". + :ivar update_status: The current update status of OneAgent. Known values are: "INCOMPATIBLE", + "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", "UPDATE_IN_PROGRESS", + "UPDATE_PENDING", "UPDATE_PROBLEM". :vartype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus - :ivar availability_state: The availability state of OneAgent. Possible values include: - "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + :ivar availability_state: The availability state of OneAgent. Known values are: "CRASHED", + "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", "UNMONITORED". :vartype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState - :ivar log_module: Tells whether log modules are enabled or not. Possible values include: - "ENABLED", "DISABLED". + :ivar log_module: Tells whether log modules are enabled or not. Known values are: "ENABLED", + "DISABLED". :vartype log_module: str or ~azure.mgmt.dynatrace.models.LogModule :ivar host_group: The name of the host group. :vartype host_group: str @@ -131,11 +133,11 @@ def __init__( *, resource_id: Optional[str] = None, version: Optional[str] = None, - monitoring_type: Optional[Union[str, "MonitoringType"]] = None, - auto_update_setting: Optional[Union[str, "AutoUpdateSetting"]] = None, - update_status: Optional[Union[str, "UpdateStatus"]] = None, - availability_state: Optional[Union[str, "AvailabilityState"]] = None, - log_module: Optional[Union[str, "LogModule"]] = None, + monitoring_type: Optional[Union[str, "_models.MonitoringType"]] = None, + auto_update_setting: Optional[Union[str, "_models.AutoUpdateSetting"]] = None, + update_status: Optional[Union[str, "_models.UpdateStatus"]] = None, + availability_state: Optional[Union[str, "_models.AvailabilityState"]] = None, + log_module: Optional[Union[str, "_models.LogModule"]] = None, host_group: Optional[str] = None, host_name: Optional[str] = None, **kwargs @@ -145,22 +147,22 @@ def __init__( :paramtype resource_id: str :keyword version: Version of the Dynatrace agent installed on the App Service. :paramtype version: str - :keyword monitoring_type: The monitoring mode of OneAgent. Possible values include: + :keyword monitoring_type: The monitoring mode of OneAgent. Known values are: "CLOUD_INFRASTRUCTURE", "FULL_STACK". :paramtype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType - :keyword auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + :keyword auto_update_setting: Update settings of OneAgent. Known values are: "ENABLED", "DISABLED". :paramtype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting - :keyword update_status: The current update status of OneAgent. Possible values include: + :keyword update_status: The current update status of OneAgent. Known values are: "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". :paramtype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus - :keyword availability_state: The availability state of OneAgent. Possible values include: - "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + :keyword availability_state: The availability state of OneAgent. Known values are: "CRASHED", + "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", "UNMONITORED". :paramtype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState - :keyword log_module: Tells whether log modules are enabled or not. Possible values include: - "ENABLED", "DISABLED". + :keyword log_module: Tells whether log modules are enabled or not. Known values are: "ENABLED", + "DISABLED". :paramtype log_module: str or ~azure.mgmt.dynatrace.models.LogModule :keyword host_group: The name of the host group. :paramtype host_group: str @@ -203,7 +205,7 @@ class AppServiceListResponse(msrest.serialization.Model): def __init__( self, *, - value: List["AppServiceInfo"], + value: List["_models.AppServiceInfo"], next_link: str, **kwargs ): @@ -243,9 +245,9 @@ def __init__( self, *, user_id: Optional[str] = None, - account_info: Optional["AccountInfo"] = None, - environment_info: Optional["EnvironmentInfo"] = None, - single_sign_on_properties: Optional["DynatraceSingleSignOnProperties"] = None, + account_info: Optional["_models.AccountInfo"] = None, + environment_info: Optional["_models.EnvironmentInfo"] = None, + single_sign_on_properties: Optional["_models.DynatraceSingleSignOnProperties"] = None, **kwargs ): """ @@ -271,8 +273,8 @@ class DynatraceSingleSignOnProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar single_sign_on_state: State of Single Sign On. Possible values include: "Initial", - "Enable", "Disable", "Existing". + :ivar single_sign_on_state: State of Single Sign On. Known values are: "Initial", "Enable", + "Disable", "Existing". :vartype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates :ivar enterprise_app_id: Version of the Dynatrace agent installed on the VM. :vartype enterprise_app_id: str @@ -280,8 +282,8 @@ class DynatraceSingleSignOnProperties(msrest.serialization.Model): :vartype single_sign_on_url: str :ivar aad_domains: array of Aad(azure active directory) domains. :vartype aad_domains: list[str] - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState """ @@ -301,15 +303,15 @@ class DynatraceSingleSignOnProperties(msrest.serialization.Model): def __init__( self, *, - single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, + single_sign_on_state: Optional[Union[str, "_models.SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, single_sign_on_url: Optional[str] = None, aad_domains: Optional[List[str]] = None, **kwargs ): """ - :keyword single_sign_on_state: State of Single Sign On. Possible values include: "Initial", - "Enable", "Disable", "Existing". + :keyword single_sign_on_state: State of Single Sign On. Known values are: "Initial", "Enable", + "Disable", "Existing". :paramtype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates :keyword enterprise_app_id: Version of the Dynatrace agent installed on the VM. :paramtype enterprise_app_id: str @@ -416,8 +418,8 @@ class DynatraceSingleSignOnResource(ProxyResource): :vartype type: str :ivar system_data: System metadata for this resource. :vartype system_data: ~azure.mgmt.dynatrace.models.SystemData - :ivar single_sign_on_state: State of Single Sign On. Possible values include: "Initial", - "Enable", "Disable", "Existing". + :ivar single_sign_on_state: State of Single Sign On. Known values are: "Initial", "Enable", + "Disable", "Existing". :vartype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates :ivar enterprise_app_id: Version of the Dynatrace agent installed on the VM. :vartype enterprise_app_id: str @@ -425,8 +427,8 @@ class DynatraceSingleSignOnResource(ProxyResource): :vartype single_sign_on_url: str :ivar aad_domains: array of Aad(azure active directory) domains. :vartype aad_domains: list[str] - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState """ @@ -454,15 +456,15 @@ class DynatraceSingleSignOnResource(ProxyResource): def __init__( self, *, - single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, + single_sign_on_state: Optional[Union[str, "_models.SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, single_sign_on_url: Optional[str] = None, aad_domains: Optional[List[str]] = None, **kwargs ): """ - :keyword single_sign_on_state: State of Single Sign On. Possible values include: "Initial", - "Enable", "Disable", "Existing". + :keyword single_sign_on_state: State of Single Sign On. Known values are: "Initial", "Enable", + "Disable", "Existing". :paramtype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates :keyword enterprise_app_id: Version of the Dynatrace agent installed on the VM. :paramtype enterprise_app_id: str @@ -504,7 +506,7 @@ class DynatraceSingleSignOnResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: List["DynatraceSingleSignOnResource"], + value: List["_models.DynatraceSingleSignOnResource"], next_link: str, **kwargs ): @@ -658,7 +660,7 @@ class ErrorResponse(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorDetail"] = None, + error: Optional["_models.ErrorDetail"] = None, **kwargs ): """ @@ -676,8 +678,8 @@ class FilteringTag(msrest.serialization.Model): :vartype name: str :ivar value: The value of the tag. :vartype value: str - :ivar action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. - Possible values include: "Include", "Exclude". + :ivar action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. Known + values are: "Include", "Exclude". :vartype action: str or ~azure.mgmt.dynatrace.models.TagAction """ @@ -692,7 +694,7 @@ def __init__( *, name: Optional[str] = None, value: Optional[str] = None, - action: Optional[Union[str, "TagAction"]] = None, + action: Optional[Union[str, "_models.TagAction"]] = None, **kwargs ): """ @@ -701,7 +703,7 @@ def __init__( :keyword value: The value of the tag. :paramtype value: str :keyword action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. - Possible values include: "Include", "Exclude". + Known values are: "Include", "Exclude". :paramtype action: str or ~azure.mgmt.dynatrace.models.TagAction """ super(FilteringTag, self).__init__(**kwargs) @@ -721,8 +723,8 @@ class IdentityProperties(msrest.serialization.Model): :vartype tenant_id: str :ivar principal_id: The active directory identifier of this principal. :vartype principal_id: str - :ivar type: Required. The type of managed identity assigned to this resource. Possible values - include: "SystemAssigned", "UserAssigned", "SystemAndUserAssigned". + :ivar type: Required. The type of managed identity assigned to this resource. Known values are: + "SystemAssigned", "UserAssigned", "SystemAndUserAssigned". :vartype type: str or ~azure.mgmt.dynatrace.models.ManagedIdentityType :ivar user_assigned_identities: The identities assigned to this resource by the user. :vartype user_assigned_identities: dict[str, ~azure.mgmt.dynatrace.models.UserAssignedIdentity] @@ -744,13 +746,13 @@ class IdentityProperties(msrest.serialization.Model): def __init__( self, *, - type: Union[str, "ManagedIdentityType"], - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Union[str, "_models.ManagedIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): """ - :keyword type: Required. The type of managed identity assigned to this resource. Possible - values include: "SystemAssigned", "UserAssigned", "SystemAndUserAssigned". + :keyword type: Required. The type of managed identity assigned to this resource. Known values + are: "SystemAssigned", "UserAssigned", "SystemAndUserAssigned". :paramtype type: str or ~azure.mgmt.dynatrace.models.ManagedIdentityType :keyword user_assigned_identities: The identities assigned to this resource by the user. :paramtype user_assigned_identities: dict[str, @@ -780,7 +782,7 @@ class LinkableEnvironmentListResponse(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["LinkableEnvironmentResponse"]] = None, + value: Optional[List["_models.LinkableEnvironmentResponse"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -856,7 +858,7 @@ def __init__( *, environment_id: Optional[str] = None, environment_name: Optional[str] = None, - plan_data: Optional["PlanData"] = None, + plan_data: Optional["_models.PlanData"] = None, **kwargs ): """ @@ -876,14 +878,14 @@ def __init__( class LogRules(msrest.serialization.Model): """Set of rules for sending logs for the Monitor resource. - :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - Possible values include: "Enabled", "Disabled". + :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. Known + values are: "Enabled", "Disabled". :vartype send_aad_logs: str or ~azure.mgmt.dynatrace.models.SendAadLogsStatus :ivar send_subscription_logs: Flag specifying if subscription logs should be sent for the - Monitor resource. Possible values include: "Enabled", "Disabled". + Monitor resource. Known values are: "Enabled", "Disabled". :vartype send_subscription_logs: str or ~azure.mgmt.dynatrace.models.SendSubscriptionLogsStatus :ivar send_activity_logs: Flag specifying if activity logs from Azure resources should be sent - for the Monitor resource. Possible values include: "Enabled", "Disabled". + for the Monitor resource. Known values are: "Enabled", "Disabled". :vartype send_activity_logs: str or ~azure.mgmt.dynatrace.models.SendActivityLogsStatus :ivar filtering_tags: List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. @@ -903,22 +905,22 @@ class LogRules(msrest.serialization.Model): def __init__( self, *, - send_aad_logs: Optional[Union[str, "SendAadLogsStatus"]] = None, - send_subscription_logs: Optional[Union[str, "SendSubscriptionLogsStatus"]] = None, - send_activity_logs: Optional[Union[str, "SendActivityLogsStatus"]] = None, - filtering_tags: Optional[List["FilteringTag"]] = None, + send_aad_logs: Optional[Union[str, "_models.SendAadLogsStatus"]] = None, + send_subscription_logs: Optional[Union[str, "_models.SendSubscriptionLogsStatus"]] = None, + send_activity_logs: Optional[Union[str, "_models.SendActivityLogsStatus"]] = None, + filtering_tags: Optional[List["_models.FilteringTag"]] = None, **kwargs ): """ :keyword send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - Possible values include: "Enabled", "Disabled". + Known values are: "Enabled", "Disabled". :paramtype send_aad_logs: str or ~azure.mgmt.dynatrace.models.SendAadLogsStatus :keyword send_subscription_logs: Flag specifying if subscription logs should be sent for the - Monitor resource. Possible values include: "Enabled", "Disabled". + Monitor resource. Known values are: "Enabled", "Disabled". :paramtype send_subscription_logs: str or ~azure.mgmt.dynatrace.models.SendSubscriptionLogsStatus :keyword send_activity_logs: Flag specifying if activity logs from Azure resources should be - sent for the Monitor resource. Possible values include: "Enabled", "Disabled". + sent for the Monitor resource. Known values are: "Enabled", "Disabled". :paramtype send_activity_logs: str or ~azure.mgmt.dynatrace.models.SendActivityLogsStatus :keyword filtering_tags: List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. @@ -951,7 +953,7 @@ class MetricRules(msrest.serialization.Model): def __init__( self, *, - filtering_tags: Optional[List["FilteringTag"]] = None, + filtering_tags: Optional[List["_models.FilteringTag"]] = None, **kwargs ): """ @@ -970,14 +972,14 @@ class MonitoredResource(msrest.serialization.Model): :ivar id: The ARM id of the resource. :vartype id: str - :ivar sending_metrics: Flag indicating if resource is sending metrics to Dynatrace. Possible - values include: "Enabled", "Disabled". + :ivar sending_metrics: Flag indicating if resource is sending metrics to Dynatrace. Known + values are: "Enabled", "Disabled". :vartype sending_metrics: str or ~azure.mgmt.dynatrace.models.SendingMetricsStatus :ivar reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is not sending). :vartype reason_for_metrics_status: str - :ivar sending_logs: Flag indicating if resource is sending logs to Dynatrace. Possible values - include: "Enabled", "Disabled". + :ivar sending_logs: Flag indicating if resource is sending logs to Dynatrace. Known values are: + "Enabled", "Disabled". :vartype sending_logs: str or ~azure.mgmt.dynatrace.models.SendingLogsStatus :ivar reason_for_logs_status: Reason for why the resource is sending logs (or why it is not sending). @@ -996,23 +998,23 @@ def __init__( self, *, id: Optional[str] = None, - sending_metrics: Optional[Union[str, "SendingMetricsStatus"]] = None, + sending_metrics: Optional[Union[str, "_models.SendingMetricsStatus"]] = None, reason_for_metrics_status: Optional[str] = None, - sending_logs: Optional[Union[str, "SendingLogsStatus"]] = None, + sending_logs: Optional[Union[str, "_models.SendingLogsStatus"]] = None, reason_for_logs_status: Optional[str] = None, **kwargs ): """ :keyword id: The ARM id of the resource. :paramtype id: str - :keyword sending_metrics: Flag indicating if resource is sending metrics to Dynatrace. Possible - values include: "Enabled", "Disabled". + :keyword sending_metrics: Flag indicating if resource is sending metrics to Dynatrace. Known + values are: "Enabled", "Disabled". :paramtype sending_metrics: str or ~azure.mgmt.dynatrace.models.SendingMetricsStatus :keyword reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is not sending). :paramtype reason_for_metrics_status: str - :keyword sending_logs: Flag indicating if resource is sending logs to Dynatrace. Possible - values include: "Enabled", "Disabled". + :keyword sending_logs: Flag indicating if resource is sending logs to Dynatrace. Known values + are: "Enabled", "Disabled". :paramtype sending_logs: str or ~azure.mgmt.dynatrace.models.SendingLogsStatus :keyword reason_for_logs_status: Reason for why the resource is sending logs (or why it is not sending). @@ -1050,7 +1052,7 @@ class MonitoredResourceListResponse(msrest.serialization.Model): def __init__( self, *, - value: List["MonitoredResource"], + value: List["_models.MonitoredResource"], next_link: str, **kwargs ): @@ -1142,10 +1144,10 @@ class MonitorResource(TrackedResource): :vartype system_data: ~azure.mgmt.dynatrace.models.SystemData :ivar identity: The managed service identities assigned to this resource. :vartype identity: ~azure.mgmt.dynatrace.models.IdentityProperties - :ivar monitoring_status: Status of the monitor. Possible values include: "Enabled", "Disabled". + :ivar monitoring_status: Status of the monitor. Known values are: "Enabled", "Disabled". :vartype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus - :ivar marketplace_subscription_status: Marketplace subscription status. Possible values - include: "Active", "Suspended". + :ivar marketplace_subscription_status: Marketplace subscription status. Known values are: + "Active", "Suspended". :vartype marketplace_subscription_status: str or ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus :ivar dynatrace_environment_properties: Properties of the Dynatrace environment. @@ -1155,13 +1157,13 @@ class MonitorResource(TrackedResource): :vartype user_info: ~azure.mgmt.dynatrace.models.UserInfo :ivar plan_data: Billing plan information. :vartype plan_data: ~azure.mgmt.dynatrace.models.PlanData - :ivar liftr_resource_category: Liftr Resource category. Possible values include: "Unknown", + :ivar liftr_resource_category: Liftr Resource category. Known values are: "Unknown", "MonitorLogs". :vartype liftr_resource_category: str or ~azure.mgmt.dynatrace.models.LiftrResourceCategories :ivar liftr_resource_preference: The priority of the resource. :vartype liftr_resource_preference: int - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState """ @@ -1200,12 +1202,12 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["IdentityProperties"] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, - dynatrace_environment_properties: Optional["DynatraceEnvironmentProperties"] = None, - user_info: Optional["UserInfo"] = None, - plan_data: Optional["PlanData"] = None, + identity: Optional["_models.IdentityProperties"] = None, + monitoring_status: Optional[Union[str, "_models.MonitoringStatus"]] = None, + marketplace_subscription_status: Optional[Union[str, "_models.MarketplaceSubscriptionStatus"]] = None, + dynatrace_environment_properties: Optional["_models.DynatraceEnvironmentProperties"] = None, + user_info: Optional["_models.UserInfo"] = None, + plan_data: Optional["_models.PlanData"] = None, **kwargs ): """ @@ -1215,11 +1217,10 @@ def __init__( :paramtype location: str :keyword identity: The managed service identities assigned to this resource. :paramtype identity: ~azure.mgmt.dynatrace.models.IdentityProperties - :keyword monitoring_status: Status of the monitor. Possible values include: "Enabled", - "Disabled". + :keyword monitoring_status: Status of the monitor. Known values are: "Enabled", "Disabled". :paramtype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus - :keyword marketplace_subscription_status: Marketplace subscription status. Possible values - include: "Active", "Suspended". + :keyword marketplace_subscription_status: Marketplace subscription status. Known values are: + "Active", "Suspended". :paramtype marketplace_subscription_status: str or ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus :keyword dynatrace_environment_properties: Properties of the Dynatrace environment. @@ -1267,7 +1268,7 @@ class MonitorResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: List["MonitorResource"], + value: List["_models.MonitorResource"], next_link: str, **kwargs ): @@ -1287,10 +1288,10 @@ class MonitorResourceUpdate(msrest.serialization.Model): :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] - :ivar monitoring_status: Status of the monitor. Possible values include: "Enabled", "Disabled". + :ivar monitoring_status: Status of the monitor. Known values are: "Enabled", "Disabled". :vartype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus - :ivar marketplace_subscription_status: Marketplace subscription status. Possible values - include: "Active", "Suspended". + :ivar marketplace_subscription_status: Marketplace subscription status. Known values are: + "Active", "Suspended". :vartype marketplace_subscription_status: str or ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus :ivar dynatrace_environment_properties: Properties of the Dynatrace environment. @@ -1315,21 +1316,20 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, - dynatrace_environment_properties: Optional["DynatraceEnvironmentProperties"] = None, - user_info: Optional["UserInfo"] = None, - plan_data: Optional["PlanData"] = None, + monitoring_status: Optional[Union[str, "_models.MonitoringStatus"]] = None, + marketplace_subscription_status: Optional[Union[str, "_models.MarketplaceSubscriptionStatus"]] = None, + dynatrace_environment_properties: Optional["_models.DynatraceEnvironmentProperties"] = None, + user_info: Optional["_models.UserInfo"] = None, + plan_data: Optional["_models.PlanData"] = None, **kwargs ): """ :keyword tags: A set of tags. Resource tags. :paramtype tags: dict[str, str] - :keyword monitoring_status: Status of the monitor. Possible values include: "Enabled", - "Disabled". + :keyword monitoring_status: Status of the monitor. Known values are: "Enabled", "Disabled". :paramtype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus - :keyword marketplace_subscription_status: Marketplace subscription status. Possible values - include: "Active", "Suspended". + :keyword marketplace_subscription_status: Marketplace subscription status. Known values are: + "Active", "Suspended". :paramtype marketplace_subscription_status: str or ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus :keyword dynatrace_environment_properties: Properties of the Dynatrace environment. @@ -1363,11 +1363,11 @@ class Operation(msrest.serialization.Model): :ivar display: Localized display information for this particular operation. :vartype display: ~azure.mgmt.dynatrace.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + "user,system". :vartype origin: str or ~azure.mgmt.dynatrace.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". + internal only APIs. Known values are: "Internal". :vartype action_type: str or ~azure.mgmt.dynatrace.models.ActionType """ @@ -1389,7 +1389,7 @@ class Operation(msrest.serialization.Model): def __init__( self, *, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, **kwargs ): """ @@ -1562,8 +1562,8 @@ def __init__( class SSODetailsResponse(msrest.serialization.Model): """SSO details from the Dynatrace partner. - :ivar is_sso_enabled: Whether the SSO is enabled for this resource or not. Possible values - include: "Enabled", "Disabled". + :ivar is_sso_enabled: Whether the SSO is enabled for this resource or not. Known values are: + "Enabled", "Disabled". :vartype is_sso_enabled: str or ~azure.mgmt.dynatrace.models.SSOStatus :ivar metadata_url: URL for Azure AD metadata. :vartype metadata_url: str @@ -1586,7 +1586,7 @@ class SSODetailsResponse(msrest.serialization.Model): def __init__( self, *, - is_sso_enabled: Optional[Union[str, "SSOStatus"]] = None, + is_sso_enabled: Optional[Union[str, "_models.SSOStatus"]] = None, metadata_url: Optional[str] = None, single_sign_on_url: Optional[str] = None, aad_domains: Optional[List[str]] = None, @@ -1594,8 +1594,8 @@ def __init__( **kwargs ): """ - :keyword is_sso_enabled: Whether the SSO is enabled for this resource or not. Possible values - include: "Enabled", "Disabled". + :keyword is_sso_enabled: Whether the SSO is enabled for this resource or not. Known values are: + "Enabled", "Disabled". :paramtype is_sso_enabled: str or ~azure.mgmt.dynatrace.models.SSOStatus :keyword metadata_url: URL for Azure AD metadata. :paramtype metadata_url: str @@ -1619,15 +1619,15 @@ class SystemData(msrest.serialization.Model): :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. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.dynatrace.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. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.dynatrace.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -1646,25 +1646,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = 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, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :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. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.dynatrace.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. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.dynatrace.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -1697,8 +1697,8 @@ class TagRule(ProxyResource): :vartype log_rules: ~azure.mgmt.dynatrace.models.LogRules :ivar metric_rules: Set of rules for sending metrics for the Monitor resource. :vartype metric_rules: ~azure.mgmt.dynatrace.models.MetricRules - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState """ @@ -1724,8 +1724,8 @@ class TagRule(ProxyResource): def __init__( self, *, - log_rules: Optional["LogRules"] = None, - metric_rules: Optional["MetricRules"] = None, + log_rules: Optional["_models.LogRules"] = None, + metric_rules: Optional["_models.MetricRules"] = None, **kwargs ): """ @@ -1765,7 +1765,7 @@ class TagRuleListResult(msrest.serialization.Model): def __init__( self, *, - value: List["TagRule"], + value: List["_models.TagRule"], next_link: str, **kwargs ): @@ -1797,8 +1797,8 @@ class TagRuleUpdate(msrest.serialization.Model): def __init__( self, *, - log_rules: Optional["LogRules"] = None, - metric_rules: Optional["MetricRules"] = None, + log_rules: Optional["_models.LogRules"] = None, + metric_rules: Optional["_models.MetricRules"] = None, **kwargs ): """ @@ -1968,7 +1968,7 @@ class VMHostsListResponse(msrest.serialization.Model): def __init__( self, *, - value: List["VMInfo"], + value: List["_models.VMInfo"], next_link: str, **kwargs ): @@ -1990,22 +1990,22 @@ class VMInfo(msrest.serialization.Model): :vartype resource_id: str :ivar version: Version of the Dynatrace agent installed on the VM. :vartype version: str - :ivar monitoring_type: The monitoring mode of OneAgent. Possible values include: + :ivar monitoring_type: The monitoring mode of OneAgent. Known values are: "CLOUD_INFRASTRUCTURE", "FULL_STACK". :vartype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType - :ivar auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + :ivar auto_update_setting: Update settings of OneAgent. Known values are: "ENABLED", "DISABLED". :vartype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting - :ivar update_status: The current update status of OneAgent. Possible values include: - "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", - "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". + :ivar update_status: The current update status of OneAgent. Known values are: "INCOMPATIBLE", + "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", "UPDATE_IN_PROGRESS", + "UPDATE_PENDING", "UPDATE_PROBLEM". :vartype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus - :ivar availability_state: The availability state of OneAgent. Possible values include: - "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + :ivar availability_state: The availability state of OneAgent. Known values are: "CRASHED", + "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", "UNMONITORED". :vartype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState - :ivar log_module: Tells whether log modules are enabled or not. Possible values include: - "ENABLED", "DISABLED". + :ivar log_module: Tells whether log modules are enabled or not. Known values are: "ENABLED", + "DISABLED". :vartype log_module: str or ~azure.mgmt.dynatrace.models.LogModule :ivar host_group: The name of the host group. :vartype host_group: str @@ -2030,11 +2030,11 @@ def __init__( *, resource_id: Optional[str] = None, version: Optional[str] = None, - monitoring_type: Optional[Union[str, "MonitoringType"]] = None, - auto_update_setting: Optional[Union[str, "AutoUpdateSetting"]] = None, - update_status: Optional[Union[str, "UpdateStatus"]] = None, - availability_state: Optional[Union[str, "AvailabilityState"]] = None, - log_module: Optional[Union[str, "LogModule"]] = None, + monitoring_type: Optional[Union[str, "_models.MonitoringType"]] = None, + auto_update_setting: Optional[Union[str, "_models.AutoUpdateSetting"]] = None, + update_status: Optional[Union[str, "_models.UpdateStatus"]] = None, + availability_state: Optional[Union[str, "_models.AvailabilityState"]] = None, + log_module: Optional[Union[str, "_models.LogModule"]] = None, host_group: Optional[str] = None, host_name: Optional[str] = None, **kwargs @@ -2044,22 +2044,22 @@ def __init__( :paramtype resource_id: str :keyword version: Version of the Dynatrace agent installed on the VM. :paramtype version: str - :keyword monitoring_type: The monitoring mode of OneAgent. Possible values include: + :keyword monitoring_type: The monitoring mode of OneAgent. Known values are: "CLOUD_INFRASTRUCTURE", "FULL_STACK". :paramtype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType - :keyword auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + :keyword auto_update_setting: Update settings of OneAgent. Known values are: "ENABLED", "DISABLED". :paramtype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting - :keyword update_status: The current update status of OneAgent. Possible values include: + :keyword update_status: The current update status of OneAgent. Known values are: "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". :paramtype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus - :keyword availability_state: The availability state of OneAgent. Possible values include: - "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + :keyword availability_state: The availability state of OneAgent. Known values are: "CRASHED", + "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", "UNMONITORED". :paramtype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState - :keyword log_module: Tells whether log modules are enabled or not. Possible values include: - "ENABLED", "DISABLED". + :keyword log_module: Tells whether log modules are enabled or not. Known values are: "ENABLED", + "DISABLED". :paramtype log_module: str or ~azure.mgmt.dynatrace.models.LogModule :keyword host_group: The name of the host group. :paramtype host_group: str diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_patch.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# 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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py index 8fbbc8d96450..188f24c6fe8d 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py @@ -11,9 +11,14 @@ from ._tag_rules_operations import TagRulesOperations from ._single_sign_on_operations import SingleSignOnOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'MonitorsOperations', 'Operations', 'TagRulesOperations', 'SingleSignOnOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py index 25a23c718a1b..f866d3986906 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py @@ -6,7 +6,7 @@ # 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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_get_account_credentials_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getAccountCredentials") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_get_account_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_monitored_resources_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listMonitoredResources") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_list_monitored_resources_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,9 +109,12 @@ def build_get_vm_host_payload_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getVMHostPayload") # pylint: disable=line-too-long path_format_arguments = { @@ -121,18 +126,16 @@ def build_get_vm_host_payload_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -143,9 +146,12 @@ def build_get_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -157,18 +163,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -178,14 +182,17 @@ def build_create_or_update_request_initial( resource_group_name: str, monitor_name: str, *, - json: JSONType = None, + json: Optional[_models.MonitorResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -222,14 +227,17 @@ def build_update_request( resource_group_name: str, monitor_name: str, *, - json: JSONType = None, + json: Optional[_models.MonitorResourceUpdate] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -241,20 +249,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -267,9 +273,12 @@ def build_delete_request_initial( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long path_format_arguments = { @@ -281,18 +290,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -301,9 +308,12 @@ def build_list_by_subscription_id_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors") path_format_arguments = { @@ -313,18 +323,16 @@ def build_list_by_subscription_id_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -334,9 +342,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -369,9 +378,12 @@ def build_list_hosts_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listHosts") # pylint: disable=line-too-long path_format_arguments = { @@ -383,18 +395,16 @@ def build_list_hosts_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -405,9 +415,12 @@ def build_list_app_services_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listAppServices") # pylint: disable=line-too-long path_format_arguments = { @@ -419,18 +432,16 @@ def build_list_app_services_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -440,14 +451,17 @@ def build_get_sso_details_request( resource_group_name: str, monitor_name: str, *, - json: JSONType = None, + json: Optional[_models.SSODetailsRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getSSODetails") # pylint: disable=line-too-long path_format_arguments = { @@ -459,20 +473,18 @@ def build_get_sso_details_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -484,14 +496,17 @@ def build_list_linkable_environments_request( resource_group_name: str, monitor_name: str, *, - json: JSONType = None, + json: Optional[_models.LinkableEnvironmentRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listLinkableEnvironments") # pylint: disable=line-too-long path_format_arguments = { @@ -503,46 +518,42 @@ def build_list_linkable_environments_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class MonitorsOperations(object): - """MonitorsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MonitorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.DynatraceObservability`'s + :attr:`monitors` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_account_credentials( @@ -550,7 +561,7 @@ def get_account_credentials( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.AccountInfoSecure": + ) -> _models.AccountInfoSecure: """Gets the user account credentials for a Monitor. Gets the user account credentials for a Monitor. @@ -564,13 +575,16 @@ def get_account_credentials( :rtype: ~azure.mgmt.dynatrace.models.AccountInfoSecure :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountInfoSecure"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AccountInfoSecure] request = build_get_account_credentials_request( @@ -579,11 +593,13 @@ def get_account_credentials( monitor_name=monitor_name, api_version=api_version, template_url=self.get_account_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -611,7 +627,7 @@ def list_monitored_resources( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Iterable["_models.MonitoredResourceListResponse"]: + ) -> Iterable[_models.MonitoredResourceListResponse]: """List the resources currently being monitored by the Dynatrace monitor resource. List the resources currently being monitored by the Dynatrace monitor resource. @@ -627,13 +643,16 @@ def list_monitored_resources( ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitoredResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitoredResourceListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -643,9 +662,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list_monitored_resources.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -655,9 +676,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -697,7 +720,7 @@ def get_vm_host_payload( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.VMExtensionPayload": + ) -> _models.VMExtensionPayload: """Returns the payload that needs to be passed in the request body for installing Dynatrace agent on a VM. @@ -713,13 +736,16 @@ def get_vm_host_payload( :rtype: ~azure.mgmt.dynatrace.models.VMExtensionPayload :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VMExtensionPayload"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VMExtensionPayload] request = build_get_vm_host_payload_request( @@ -728,11 +754,13 @@ def get_vm_host_payload( monitor_name=monitor_name, api_version=api_version, template_url=self.get_vm_host_payload.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -760,7 +788,7 @@ def get( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> "_models.MonitorResource": + ) -> _models.MonitorResource: """Get a MonitorResource. Get a MonitorResource. @@ -774,13 +802,16 @@ def get( :rtype: ~azure.mgmt.dynatrace.models.MonitorResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] request = build_get_request( @@ -789,11 +820,13 @@ def get( monitor_name=monitor_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -819,17 +852,20 @@ def _create_or_update_initial( self, resource_group_name: str, monitor_name: str, - resource: "_models.MonitorResource", + resource: _models.MonitorResource, **kwargs: Any - ) -> "_models.MonitorResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + ) -> _models.MonitorResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] _json = self._serialize.body(resource, 'MonitorResource') @@ -841,11 +877,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -875,9 +913,9 @@ def begin_create_or_update( self, resource_group_name: str, monitor_name: str, - resource: "_models.MonitorResource", + resource: _models.MonitorResource, **kwargs: Any - ) -> LROPoller["_models.MonitorResource"]: + ) -> LROPoller[_models.MonitorResource]: """Create a MonitorResource. Create a MonitorResource. @@ -901,37 +939,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.MonitorResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, resource=resource, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitorResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -949,9 +997,9 @@ def update( self, resource_group_name: str, monitor_name: str, - resource: "_models.MonitorResourceUpdate", + resource: _models.MonitorResourceUpdate, **kwargs: Any - ) -> "_models.MonitorResource": + ) -> _models.MonitorResource: """Update a MonitorResource. Update a MonitorResource. @@ -967,14 +1015,17 @@ def update( :rtype: ~azure.mgmt.dynatrace.models.MonitorResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResource] _json = self._serialize.body(resource, 'MonitorResourceUpdate') @@ -986,11 +1037,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1018,13 +1071,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements monitor_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1033,11 +1089,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements monitor_name=monitor_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1081,20 +1139,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1104,8 +1167,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1122,7 +1191,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription_id( self, **kwargs: Any - ) -> Iterable["_models.MonitorResourceListResult"]: + ) -> Iterable[_models.MonitorResourceListResult]: """List all MonitorResource by subscriptionId. List all MonitorResource by subscriptionId. @@ -1133,13 +1202,16 @@ def list_by_subscription_id( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1147,9 +1219,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1157,9 +1231,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1198,7 +1274,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.MonitorResourceListResult"]: + ) -> Iterable[_models.MonitorResourceListResult]: """List MonitorResource resources by resource group. List MonitorResource resources by resource group. @@ -1211,13 +1287,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MonitorResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1226,9 +1305,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1237,9 +1318,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1279,7 +1362,7 @@ def list_hosts( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Iterable["_models.VMHostsListResponse"]: + ) -> Iterable[_models.VMHostsListResponse]: """List the compute resources currently being monitored by the Dynatrace resource. List the compute resources currently being monitored by the Dynatrace resource. @@ -1293,13 +1376,16 @@ def list_hosts( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.VMHostsListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VMHostsListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VMHostsListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1309,9 +1395,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list_hosts.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1321,9 +1409,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1363,7 +1453,7 @@ def list_app_services( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Iterable["_models.AppServiceListResponse"]: + ) -> Iterable[_models.AppServiceListResponse]: """Gets list of App Services with Dynatrace PaaS OneAgent enabled. Gets list of App Services with Dynatrace PaaS OneAgent enabled. @@ -1378,13 +1468,16 @@ def list_app_services( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.AppServiceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AppServiceListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppServiceListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1394,9 +1487,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=self.list_app_services.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1406,9 +1501,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1447,9 +1544,9 @@ def get_sso_details( self, resource_group_name: str, monitor_name: str, - request: Optional["_models.SSODetailsRequest"] = None, + request: Optional[_models.SSODetailsRequest] = None, **kwargs: Any - ) -> "_models.SSODetailsResponse": + ) -> _models.SSODetailsResponse: """Gets the SSO configuration details from the partner. Gets the SSO configuration details from the partner. @@ -1465,14 +1562,17 @@ def get_sso_details( :rtype: ~azure.mgmt.dynatrace.models.SSODetailsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SSODetailsResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SSODetailsResponse] if request is not None: _json = self._serialize.body(request, 'SSODetailsRequest') @@ -1487,11 +1587,13 @@ def get_sso_details( content_type=content_type, json=_json, template_url=self.get_sso_details.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1518,9 +1620,9 @@ def list_linkable_environments( self, resource_group_name: str, monitor_name: str, - request: "_models.LinkableEnvironmentRequest", + request: _models.LinkableEnvironmentRequest, **kwargs: Any - ) -> Iterable["_models.LinkableEnvironmentListResponse"]: + ) -> Iterable[_models.LinkableEnvironmentListResponse]: """Gets all the Dynatrace environments that a user can link a azure resource to. Gets all the Dynatrace environments that a user can link a azure resource to. @@ -1538,14 +1640,17 @@ def list_linkable_environments( ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.LinkableEnvironmentListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkableEnvironmentListResponse] - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkableEnvironmentListResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: _json = self._serialize.body(request, 'LinkableEnvironmentRequest') @@ -1558,9 +1663,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, template_url=self.list_linkable_environments.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: _json = self._serialize.body(request, 'LinkableEnvironmentRequest') @@ -1573,9 +1680,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py index 6057a7c9f295..d201f9f48a79 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Dynatrace.Observability/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.DynatraceObservability`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """List the operations for Dynatrace.Observability. List the operations for Dynatrace.Observability. @@ -87,31 +87,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_patch.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# 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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py index 5a72423233b5..aa53b21dda59 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py @@ -6,7 +6,7 @@ # 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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,14 +35,17 @@ def build_create_or_update_request_initial( monitor_name: str, configuration_name: str, *, - json: JSONType = None, + json: Optional[_models.DynatraceSingleSignOnResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}") # pylint: disable=line-too-long path_format_arguments = { @@ -55,20 +58,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -82,9 +83,12 @@ def build_get_request( configuration_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,18 +101,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -119,9 +121,12 @@ def build_list_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -133,59 +138,58 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SingleSignOnOperations(object): - """SingleSignOnOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SingleSignOnOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.DynatraceObservability`'s + :attr:`single_sign_on` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, monitor_name: str, configuration_name: str, - resource: "_models.DynatraceSingleSignOnResource", + resource: _models.DynatraceSingleSignOnResource, **kwargs: Any - ) -> "_models.DynatraceSingleSignOnResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + ) -> _models.DynatraceSingleSignOnResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResource] _json = self._serialize.body(resource, 'DynatraceSingleSignOnResource') @@ -198,11 +202,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -233,9 +239,9 @@ def begin_create_or_update( resource_group_name: str, monitor_name: str, configuration_name: str, - resource: "_models.DynatraceSingleSignOnResource", + resource: _models.DynatraceSingleSignOnResource, **kwargs: Any - ) -> LROPoller["_models.DynatraceSingleSignOnResource"]: + ) -> LROPoller[_models.DynatraceSingleSignOnResource]: """Create a DynatraceSingleSignOnResource. Create a DynatraceSingleSignOnResource. @@ -262,17 +268,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, @@ -280,20 +289,27 @@ def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -313,7 +329,7 @@ def get( monitor_name: str, configuration_name: str, **kwargs: Any - ) -> "_models.DynatraceSingleSignOnResource": + ) -> _models.DynatraceSingleSignOnResource: """Get a DynatraceSingleSignOnResource. Get a DynatraceSingleSignOnResource. @@ -329,13 +345,16 @@ def get( :rtype: ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResource] request = build_get_request( @@ -345,11 +364,13 @@ def get( configuration_name=configuration_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -377,7 +398,7 @@ def list( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Iterable["_models.DynatraceSingleSignOnResourceListResult"]: + ) -> Iterable[_models.DynatraceSingleSignOnResourceListResult]: """List all DynatraceSingleSignOnResource by monitorName. List all DynatraceSingleSignOnResource by monitorName. @@ -393,13 +414,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DynatraceSingleSignOnResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -409,9 +433,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -421,9 +447,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py index 27101465a924..39c19b1a3e67 100644 --- a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py @@ -6,7 +6,7 @@ # 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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( rule_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_create_or_update_request_initial( monitor_name: str, rule_set_name: str, *, - json: JSONType = None, + json: Optional[_models.TagRule] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,14 +121,17 @@ def build_update_request( monitor_name: str, rule_set_name: str, *, - json: JSONType = None, + json: Optional[_models.TagRuleUpdate] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long path_format_arguments = { @@ -139,20 +144,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -166,9 +169,12 @@ def build_delete_request_initial( rule_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long path_format_arguments = { @@ -181,18 +187,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -203,9 +207,12 @@ def build_list_request( monitor_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules") # pylint: disable=line-too-long path_format_arguments = { @@ -217,42 +224,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class TagRulesOperations(object): - """TagRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TagRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.dynatrace.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.dynatrace.DynatraceObservability`'s + :attr:`tag_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -261,7 +264,7 @@ def get( monitor_name: str, rule_set_name: str, **kwargs: Any - ) -> "_models.TagRule": + ) -> _models.TagRule: """Get a TagRule. Get a TagRule. @@ -277,13 +280,16 @@ def get( :rtype: ~azure.mgmt.dynatrace.models.TagRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] request = build_get_request( @@ -293,11 +299,13 @@ def get( rule_set_name=rule_set_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -324,17 +332,20 @@ def _create_or_update_initial( resource_group_name: str, monitor_name: str, rule_set_name: str, - resource: "_models.TagRule", + resource: _models.TagRule, **kwargs: Any - ) -> "_models.TagRule": - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + ) -> _models.TagRule: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] _json = self._serialize.body(resource, 'TagRule') @@ -347,11 +358,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -382,9 +395,9 @@ def begin_create_or_update( resource_group_name: str, monitor_name: str, rule_set_name: str, - resource: "_models.TagRule", + resource: _models.TagRule, **kwargs: Any - ) -> LROPoller["_models.TagRule"]: + ) -> LROPoller[_models.TagRule]: """Create a TagRule. Create a TagRule. @@ -409,17 +422,20 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.TagRule] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, @@ -427,20 +443,27 @@ def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('TagRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -459,9 +482,9 @@ def update( resource_group_name: str, monitor_name: str, rule_set_name: str, - resource: "_models.TagRuleUpdate", + resource: _models.TagRuleUpdate, **kwargs: Any - ) -> "_models.TagRule": + ) -> _models.TagRule: """Update a TagRule. Update a TagRule. @@ -479,14 +502,17 @@ def update( :rtype: ~azure.mgmt.dynatrace.models.TagRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRule] _json = self._serialize.body(resource, 'TagRuleUpdate') @@ -499,11 +525,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,13 +560,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements rule_set_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -548,11 +579,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements rule_set_name=rule_set_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -599,21 +632,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -623,8 +661,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -643,7 +687,7 @@ def list( resource_group_name: str, monitor_name: str, **kwargs: Any - ) -> Iterable["_models.TagRuleListResult"]: + ) -> Iterable[_models.TagRuleListResult]: """List all TagRule by monitorName. List all TagRule by monitorName. @@ -657,13 +701,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.TagRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TagRuleListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRuleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -673,9 +720,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -685,9 +734,11 @@ def prepare_request(next_link=None): monitor_name=monitor_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request