diff --git a/sdk/monitor/azure-mgmt-monitor/MANIFEST.in b/sdk/monitor/azure-mgmt-monitor/MANIFEST.in index a3cb07df87658..3a9b6517412bc 100644 --- a/sdk/monitor/azure-mgmt-monitor/MANIFEST.in +++ b/sdk/monitor/azure-mgmt-monitor/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/monitor/azure-mgmt-monitor/_meta.json b/sdk/monitor/azure-mgmt-monitor/_meta.json new file mode 100644 index 0000000000000..cb62a31e3ef90 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.2", + "use": [ + "@autorest/python@5.8.1", + "@autorest/modelerfour@4.19.2" + ], + "commit": "300f123ee788b70d77327a8e3cf5203c4a31d156", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/monitor/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "readme": "specification/monitor/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py index c8e55e109fc60..3805e3b3d0572 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,11 @@ from ._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -25,7 +30,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py index f92fe821ee92d..aaad32fb5379c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py @@ -9,13 +9,22 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import ARMPipelineClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import MonitorManagementClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -36,31 +45,30 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2019-10-17-preview' + DEFAULT_API_VERSION = '2021-04-01' _PROFILE_TAG = "azure.mgmt.monitor.MonitorManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, 'action_groups': '2019-06-01', - 'activity_log_alerts': '2017-04-01', + 'activity_log_alerts': '2020-10-01', 'activity_logs': '2015-04-01', 'alert_rule_incidents': '2016-03-01', 'alert_rules': '2016-03-01', 'autoscale_settings': '2015-04-01', 'baseline': '2018-09-01', 'baselines': '2019-03-01', - 'diagnostic_settings': '2017-05-01-preview', - 'diagnostic_settings_category': '2017-05-01-preview', 'event_categories': '2015-04-01', 'guest_diagnostics_settings': '2018-06-01-preview', 'guest_diagnostics_settings_association': '2018-06-01-preview', @@ -71,10 +79,14 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): 'metric_definitions': '2018-01-01', 'metric_namespaces': '2017-12-01-preview', 'metrics': '2018-01-01', - 'operations': '2015-04-01', + 'operations': '2015-07-01', + 'private_endpoint_connections': '2019-10-17-preview', + 'private_link_resources': '2019-10-17-preview', + 'private_link_scope_operation_status': '2019-10-17-preview', + 'private_link_scoped_resources': '2019-10-17-preview', + 'private_link_scopes': '2019-10-17-preview', 'scheduled_query_rules': '2018-04-16', 'service_diagnostic_settings': '2016-09-01', - 'subscription_diagnostic_settings': '2017-05-01-preview', 'tenant_activity_logs': '2015-04-01', 'vm_insights': '2018-11-27-preview', }}, @@ -85,9 +97,9 @@ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + api_version=None, # type: Optional[str] + base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): if not base_url: @@ -128,6 +140,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-11-01-preview: :mod:`v2019_11_01_preview.models` * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` + * 2020-10-01: :mod:`v2020_10_01.models` + * 2021-04-01: :mod:`v2021_04_01.models` + * 2021-05-01-preview: :mod:`v2021_05_01_preview.models` """ if api_version == '2015-04-01': from .v2015_04_01 import models @@ -192,6 +207,15 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-05-01-preview': from .v2020_05_01_preview import models return models + elif api_version == '2020-10-01': + from .v2020_10_01 import models + return models + elif api_version == '2021-04-01': + from .v2021_04_01 import models + return models + elif api_version == '2021-05-01-preview': + from .v2021_05_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -225,12 +249,15 @@ def activity_log_alerts(self): * 2017-03-01-preview: :class:`ActivityLogAlertsOperations` * 2017-04-01: :class:`ActivityLogAlertsOperations` + * 2020-10-01: :class:`ActivityLogAlertsOperations` """ api_version = self._get_api_version('activity_log_alerts') if api_version == '2017-03-01-preview': from .v2017_03_01_preview.operations import ActivityLogAlertsOperations as OperationClass elif api_version == '2017-04-01': from .v2017_04_01.operations import ActivityLogAlertsOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import ActivityLogAlertsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'activity_log_alerts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -265,10 +292,16 @@ def alert_rule_incidents(self): def alert_rules(self): """Instance depends on the API version: + * 2015-04-01: :class:`AlertRulesOperations` + * 2015-07-01: :class:`AlertRulesOperations` * 2016-03-01: :class:`AlertRulesOperations` """ api_version = self._get_api_version('alert_rules') - if api_version == '2016-03-01': + if api_version == '2015-04-01': + from .v2015_04_01.operations import AlertRulesOperations as OperationClass + elif api_version == '2015-07-01': + from .v2015_07_01.operations import AlertRulesOperations as OperationClass + elif api_version == '2016-03-01': from .v2016_03_01.operations import AlertRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'alert_rules'".format(api_version)) @@ -313,15 +346,31 @@ def baselines(self): raise ValueError("API version {} does not have operation group 'baselines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def data_collection_endpoints(self): + """Instance depends on the API version: + + * 2021-04-01: :class:`DataCollectionEndpointsOperations` + """ + api_version = self._get_api_version('data_collection_endpoints') + if api_version == '2021-04-01': + from .v2021_04_01.operations import DataCollectionEndpointsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_collection_endpoints'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def data_collection_rule_associations(self): """Instance depends on the API version: * 2019-11-01-preview: :class:`DataCollectionRuleAssociationsOperations` + * 2021-04-01: :class:`DataCollectionRuleAssociationsOperations` """ api_version = self._get_api_version('data_collection_rule_associations') if api_version == '2019-11-01-preview': from .v2019_11_01_preview.operations import DataCollectionRuleAssociationsOperations as OperationClass + elif api_version == '2021-04-01': + from .v2021_04_01.operations import DataCollectionRuleAssociationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'data_collection_rule_associations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -331,10 +380,13 @@ def data_collection_rules(self): """Instance depends on the API version: * 2019-11-01-preview: :class:`DataCollectionRulesOperations` + * 2021-04-01: :class:`DataCollectionRulesOperations` """ api_version = self._get_api_version('data_collection_rules') if api_version == '2019-11-01-preview': from .v2019_11_01_preview.operations import DataCollectionRulesOperations as OperationClass + elif api_version == '2021-04-01': + from .v2021_04_01.operations import DataCollectionRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'data_collection_rules'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -344,10 +396,13 @@ def diagnostic_settings(self): """Instance depends on the API version: * 2017-05-01-preview: :class:`DiagnosticSettingsOperations` + * 2021-05-01-preview: :class:`DiagnosticSettingsOperations` """ api_version = self._get_api_version('diagnostic_settings') if api_version == '2017-05-01-preview': from .v2017_05_01_preview.operations import DiagnosticSettingsOperations as OperationClass + elif api_version == '2021-05-01-preview': + from .v2021_05_01_preview.operations import DiagnosticSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'diagnostic_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -357,10 +412,13 @@ def diagnostic_settings_category(self): """Instance depends on the API version: * 2017-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` + * 2021-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` """ api_version = self._get_api_version('diagnostic_settings_category') if api_version == '2017-05-01-preview': from .v2017_05_01_preview.operations import DiagnosticSettingsCategoryOperations as OperationClass + elif api_version == '2021-05-01-preview': + from .v2021_05_01_preview.operations import DiagnosticSettingsCategoryOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'diagnostic_settings_category'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -422,10 +480,13 @@ def management_group_diagnostic_settings(self): """Instance depends on the API version: * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` + * 2021-05-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` """ api_version = self._get_api_version('management_group_diagnostic_settings') if api_version == '2020-01-01-preview': from .v2020_01_01_preview.operations import ManagementGroupDiagnosticSettingsOperations as OperationClass + elif api_version == '2021-05-01-preview': + from .v2021_05_01_preview.operations import ManagementGroupDiagnosticSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'management_group_diagnostic_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -476,12 +537,15 @@ def metric_baseline(self): def metric_definitions(self): """Instance depends on the API version: + * 2015-07-01: :class:`MetricDefinitionsOperations` * 2016-03-01: :class:`MetricDefinitionsOperations` * 2017-05-01-preview: :class:`MetricDefinitionsOperations` * 2018-01-01: :class:`MetricDefinitionsOperations` """ api_version = self._get_api_version('metric_definitions') - if api_version == '2016-03-01': + if api_version == '2015-07-01': + from .v2015_07_01.operations import MetricDefinitionsOperations as OperationClass + elif api_version == '2016-03-01': from .v2016_03_01.operations import MetricDefinitionsOperations as OperationClass elif api_version == '2017-05-01-preview': from .v2017_05_01_preview.operations import MetricDefinitionsOperations as OperationClass @@ -528,10 +592,13 @@ def operations(self): """Instance depends on the API version: * 2015-04-01: :class:`Operations` + * 2015-07-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-04-01': from .v2015_04_01.operations import Operations as OperationClass + elif api_version == '2015-07-01': + from .v2015_07_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -638,10 +705,13 @@ def subscription_diagnostic_settings(self): """Instance depends on the API version: * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` + * 2021-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` """ api_version = self._get_api_version('subscription_diagnostic_settings') if api_version == '2017-05-01-preview': from .v2017_05_01_preview.operations import SubscriptionDiagnosticSettingsOperations as OperationClass + elif api_version == '2021-05-01-preview': + from .v2021_05_01_preview.operations import SubscriptionDiagnosticSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'subscription_diagnostic_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py index 89560205ad290..ef0b2052527fc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,9 @@ from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -25,14 +28,14 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str + credential: "AsyncTokenCredential", + subscription_id: str, **kwargs # type: Any ) -> None: if credential is None: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py index fbdc799766592..d65fa7c57a1ed 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py @@ -9,13 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Serializer, Deserializer +from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import MonitorManagementClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -36,31 +43,30 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2019-10-17-preview' + DEFAULT_API_VERSION = '2021-04-01' _PROFILE_TAG = "azure.mgmt.monitor.MonitorManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, 'action_groups': '2019-06-01', - 'activity_log_alerts': '2017-04-01', + 'activity_log_alerts': '2020-10-01', 'activity_logs': '2015-04-01', 'alert_rule_incidents': '2016-03-01', 'alert_rules': '2016-03-01', 'autoscale_settings': '2015-04-01', 'baseline': '2018-09-01', 'baselines': '2019-03-01', - 'diagnostic_settings': '2017-05-01-preview', - 'diagnostic_settings_category': '2017-05-01-preview', 'event_categories': '2015-04-01', 'guest_diagnostics_settings': '2018-06-01-preview', 'guest_diagnostics_settings_association': '2018-06-01-preview', @@ -71,10 +77,14 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): 'metric_definitions': '2018-01-01', 'metric_namespaces': '2017-12-01-preview', 'metrics': '2018-01-01', - 'operations': '2015-04-01', + 'operations': '2015-07-01', + 'private_endpoint_connections': '2019-10-17-preview', + 'private_link_resources': '2019-10-17-preview', + 'private_link_scope_operation_status': '2019-10-17-preview', + 'private_link_scoped_resources': '2019-10-17-preview', + 'private_link_scopes': '2019-10-17-preview', 'scheduled_query_rules': '2018-04-16', 'service_diagnostic_settings': '2016-09-01', - 'subscription_diagnostic_settings': '2017-05-01-preview', 'tenant_activity_logs': '2015-04-01', 'vm_insights': '2018-11-27-preview', }}, @@ -83,11 +93,11 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + credential: "AsyncTokenCredential", + subscription_id: str, + api_version: Optional[str] = None, + base_url: Optional[str] = None, + profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: if not base_url: @@ -128,6 +138,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-11-01-preview: :mod:`v2019_11_01_preview.models` * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` + * 2020-10-01: :mod:`v2020_10_01.models` + * 2021-04-01: :mod:`v2021_04_01.models` + * 2021-05-01-preview: :mod:`v2021_05_01_preview.models` """ if api_version == '2015-04-01': from ..v2015_04_01 import models @@ -192,6 +205,15 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-05-01-preview': from ..v2020_05_01_preview import models return models + elif api_version == '2020-10-01': + from ..v2020_10_01 import models + return models + elif api_version == '2021-04-01': + from ..v2021_04_01 import models + return models + elif api_version == '2021-05-01-preview': + from ..v2021_05_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -225,12 +247,15 @@ def activity_log_alerts(self): * 2017-03-01-preview: :class:`ActivityLogAlertsOperations` * 2017-04-01: :class:`ActivityLogAlertsOperations` + * 2020-10-01: :class:`ActivityLogAlertsOperations` """ api_version = self._get_api_version('activity_log_alerts') if api_version == '2017-03-01-preview': from ..v2017_03_01_preview.aio.operations import ActivityLogAlertsOperations as OperationClass elif api_version == '2017-04-01': from ..v2017_04_01.aio.operations import ActivityLogAlertsOperations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import ActivityLogAlertsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'activity_log_alerts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -265,10 +290,16 @@ def alert_rule_incidents(self): def alert_rules(self): """Instance depends on the API version: + * 2015-04-01: :class:`AlertRulesOperations` + * 2015-07-01: :class:`AlertRulesOperations` * 2016-03-01: :class:`AlertRulesOperations` """ api_version = self._get_api_version('alert_rules') - if api_version == '2016-03-01': + if api_version == '2015-04-01': + from ..v2015_04_01.aio.operations import AlertRulesOperations as OperationClass + elif api_version == '2015-07-01': + from ..v2015_07_01.aio.operations import AlertRulesOperations as OperationClass + elif api_version == '2016-03-01': from ..v2016_03_01.aio.operations import AlertRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'alert_rules'".format(api_version)) @@ -313,15 +344,31 @@ def baselines(self): raise ValueError("API version {} does not have operation group 'baselines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def data_collection_endpoints(self): + """Instance depends on the API version: + + * 2021-04-01: :class:`DataCollectionEndpointsOperations` + """ + api_version = self._get_api_version('data_collection_endpoints') + if api_version == '2021-04-01': + from ..v2021_04_01.aio.operations import DataCollectionEndpointsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_collection_endpoints'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def data_collection_rule_associations(self): """Instance depends on the API version: * 2019-11-01-preview: :class:`DataCollectionRuleAssociationsOperations` + * 2021-04-01: :class:`DataCollectionRuleAssociationsOperations` """ api_version = self._get_api_version('data_collection_rule_associations') if api_version == '2019-11-01-preview': from ..v2019_11_01_preview.aio.operations import DataCollectionRuleAssociationsOperations as OperationClass + elif api_version == '2021-04-01': + from ..v2021_04_01.aio.operations import DataCollectionRuleAssociationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'data_collection_rule_associations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -331,10 +378,13 @@ def data_collection_rules(self): """Instance depends on the API version: * 2019-11-01-preview: :class:`DataCollectionRulesOperations` + * 2021-04-01: :class:`DataCollectionRulesOperations` """ api_version = self._get_api_version('data_collection_rules') if api_version == '2019-11-01-preview': from ..v2019_11_01_preview.aio.operations import DataCollectionRulesOperations as OperationClass + elif api_version == '2021-04-01': + from ..v2021_04_01.aio.operations import DataCollectionRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'data_collection_rules'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -344,10 +394,13 @@ def diagnostic_settings(self): """Instance depends on the API version: * 2017-05-01-preview: :class:`DiagnosticSettingsOperations` + * 2021-05-01-preview: :class:`DiagnosticSettingsOperations` """ api_version = self._get_api_version('diagnostic_settings') if api_version == '2017-05-01-preview': from ..v2017_05_01_preview.aio.operations import DiagnosticSettingsOperations as OperationClass + elif api_version == '2021-05-01-preview': + from ..v2021_05_01_preview.aio.operations import DiagnosticSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'diagnostic_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -357,10 +410,13 @@ def diagnostic_settings_category(self): """Instance depends on the API version: * 2017-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` + * 2021-05-01-preview: :class:`DiagnosticSettingsCategoryOperations` """ api_version = self._get_api_version('diagnostic_settings_category') if api_version == '2017-05-01-preview': from ..v2017_05_01_preview.aio.operations import DiagnosticSettingsCategoryOperations as OperationClass + elif api_version == '2021-05-01-preview': + from ..v2021_05_01_preview.aio.operations import DiagnosticSettingsCategoryOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'diagnostic_settings_category'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -422,10 +478,13 @@ def management_group_diagnostic_settings(self): """Instance depends on the API version: * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` + * 2021-05-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` """ api_version = self._get_api_version('management_group_diagnostic_settings') if api_version == '2020-01-01-preview': from ..v2020_01_01_preview.aio.operations import ManagementGroupDiagnosticSettingsOperations as OperationClass + elif api_version == '2021-05-01-preview': + from ..v2021_05_01_preview.aio.operations import ManagementGroupDiagnosticSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'management_group_diagnostic_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -476,12 +535,15 @@ def metric_baseline(self): def metric_definitions(self): """Instance depends on the API version: + * 2015-07-01: :class:`MetricDefinitionsOperations` * 2016-03-01: :class:`MetricDefinitionsOperations` * 2017-05-01-preview: :class:`MetricDefinitionsOperations` * 2018-01-01: :class:`MetricDefinitionsOperations` """ api_version = self._get_api_version('metric_definitions') - if api_version == '2016-03-01': + if api_version == '2015-07-01': + from ..v2015_07_01.aio.operations import MetricDefinitionsOperations as OperationClass + elif api_version == '2016-03-01': from ..v2016_03_01.aio.operations import MetricDefinitionsOperations as OperationClass elif api_version == '2017-05-01-preview': from ..v2017_05_01_preview.aio.operations import MetricDefinitionsOperations as OperationClass @@ -528,10 +590,13 @@ def operations(self): """Instance depends on the API version: * 2015-04-01: :class:`Operations` + * 2015-07-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-04-01': from ..v2015_04_01.aio.operations import Operations as OperationClass + elif api_version == '2015-07-01': + from ..v2015_07_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -638,10 +703,13 @@ def subscription_diagnostic_settings(self): """Instance depends on the API version: * 2017-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` + * 2021-05-01-preview: :class:`SubscriptionDiagnosticSettingsOperations` """ api_version = self._get_api_version('subscription_diagnostic_settings') if api_version == '2017-05-01-preview': from ..v2017_05_01_preview.aio.operations import SubscriptionDiagnosticSettingsOperations as OperationClass + elif api_version == '2021-05-01-preview': + from ..v2021_05_01_preview.aio.operations import SubscriptionDiagnosticSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'subscription_diagnostic_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py index 09110c75b60e4..ca3505a037e6e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models.py @@ -5,10 +5,9 @@ # license information. # -------------------------------------------------------------------------- from .v2015_04_01.models import * +from .v2015_07_01.models import * from .v2016_03_01.models import * from .v2016_09_01.models import * -from .v2017_04_01.models import * -from .v2017_05_01_preview.models import * from .v2017_12_01_preview.models import * from .v2018_01_01.models import * from .v2018_03_01.models import * @@ -19,3 +18,5 @@ from .v2019_03_01.models import * from .v2019_06_01.models import * from .v2019_10_17.models import * +from .v2020_10_01.models import * +from .v2021_04_01.models import * diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py index db78f6dd9e947..224f0bceaf6e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -47,7 +48,6 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2015-04-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json index 51c32ff3bddd5..c775045988749 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_metadata.json @@ -1,6 +1,6 @@ { "chosen_version": "2015-04-01", - "total_api_version_list": ["2015-04-01"], + "total_api_version_list": ["2014-04-01", "2015-04-01"], "client": { "name": "MonitorManagementClient", "filename": "_monitor_management_client", @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,45 +23,86 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "activity_logs": "ActivityLogsOperations", "autoscale_settings": "AutoscaleSettingsOperations", "event_categories": "EventCategoriesOperations", "operations": "Operations", - "tenant_activity_logs": "TenantActivityLogsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "tenant_activity_logs": "TenantActivityLogsOperations", + "alert_rules": "AlertRulesOperations" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py index cf573933ec237..030cec917f7b2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ActivityLogsOperations @@ -23,6 +24,7 @@ from .operations import EventCategoriesOperations from .operations import Operations from .operations import TenantActivityLogsOperations +from .operations import AlertRulesOperations from . import models @@ -39,9 +41,11 @@ class MonitorManagementClient(object): :vartype operations: $(python-base-namespace).v2015_04_01.operations.Operations :ivar tenant_activity_logs: TenantActivityLogsOperations operations :vartype tenant_activity_logs: $(python-base-namespace).v2015_04_01.operations.TenantActivityLogsOperations + :ivar alert_rules: AlertRulesOperations operations + :vartype alert_rules: $(python-base-namespace).v2015_04_01.operations.AlertRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -74,6 +78,26 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.tenant_activity_logs = TenantActivityLogsOperations( self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py index c2ce834c0f6b3..a1b513c610d41 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -44,7 +45,6 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2015-04-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py index d38f6a5af172e..0e8dd89e73a9b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -21,6 +22,7 @@ from .operations import EventCategoriesOperations from .operations import Operations from .operations import TenantActivityLogsOperations +from .operations import AlertRulesOperations from .. import models @@ -37,9 +39,11 @@ class MonitorManagementClient(object): :vartype operations: $(python-base-namespace).v2015_04_01.aio.operations.Operations :ivar tenant_activity_logs: TenantActivityLogsOperations operations :vartype tenant_activity_logs: $(python-base-namespace).v2015_04_01.aio.operations.TenantActivityLogsOperations + :ivar alert_rules: AlertRulesOperations operations + :vartype alert_rules: $(python-base-namespace).v2015_04_01.aio.operations.AlertRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -71,6 +75,25 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.tenant_activity_logs = TenantActivityLogsOperations( self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/__init__.py index 0246aac3c8aee..76293309fbf0e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/__init__.py @@ -11,6 +11,7 @@ from ._event_categories_operations import EventCategoriesOperations from ._operations import Operations from ._tenant_activity_logs_operations import TenantActivityLogsOperations +from ._alert_rules_operations import AlertRulesOperations __all__ = [ 'ActivityLogsOperations', @@ -18,4 +19,5 @@ 'EventCategoriesOperations', 'Operations', 'TenantActivityLogsOperations', + 'AlertRulesOperations', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py index 7891b73a9d1e9..41231e8634521 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_activity_logs_operations.py @@ -45,7 +45,7 @@ def list( self, filter: str, select: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventDataCollection"]: """Provides the list of records from the activity logs. @@ -94,7 +94,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -125,7 +125,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -134,4 +134,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_alert_rules_operations.py new file mode 100644 index 0000000000000..fe527b21b9613 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_alert_rules_operations.py @@ -0,0 +1,438 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AlertRulesOperations: + """AlertRulesOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + rule_name: str, + parameters: "_models.AlertRuleResource", + **kwargs: Any + ) -> "_models.AlertRuleResource": + """Creates or updates a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AlertRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.AlertRuleResource": + """Gets a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + rule_name: str, + alert_rules_resource: "_models.AlertRuleResourcePatch", + **kwargs: Any + ) -> "_models.AlertRuleResource": + """Updates an existing classic metric AlertRuleResource. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param alert_rules_resource: Parameters supplied to the operation. + :type alert_rules_resource: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: + """List the classic metric alert rules within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: + """List the classic metric alert rules within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py index 8b6c08b0d51a9..d6e489c04fa10 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_autoscale_settings_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AutoscaleSettingResourceCollection"]: """Lists the autoscale settings for a resource group. @@ -73,7 +73,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -101,7 +101,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -110,14 +110,14 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore async def create_or_update( self, resource_group_name: str, autoscale_setting_name: str, parameters: "_models.AutoscaleSettingResource", - **kwargs + **kwargs: Any ) -> "_models.AutoscaleSettingResource": """Creates or updates an autoscale setting. @@ -146,7 +146,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -168,7 +168,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -181,13 +181,13 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore async def delete( self, resource_group_name: str, autoscale_setting_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes and autoscale setting. @@ -213,7 +213,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -231,19 +231,19 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore async def get( self, resource_group_name: str, autoscale_setting_name: str, - **kwargs + **kwargs: Any ) -> "_models.AutoscaleSettingResource": """Gets an autoscale setting. @@ -269,7 +269,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -287,7 +287,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -296,14 +296,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore async def update( self, resource_group_name: str, autoscale_setting_name: str, autoscale_setting_resource: "_models.AutoscaleSettingResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.AutoscaleSettingResource": """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. @@ -331,7 +331,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), } @@ -355,7 +355,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -364,11 +364,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AutoscaleSettingResourceCollection"]: """Lists the autoscale settings for a subscription. @@ -394,7 +394,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -422,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -431,4 +431,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py index 5ec63467bb153..288c4bc49327e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_event_categories_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventCategoryCollection"]: """Get the list of available event categories supported in the Activity Logs Service.:code:`
`The current list includes the following: Administrative, Security, @@ -95,7 +95,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -104,4 +104,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/microsoft.insights/eventcategories'} # type: ignore + list.metadata = {'url': '/providers/Microsoft.Insights/eventcategories'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py index ba5eac551697d..53313b5ec127e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, - **kwargs + **kwargs: Any ) -> "_models.OperationListResult": """Lists all of the available operations from Microsoft.Insights provider. @@ -84,4 +84,4 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/providers/microsoft.insights/operations'} # type: ignore + list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py index 605d7a793407d..53fd30b722a55 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/operations/_tenant_activity_logs_operations.py @@ -45,7 +45,7 @@ def list( self, filter: Optional[str] = None, select: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventDataCollection"]: """Gets the Activity Logs for the Tenant.:code:`
`Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, @@ -64,10 +64,11 @@ def list( ':code:``' and eventChannels eq 'Admin, Operation'.:code:`
`- List events for a resource provider: $filter=eventTimestamp ge ':code:``' and eventTimestamp le ':code:``' and eventChannels eq 'Admin, Operation' and resourceProvider eq - ':code:``'.:code:`
`- List events for a correlation Id: api- - version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq - ':code:``'.:code:`
`\ **NOTE**\ : No other syntax is allowed. + ':code:``'.:code:`
`- List events for a correlation Id: + api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and + eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + correlationId eq ':code:``'.:code:`
`\ **NOTE**\ : No other syntax is + allowed. :type filter: str :param select: Used to fetch events with only the given properties.:code:`
`The **$select** argument is a comma separated list of property names to be returned. Possible values are: @@ -126,7 +127,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -135,4 +136,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/microsoft.insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': '/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py index 18b7c609c1423..7e432fc032b08 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AlertRuleResource + from ._models_py3 import AlertRuleResourceCollection + from ._models_py3 import AlertRuleResourcePatch from ._models_py3 import AutoscaleNotification from ._models_py3 import AutoscaleProfile from ._models_py3 import AutoscaleSettingResource @@ -19,6 +22,9 @@ from ._models_py3 import EventDataCollection from ._models_py3 import HttpRequestInfo from ._models_py3 import LocalizableString + from ._models_py3 import LocationThresholdRuleCondition + from ._models_py3 import ManagementEventAggregationCondition + from ._models_py3 import ManagementEventRuleCondition from ._models_py3 import MetricTrigger from ._models_py3 import Operation from ._models_py3 import OperationDisplay @@ -26,14 +32,26 @@ from ._models_py3 import Recurrence from ._models_py3 import RecurrentSchedule from ._models_py3 import Resource + from ._models_py3 import RuleAction + from ._models_py3 import RuleCondition + from ._models_py3 import RuleDataSource + from ._models_py3 import RuleEmailAction + from ._models_py3 import RuleManagementEventClaimsDataSource + from ._models_py3 import RuleManagementEventDataSource + from ._models_py3 import RuleMetricDataSource + from ._models_py3 import RuleWebhookAction from ._models_py3 import ScaleAction from ._models_py3 import ScaleCapacity from ._models_py3 import ScaleRule from ._models_py3 import ScaleRuleMetricDimension from ._models_py3 import SenderAuthorization + from ._models_py3 import ThresholdRuleCondition from ._models_py3 import TimeWindow from ._models_py3 import WebhookNotification except (SyntaxError, ImportError): + from ._models import AlertRuleResource # type: ignore + from ._models import AlertRuleResourceCollection # type: ignore + from ._models import AlertRuleResourcePatch # type: ignore from ._models import AutoscaleNotification # type: ignore from ._models import AutoscaleProfile # type: ignore from ._models import AutoscaleSettingResource # type: ignore @@ -46,6 +64,9 @@ from ._models import EventDataCollection # type: ignore from ._models import HttpRequestInfo # type: ignore from ._models import LocalizableString # type: ignore + from ._models import LocationThresholdRuleCondition # type: ignore + from ._models import ManagementEventAggregationCondition # type: ignore + from ._models import ManagementEventRuleCondition # type: ignore from ._models import MetricTrigger # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore @@ -53,26 +74,40 @@ from ._models import Recurrence # type: ignore from ._models import RecurrentSchedule # type: ignore from ._models import Resource # type: ignore + from ._models import RuleAction # type: ignore + from ._models import RuleCondition # type: ignore + from ._models import RuleDataSource # type: ignore + from ._models import RuleEmailAction # type: ignore + from ._models import RuleManagementEventClaimsDataSource # type: ignore + from ._models import RuleManagementEventDataSource # type: ignore + from ._models import RuleMetricDataSource # type: ignore + from ._models import RuleWebhookAction # type: ignore from ._models import ScaleAction # type: ignore from ._models import ScaleCapacity # type: ignore from ._models import ScaleRule # type: ignore from ._models import ScaleRuleMetricDimension # type: ignore from ._models import SenderAuthorization # type: ignore + from ._models import ThresholdRuleCondition # type: ignore from ._models import TimeWindow # type: ignore from ._models import WebhookNotification # type: ignore from ._monitor_management_client_enums import ( ComparisonOperationType, + ConditionOperator, EventLevel, MetricStatisticType, RecurrenceFrequency, ScaleDirection, ScaleRuleMetricDimensionOperationType, ScaleType, + TimeAggregationOperator, TimeAggregationType, ) __all__ = [ + 'AlertRuleResource', + 'AlertRuleResourceCollection', + 'AlertRuleResourcePatch', 'AutoscaleNotification', 'AutoscaleProfile', 'AutoscaleSettingResource', @@ -85,6 +120,9 @@ 'EventDataCollection', 'HttpRequestInfo', 'LocalizableString', + 'LocationThresholdRuleCondition', + 'ManagementEventAggregationCondition', + 'ManagementEventRuleCondition', 'MetricTrigger', 'Operation', 'OperationDisplay', @@ -92,19 +130,30 @@ 'Recurrence', 'RecurrentSchedule', 'Resource', + 'RuleAction', + 'RuleCondition', + 'RuleDataSource', + 'RuleEmailAction', + 'RuleManagementEventClaimsDataSource', + 'RuleManagementEventDataSource', + 'RuleMetricDataSource', + 'RuleWebhookAction', 'ScaleAction', 'ScaleCapacity', 'ScaleRule', 'ScaleRuleMetricDimension', 'SenderAuthorization', + 'ThresholdRuleCondition', 'TimeWindow', 'WebhookNotification', 'ComparisonOperationType', + 'ConditionOperator', 'EventLevel', 'MetricStatisticType', 'RecurrenceFrequency', 'ScaleDirection', 'ScaleRuleMetricDimensionOperationType', 'ScaleType', + 'TimeAggregationOperator', 'TimeAggregationType', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py index 76e77193fc279..8996b10f93c82 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models.py @@ -10,6 +10,209 @@ import msrest.serialization +class Resource(msrest.serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class AlertRuleResource(Resource): + """The alert rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name_properties_name: Required. the name of the alert rule. + :type name_properties_name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: Required. the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_04_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_04_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_04_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'name_properties_name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleResource, self).__init__(**kwargs) + self.name_properties_name = kwargs['name_properties_name'] + self.description = kwargs.get('description', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.is_enabled = kwargs['is_enabled'] + self.condition = kwargs['condition'] + self.action = kwargs.get('action', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + +class AlertRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: list[~$(python-base-namespace).v2015_04_01.models.AlertRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AlertRuleResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class AlertRuleResourcePatch(msrest.serialization.Model): + """The alert rule object for patch operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name: the name of the alert rule. + :type name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_04_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_04_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_04_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.is_enabled = kwargs.get('is_enabled', None) + self.condition = kwargs.get('condition', None) + self.action = kwargs.get('action', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + class AutoscaleNotification(msrest.serialization.Model): """Autoscale notification. @@ -17,8 +220,8 @@ class AutoscaleNotification(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar operation: Required. the operation associated with the notification and its value must be - "scale". Default value: "Scale". + :ivar operation: the operation associated with the notification and its value must be "scale". + Has constant value: "Scale". :vartype operation: str :param email: the email notification. :type email: ~$(python-base-namespace).v2015_04_01.models.EmailNotification @@ -93,52 +296,6 @@ def __init__( self.recurrence = kwargs.get('recurrence', None) -class Resource(msrest.serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - class AutoscaleSettingResource(Resource): """The autoscale setting resource. @@ -169,6 +326,9 @@ class AutoscaleSettingResource(Resource): :param target_resource_uri: the resource identifier of the resource that the autoscale setting should be added to. :type target_resource_uri: str + :param target_resource_location: the location of the resource that the autoscale setting should + be added to. + :type target_resource_location: str """ _validation = { @@ -190,6 +350,7 @@ class AutoscaleSettingResource(Resource): 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + 'target_resource_location': {'key': 'properties.targetResourceLocation', 'type': 'str'}, } def __init__( @@ -202,6 +363,7 @@ def __init__( self.enabled = kwargs.get('enabled', True) self.name_properties_name = kwargs.get('name_properties_name', None) self.target_resource_uri = kwargs.get('target_resource_uri', None) + self.target_resource_location = kwargs.get('target_resource_location', None) class AutoscaleSettingResourceCollection(msrest.serialization.Model): @@ -251,6 +413,9 @@ class AutoscaleSettingResourcePatch(msrest.serialization.Model): :param target_resource_uri: the resource identifier of the resource that the autoscale setting should be added to. :type target_resource_uri: str + :param target_resource_location: the location of the resource that the autoscale setting should + be added to. + :type target_resource_location: str """ _validation = { @@ -264,6 +429,7 @@ class AutoscaleSettingResourcePatch(msrest.serialization.Model): 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'name': {'key': 'properties.name', 'type': 'str'}, 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + 'target_resource_location': {'key': 'properties.targetResourceLocation', 'type': 'str'}, } def __init__( @@ -277,6 +443,7 @@ def __init__( self.enabled = kwargs.get('enabled', True) self.name = kwargs.get('name', None) self.target_resource_uri = kwargs.get('target_resource_uri', None) + self.target_resource_location = kwargs.get('target_resource_location', None) class EmailNotification(msrest.serialization.Model): @@ -304,8 +471,8 @@ def __init__( **kwargs ): super(EmailNotification, self).__init__(**kwargs) - self.send_to_subscription_administrator = kwargs.get('send_to_subscription_administrator', None) - self.send_to_subscription_co_administrators = kwargs.get('send_to_subscription_co_administrators', None) + self.send_to_subscription_administrator = kwargs.get('send_to_subscription_administrator', False) + self.send_to_subscription_co_administrators = kwargs.get('send_to_subscription_co_administrators', False) self.custom_emails = kwargs.get('custom_emails', None) @@ -606,6 +773,159 @@ def __init__( self.localized_value = kwargs.get('localized_value', None) +class RuleCondition(msrest.serialization.Model): + """The condition that results in the alert rule being activated. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: LocationThresholdRuleCondition, ManagementEventRuleCondition, ThresholdRuleCondition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition': 'LocationThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition': 'ManagementEventRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition': 'ThresholdRuleCondition'} + } + + def __init__( + self, + **kwargs + ): + super(RuleCondition, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.data_source = kwargs.get('data_source', None) + + +class LocationThresholdRuleCondition(RuleCondition): + """A rule condition based on a certain number of locations failing. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param failed_location_count: Required. the number of locations that must fail to activate the + alert. + :type failed_location_count: int + """ + + _validation = { + 'odata_type': {'required': True}, + 'failed_location_count': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'failed_location_count': {'key': 'failedLocationCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(LocationThresholdRuleCondition, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' # type: str + self.window_size = kwargs.get('window_size', None) + self.failed_location_count = kwargs['failed_location_count'] + + +class ManagementEventAggregationCondition(msrest.serialization.Model): + """How the data that is collected should be combined over time. + + :param operator: the condition operator. Possible values include: "GreaterThan", + "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_04_01.models.ConditionOperator + :param threshold: The threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + """ + + _attribute_map = { + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementEventAggregationCondition, self).__init__(**kwargs) + self.operator = kwargs.get('operator', None) + self.threshold = kwargs.get('threshold', None) + self.window_size = kwargs.get('window_size', None) + + +class ManagementEventRuleCondition(RuleCondition): + """A management event rule condition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + :param aggregation: How the data that is collected should be combined over time and when the + alert is activated. Note that for management event alerts aggregation is optional – if it is + not provided then any event will cause the alert to activate. + :type aggregation: + ~$(python-base-namespace).v2015_04_01.models.ManagementEventAggregationCondition + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'aggregation': {'key': 'aggregation', 'type': 'ManagementEventAggregationCondition'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementEventRuleCondition, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' # type: str + self.aggregation = kwargs.get('aggregation', None) + + class MetricTrigger(msrest.serialization.Model): """The trigger that results in a scaling action. @@ -618,12 +938,14 @@ class MetricTrigger(msrest.serialization.Model): :param metric_resource_uri: Required. the resource identifier of the resource the rule monitors. :type metric_resource_uri: str + :param metric_resource_location: the location of the resource the rule monitors. + :type metric_resource_location: str :param time_grain: Required. the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. :type time_grain: ~datetime.timedelta :param statistic: Required. the metric statistic type. How the metrics from multiple instances - are combined. Possible values include: "Average", "Min", "Max", "Sum". + are combined. Possible values include: "Average", "Min", "Max", "Sum", "Count". :type statistic: str or ~$(python-base-namespace).v2015_04_01.models.MetricStatisticType :param time_window: Required. the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. @@ -642,6 +964,8 @@ class MetricTrigger(msrest.serialization.Model): :param dimensions: List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. :type dimensions: list[~$(python-base-namespace).v2015_04_01.models.ScaleRuleMetricDimension] + :param divide_per_instance: a value indicating whether metric should divide per instance. + :type divide_per_instance: bool """ _validation = { @@ -659,6 +983,7 @@ class MetricTrigger(msrest.serialization.Model): 'metric_name': {'key': 'metricName', 'type': 'str'}, 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'}, + 'metric_resource_location': {'key': 'metricResourceLocation', 'type': 'str'}, 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, 'statistic': {'key': 'statistic', 'type': 'str'}, 'time_window': {'key': 'timeWindow', 'type': 'duration'}, @@ -666,6 +991,7 @@ class MetricTrigger(msrest.serialization.Model): 'operator': {'key': 'operator', 'type': 'str'}, 'threshold': {'key': 'threshold', 'type': 'float'}, 'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'}, + 'divide_per_instance': {'key': 'dividePerInstance', 'type': 'bool'}, } def __init__( @@ -676,6 +1002,7 @@ def __init__( self.metric_name = kwargs['metric_name'] self.metric_namespace = kwargs.get('metric_namespace', None) self.metric_resource_uri = kwargs['metric_resource_uri'] + self.metric_resource_location = kwargs.get('metric_resource_location', None) self.time_grain = kwargs['time_grain'] self.statistic = kwargs['statistic'] self.time_window = kwargs['time_window'] @@ -683,6 +1010,7 @@ def __init__( self.operator = kwargs['operator'] self.threshold = kwargs['threshold'] self.dimensions = kwargs.get('dimensions', None) + self.divide_per_instance = kwargs.get('divide_per_instance', None) class Operation(msrest.serialization.Model): @@ -863,6 +1191,303 @@ def __init__( self.minutes = kwargs['minutes'] +class RuleAction(msrest.serialization.Model): + """The action that is performed when the alert rule becomes active, and when an alert condition is resolved. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleEmailAction, RuleWebhookAction. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleEmailAction': 'RuleEmailAction', 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction': 'RuleWebhookAction'} + } + + def __init__( + self, + **kwargs + ): + super(RuleAction, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + + +class RuleDataSource(msrest.serialization.Model): + """The resource from which the rule collects its data. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleManagementEventDataSource, RuleMetricDataSource. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource': 'RuleManagementEventDataSource', 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource': 'RuleMetricDataSource'} + } + + def __init__( + self, + **kwargs + ): + super(RuleDataSource, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.resource_uri = kwargs.get('resource_uri', None) + self.legacy_resource_id = kwargs.get('legacy_resource_id', None) + self.resource_location = kwargs.get('resource_location', None) + self.metric_namespace = kwargs.get('metric_namespace', None) + + +class RuleEmailAction(RuleAction): + """Specifies the action to send email when the rule condition is evaluated. The discriminator is always RuleEmailAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param send_to_service_owners: Whether the administrators (service and co-administrators) of + the service should be notified when the alert is activated. + :type send_to_service_owners: bool + :param custom_emails: the list of administrator's custom email addresses to notify of the + activation of the alert. + :type custom_emails: list[str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'send_to_service_owners': {'key': 'sendToServiceOwners', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleEmailAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction' # type: str + self.send_to_service_owners = kwargs.get('send_to_service_owners', None) + self.custom_emails = kwargs.get('custom_emails', None) + + +class RuleManagementEventClaimsDataSource(msrest.serialization.Model): + """The claims for a rule management event data source. + + :param email_address: the email address. + :type email_address: str + """ + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleManagementEventClaimsDataSource, self).__init__(**kwargs) + self.email_address = kwargs.get('email_address', None) + + +class RuleManagementEventDataSource(RuleDataSource): + """A rule management event data source. The discriminator fields is always RuleManagementEventDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param event_name: the event name. + :type event_name: str + :param event_source: the event source. + :type event_source: str + :param level: the level. + :type level: str + :param operation_name: The name of the operation that should be checked for. If no name is + provided, any operation will match. + :type operation_name: str + :param resource_group_name: the resource group name. + :type resource_group_name: str + :param resource_provider_name: the resource provider name. + :type resource_provider_name: str + :param status: The status of the operation that should be checked for. If no status is + provided, any status will match. + :type status: str + :param sub_status: the substatus. + :type sub_status: str + :param claims: the claims. + :type claims: ~$(python-base-namespace).v2015_04_01.models.RuleManagementEventClaimsDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'str'}, + 'event_source': {'key': 'eventSource', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'sub_status': {'key': 'subStatus', 'type': 'str'}, + 'claims': {'key': 'claims', 'type': 'RuleManagementEventClaimsDataSource'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleManagementEventDataSource, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' # type: str + self.event_name = kwargs.get('event_name', None) + self.event_source = kwargs.get('event_source', None) + self.level = kwargs.get('level', None) + self.operation_name = kwargs.get('operation_name', None) + self.resource_group_name = kwargs.get('resource_group_name', None) + self.resource_provider_name = kwargs.get('resource_provider_name', None) + self.status = kwargs.get('status', None) + self.sub_status = kwargs.get('sub_status', None) + self.claims = kwargs.get('claims', None) + + +class RuleMetricDataSource(RuleDataSource): + """A rule metric data source. The discriminator value is always RuleMetricDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param metric_name: the name of the metric that defines what the rule monitors. + :type metric_name: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleMetricDataSource, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' # type: str + self.metric_name = kwargs.get('metric_name', None) + + +class RuleWebhookAction(RuleAction): + """Specifies the action to post to service when the rule condition is evaluated. The discriminator is always RuleWebhookAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param service_uri: the service uri to Post the notification when the alert activates or + resolves. + :type service_uri: str + :param properties: the dictionary of custom properties to include with the post operation. + These data are appended to the webhook payload. + :type properties: dict[str, str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleWebhookAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' # type: str + self.service_uri = kwargs.get('service_uri', None) + self.properties = kwargs.get('properties', None) + + class ScaleAction(msrest.serialization.Model): """The parameters for the scaling action. @@ -872,7 +1497,7 @@ class ScaleAction(msrest.serialization.Model): decreases the number of instances. Possible values include: "None", "Increase", "Decrease". :type direction: str or ~$(python-base-namespace).v2015_04_01.models.ScaleDirection :param type: Required. the type of action that should occur when the scale rule fires. Possible - values include: "ChangeCount", "PercentChangeCount", "ExactCount". + values include: "ChangeCount", "PercentChangeCount", "ExactCount", "ServiceAllowedNextValue". :type type: str or ~$(python-base-namespace).v2015_04_01.models.ScaleType :param value: the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. @@ -984,8 +1609,8 @@ class ScaleRuleMetricDimension(msrest.serialization.Model): :param operator: Required. the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: "Equals", "NotEquals". - :type operator: str or ~$(python-base- - namespace).v2015_04_01.models.ScaleRuleMetricDimensionOperationType + :type operator: str or + ~$(python-base-namespace).v2015_04_01.models.ScaleRuleMetricDimensionOperationType :param values: Required. list of dimension values. For example: ["App1","App2"]. :type values: list[str] """ @@ -1039,6 +1664,62 @@ def __init__( self.scope = kwargs.get('scope', None) +class ThresholdRuleCondition(RuleCondition): + """A rule condition based on a metric crossing a threshold. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + :param operator: Required. the operator used to compare the data and the threshold. Possible + values include: "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_04_01.models.ConditionOperator + :param threshold: Required. the threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param time_aggregation: the time aggregation operator. How the data that are collected should + be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible + values include: "Average", "Minimum", "Maximum", "Total", "Last". + :type time_aggregation: str or + ~$(python-base-namespace).v2015_04_01.models.TimeAggregationOperator + """ + + _validation = { + 'odata_type': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ThresholdRuleCondition, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' # type: str + self.operator = kwargs['operator'] + self.threshold = kwargs['threshold'] + self.window_size = kwargs.get('window_size', None) + self.time_aggregation = kwargs.get('time_aggregation', None) + + class TimeWindow(msrest.serialization.Model): """A specific date-time for the profile. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py index 8e4b6ec10913f..621d5431777a9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_models_py3.py @@ -15,6 +15,233 @@ from ._monitor_management_client_enums import * +class Resource(msrest.serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class AlertRuleResource(Resource): + """The alert rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name_properties_name: Required. the name of the alert rule. + :type name_properties_name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: Required. the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_04_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_04_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_04_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'name_properties_name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + name_properties_name: str, + is_enabled: bool, + condition: "RuleCondition", + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + provisioning_state: Optional[str] = None, + action: Optional["RuleAction"] = None, + actions: Optional[List["RuleAction"]] = None, + **kwargs + ): + super(AlertRuleResource, self).__init__(location=location, tags=tags, **kwargs) + self.name_properties_name = name_properties_name + self.description = description + self.provisioning_state = provisioning_state + self.is_enabled = is_enabled + self.condition = condition + self.action = action + self.actions = actions + self.last_updated_time = None + + +class AlertRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: list[~$(python-base-namespace).v2015_04_01.models.AlertRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AlertRuleResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["AlertRuleResource"]] = None, + **kwargs + ): + super(AlertRuleResourceCollection, self).__init__(**kwargs) + self.value = value + + +class AlertRuleResourcePatch(msrest.serialization.Model): + """The alert rule object for patch operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name: the name of the alert rule. + :type name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_04_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_04_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_04_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + name: Optional[str] = None, + description: Optional[str] = None, + provisioning_state: Optional[str] = None, + is_enabled: Optional[bool] = None, + condition: Optional["RuleCondition"] = None, + action: Optional["RuleAction"] = None, + actions: Optional[List["RuleAction"]] = None, + **kwargs + ): + super(AlertRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.name = name + self.description = description + self.provisioning_state = provisioning_state + self.is_enabled = is_enabled + self.condition = condition + self.action = action + self.actions = actions + self.last_updated_time = None + + class AutoscaleNotification(msrest.serialization.Model): """Autoscale notification. @@ -22,8 +249,8 @@ class AutoscaleNotification(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar operation: Required. the operation associated with the notification and its value must be - "scale". Default value: "Scale". + :ivar operation: the operation associated with the notification and its value must be "scale". + Has constant value: "Scale". :vartype operation: str :param email: the email notification. :type email: ~$(python-base-namespace).v2015_04_01.models.EmailNotification @@ -107,55 +334,6 @@ def __init__( self.recurrence = recurrence -class Resource(msrest.serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - class AutoscaleSettingResource(Resource): """The autoscale setting resource. @@ -186,6 +364,9 @@ class AutoscaleSettingResource(Resource): :param target_resource_uri: the resource identifier of the resource that the autoscale setting should be added to. :type target_resource_uri: str + :param target_resource_location: the location of the resource that the autoscale setting should + be added to. + :type target_resource_location: str """ _validation = { @@ -207,6 +388,7 @@ class AutoscaleSettingResource(Resource): 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + 'target_resource_location': {'key': 'properties.targetResourceLocation', 'type': 'str'}, } def __init__( @@ -219,6 +401,7 @@ def __init__( enabled: Optional[bool] = True, name_properties_name: Optional[str] = None, target_resource_uri: Optional[str] = None, + target_resource_location: Optional[str] = None, **kwargs ): super(AutoscaleSettingResource, self).__init__(location=location, tags=tags, **kwargs) @@ -227,6 +410,7 @@ def __init__( self.enabled = enabled self.name_properties_name = name_properties_name self.target_resource_uri = target_resource_uri + self.target_resource_location = target_resource_location class AutoscaleSettingResourceCollection(msrest.serialization.Model): @@ -279,6 +463,9 @@ class AutoscaleSettingResourcePatch(msrest.serialization.Model): :param target_resource_uri: the resource identifier of the resource that the autoscale setting should be added to. :type target_resource_uri: str + :param target_resource_location: the location of the resource that the autoscale setting should + be added to. + :type target_resource_location: str """ _validation = { @@ -292,6 +479,7 @@ class AutoscaleSettingResourcePatch(msrest.serialization.Model): 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'name': {'key': 'properties.name', 'type': 'str'}, 'target_resource_uri': {'key': 'properties.targetResourceUri', 'type': 'str'}, + 'target_resource_location': {'key': 'properties.targetResourceLocation', 'type': 'str'}, } def __init__( @@ -303,6 +491,7 @@ def __init__( enabled: Optional[bool] = True, name: Optional[str] = None, target_resource_uri: Optional[str] = None, + target_resource_location: Optional[str] = None, **kwargs ): super(AutoscaleSettingResourcePatch, self).__init__(**kwargs) @@ -312,6 +501,7 @@ def __init__( self.enabled = enabled self.name = name self.target_resource_uri = target_resource_uri + self.target_resource_location = target_resource_location class EmailNotification(msrest.serialization.Model): @@ -337,8 +527,8 @@ class EmailNotification(msrest.serialization.Model): def __init__( self, *, - send_to_subscription_administrator: Optional[bool] = None, - send_to_subscription_co_administrators: Optional[bool] = None, + send_to_subscription_administrator: Optional[bool] = False, + send_to_subscription_co_administrators: Optional[bool] = False, custom_emails: Optional[List[str]] = None, **kwargs ): @@ -661,6 +851,172 @@ def __init__( self.localized_value = localized_value +class RuleCondition(msrest.serialization.Model): + """The condition that results in the alert rule being activated. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: LocationThresholdRuleCondition, ManagementEventRuleCondition, ThresholdRuleCondition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition': 'LocationThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition': 'ManagementEventRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition': 'ThresholdRuleCondition'} + } + + def __init__( + self, + *, + data_source: Optional["RuleDataSource"] = None, + **kwargs + ): + super(RuleCondition, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.data_source = data_source + + +class LocationThresholdRuleCondition(RuleCondition): + """A rule condition based on a certain number of locations failing. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param failed_location_count: Required. the number of locations that must fail to activate the + alert. + :type failed_location_count: int + """ + + _validation = { + 'odata_type': {'required': True}, + 'failed_location_count': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'failed_location_count': {'key': 'failedLocationCount', 'type': 'int'}, + } + + def __init__( + self, + *, + failed_location_count: int, + data_source: Optional["RuleDataSource"] = None, + window_size: Optional[datetime.timedelta] = None, + **kwargs + ): + super(LocationThresholdRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' # type: str + self.window_size = window_size + self.failed_location_count = failed_location_count + + +class ManagementEventAggregationCondition(msrest.serialization.Model): + """How the data that is collected should be combined over time. + + :param operator: the condition operator. Possible values include: "GreaterThan", + "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_04_01.models.ConditionOperator + :param threshold: The threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + """ + + _attribute_map = { + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + } + + def __init__( + self, + *, + operator: Optional[Union[str, "ConditionOperator"]] = None, + threshold: Optional[float] = None, + window_size: Optional[datetime.timedelta] = None, + **kwargs + ): + super(ManagementEventAggregationCondition, self).__init__(**kwargs) + self.operator = operator + self.threshold = threshold + self.window_size = window_size + + +class ManagementEventRuleCondition(RuleCondition): + """A management event rule condition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + :param aggregation: How the data that is collected should be combined over time and when the + alert is activated. Note that for management event alerts aggregation is optional – if it is + not provided then any event will cause the alert to activate. + :type aggregation: + ~$(python-base-namespace).v2015_04_01.models.ManagementEventAggregationCondition + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'aggregation': {'key': 'aggregation', 'type': 'ManagementEventAggregationCondition'}, + } + + def __init__( + self, + *, + data_source: Optional["RuleDataSource"] = None, + aggregation: Optional["ManagementEventAggregationCondition"] = None, + **kwargs + ): + super(ManagementEventRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' # type: str + self.aggregation = aggregation + + class MetricTrigger(msrest.serialization.Model): """The trigger that results in a scaling action. @@ -673,12 +1029,14 @@ class MetricTrigger(msrest.serialization.Model): :param metric_resource_uri: Required. the resource identifier of the resource the rule monitors. :type metric_resource_uri: str + :param metric_resource_location: the location of the resource the rule monitors. + :type metric_resource_location: str :param time_grain: Required. the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. :type time_grain: ~datetime.timedelta :param statistic: Required. the metric statistic type. How the metrics from multiple instances - are combined. Possible values include: "Average", "Min", "Max", "Sum". + are combined. Possible values include: "Average", "Min", "Max", "Sum", "Count". :type statistic: str or ~$(python-base-namespace).v2015_04_01.models.MetricStatisticType :param time_window: Required. the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. @@ -697,6 +1055,8 @@ class MetricTrigger(msrest.serialization.Model): :param dimensions: List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. :type dimensions: list[~$(python-base-namespace).v2015_04_01.models.ScaleRuleMetricDimension] + :param divide_per_instance: a value indicating whether metric should divide per instance. + :type divide_per_instance: bool """ _validation = { @@ -714,6 +1074,7 @@ class MetricTrigger(msrest.serialization.Model): 'metric_name': {'key': 'metricName', 'type': 'str'}, 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'}, + 'metric_resource_location': {'key': 'metricResourceLocation', 'type': 'str'}, 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, 'statistic': {'key': 'statistic', 'type': 'str'}, 'time_window': {'key': 'timeWindow', 'type': 'duration'}, @@ -721,6 +1082,7 @@ class MetricTrigger(msrest.serialization.Model): 'operator': {'key': 'operator', 'type': 'str'}, 'threshold': {'key': 'threshold', 'type': 'float'}, 'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'}, + 'divide_per_instance': {'key': 'dividePerInstance', 'type': 'bool'}, } def __init__( @@ -735,13 +1097,16 @@ def __init__( operator: Union[str, "ComparisonOperationType"], threshold: float, metric_namespace: Optional[str] = None, + metric_resource_location: Optional[str] = None, dimensions: Optional[List["ScaleRuleMetricDimension"]] = None, + divide_per_instance: Optional[bool] = None, **kwargs ): super(MetricTrigger, self).__init__(**kwargs) self.metric_name = metric_name self.metric_namespace = metric_namespace self.metric_resource_uri = metric_resource_uri + self.metric_resource_location = metric_resource_location self.time_grain = time_grain self.statistic = statistic self.time_window = time_window @@ -749,6 +1114,7 @@ def __init__( self.operator = operator self.threshold = threshold self.dimensions = dimensions + self.divide_per_instance = divide_per_instance class Operation(msrest.serialization.Model): @@ -947,6 +1313,336 @@ def __init__( self.minutes = minutes +class RuleAction(msrest.serialization.Model): + """The action that is performed when the alert rule becomes active, and when an alert condition is resolved. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleEmailAction, RuleWebhookAction. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleEmailAction': 'RuleEmailAction', 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction': 'RuleWebhookAction'} + } + + def __init__( + self, + **kwargs + ): + super(RuleAction, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + + +class RuleDataSource(msrest.serialization.Model): + """The resource from which the rule collects its data. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleManagementEventDataSource, RuleMetricDataSource. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource': 'RuleManagementEventDataSource', 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource': 'RuleMetricDataSource'} + } + + def __init__( + self, + *, + resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, + **kwargs + ): + super(RuleDataSource, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.resource_uri = resource_uri + self.legacy_resource_id = legacy_resource_id + self.resource_location = resource_location + self.metric_namespace = metric_namespace + + +class RuleEmailAction(RuleAction): + """Specifies the action to send email when the rule condition is evaluated. The discriminator is always RuleEmailAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param send_to_service_owners: Whether the administrators (service and co-administrators) of + the service should be notified when the alert is activated. + :type send_to_service_owners: bool + :param custom_emails: the list of administrator's custom email addresses to notify of the + activation of the alert. + :type custom_emails: list[str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'send_to_service_owners': {'key': 'sendToServiceOwners', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__( + self, + *, + send_to_service_owners: Optional[bool] = None, + custom_emails: Optional[List[str]] = None, + **kwargs + ): + super(RuleEmailAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction' # type: str + self.send_to_service_owners = send_to_service_owners + self.custom_emails = custom_emails + + +class RuleManagementEventClaimsDataSource(msrest.serialization.Model): + """The claims for a rule management event data source. + + :param email_address: the email address. + :type email_address: str + """ + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + email_address: Optional[str] = None, + **kwargs + ): + super(RuleManagementEventClaimsDataSource, self).__init__(**kwargs) + self.email_address = email_address + + +class RuleManagementEventDataSource(RuleDataSource): + """A rule management event data source. The discriminator fields is always RuleManagementEventDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param event_name: the event name. + :type event_name: str + :param event_source: the event source. + :type event_source: str + :param level: the level. + :type level: str + :param operation_name: The name of the operation that should be checked for. If no name is + provided, any operation will match. + :type operation_name: str + :param resource_group_name: the resource group name. + :type resource_group_name: str + :param resource_provider_name: the resource provider name. + :type resource_provider_name: str + :param status: The status of the operation that should be checked for. If no status is + provided, any status will match. + :type status: str + :param sub_status: the substatus. + :type sub_status: str + :param claims: the claims. + :type claims: ~$(python-base-namespace).v2015_04_01.models.RuleManagementEventClaimsDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'str'}, + 'event_source': {'key': 'eventSource', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'sub_status': {'key': 'subStatus', 'type': 'str'}, + 'claims': {'key': 'claims', 'type': 'RuleManagementEventClaimsDataSource'}, + } + + def __init__( + self, + *, + resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, + event_name: Optional[str] = None, + event_source: Optional[str] = None, + level: Optional[str] = None, + operation_name: Optional[str] = None, + resource_group_name: Optional[str] = None, + resource_provider_name: Optional[str] = None, + status: Optional[str] = None, + sub_status: Optional[str] = None, + claims: Optional["RuleManagementEventClaimsDataSource"] = None, + **kwargs + ): + super(RuleManagementEventDataSource, self).__init__(resource_uri=resource_uri, legacy_resource_id=legacy_resource_id, resource_location=resource_location, metric_namespace=metric_namespace, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' # type: str + self.event_name = event_name + self.event_source = event_source + self.level = level + self.operation_name = operation_name + self.resource_group_name = resource_group_name + self.resource_provider_name = resource_provider_name + self.status = status + self.sub_status = sub_status + self.claims = claims + + +class RuleMetricDataSource(RuleDataSource): + """A rule metric data source. The discriminator value is always RuleMetricDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param metric_name: the name of the metric that defines what the rule monitors. + :type metric_name: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, + metric_name: Optional[str] = None, + **kwargs + ): + super(RuleMetricDataSource, self).__init__(resource_uri=resource_uri, legacy_resource_id=legacy_resource_id, resource_location=resource_location, metric_namespace=metric_namespace, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' # type: str + self.metric_name = metric_name + + +class RuleWebhookAction(RuleAction): + """Specifies the action to post to service when the rule condition is evaluated. The discriminator is always RuleWebhookAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param service_uri: the service uri to Post the notification when the alert activates or + resolves. + :type service_uri: str + :param properties: the dictionary of custom properties to include with the post operation. + These data are appended to the webhook payload. + :type properties: dict[str, str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + service_uri: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(RuleWebhookAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' # type: str + self.service_uri = service_uri + self.properties = properties + + class ScaleAction(msrest.serialization.Model): """The parameters for the scaling action. @@ -956,7 +1652,7 @@ class ScaleAction(msrest.serialization.Model): decreases the number of instances. Possible values include: "None", "Increase", "Decrease". :type direction: str or ~$(python-base-namespace).v2015_04_01.models.ScaleDirection :param type: Required. the type of action that should occur when the scale rule fires. Possible - values include: "ChangeCount", "PercentChangeCount", "ExactCount". + values include: "ChangeCount", "PercentChangeCount", "ExactCount", "ServiceAllowedNextValue". :type type: str or ~$(python-base-namespace).v2015_04_01.models.ScaleType :param value: the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. @@ -1080,8 +1776,8 @@ class ScaleRuleMetricDimension(msrest.serialization.Model): :param operator: Required. the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: "Equals", "NotEquals". - :type operator: str or ~$(python-base- - namespace).v2015_04_01.models.ScaleRuleMetricDimensionOperationType + :type operator: str or + ~$(python-base-namespace).v2015_04_01.models.ScaleRuleMetricDimensionOperationType :param values: Required. list of dimension values. For example: ["App1","App2"]. :type values: list[str] """ @@ -1143,6 +1839,68 @@ def __init__( self.scope = scope +class ThresholdRuleCondition(RuleCondition): + """A rule condition based on a metric crossing a threshold. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_04_01.models.RuleDataSource + :param operator: Required. the operator used to compare the data and the threshold. Possible + values include: "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_04_01.models.ConditionOperator + :param threshold: Required. the threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param time_aggregation: the time aggregation operator. How the data that are collected should + be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible + values include: "Average", "Minimum", "Maximum", "Total", "Last". + :type time_aggregation: str or + ~$(python-base-namespace).v2015_04_01.models.TimeAggregationOperator + """ + + _validation = { + 'odata_type': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + } + + def __init__( + self, + *, + operator: Union[str, "ConditionOperator"], + threshold: float, + data_source: Optional["RuleDataSource"] = None, + window_size: Optional[datetime.timedelta] = None, + time_aggregation: Optional[Union[str, "TimeAggregationOperator"]] = None, + **kwargs + ): + super(ThresholdRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' # type: str + self.operator = operator + self.threshold = threshold + self.window_size = window_size + self.time_aggregation = time_aggregation + + class TimeWindow(msrest.serialization.Model): """A specific date-time for the profile. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py index 8ff9a5c89e3d8..37b2db1f18f40 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py @@ -37,6 +37,15 @@ class ComparisonOperationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum LESS_THAN = "LessThan" LESS_THAN_OR_EQUAL = "LessThanOrEqual" +class ConditionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operators allowed in the rule condition. + """ + + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + class EventLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """the event level """ @@ -55,6 +64,7 @@ class MetricStatisticType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MIN = "Min" MAX = "Max" SUM = "Sum" + COUNT = "Count" class RecurrenceFrequency(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """the recurrence frequency. How often the schedule profile should take effect. This value must be @@ -95,6 +105,17 @@ class ScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CHANGE_COUNT = "ChangeCount" PERCENT_CHANGE_COUNT = "PercentChangeCount" EXACT_COUNT = "ExactCount" + SERVICE_ALLOWED_NEXT_VALUE = "ServiceAllowedNextValue" + +class TimeAggregationOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Aggregation operators allowed in a rule. + """ + + AVERAGE = "Average" + MINIMUM = "Minimum" + MAXIMUM = "Maximum" + TOTAL = "Total" + LAST = "Last" class TimeAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """time aggregation type. How the data that is collected should be combined over time. The default diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py index 0246aac3c8aee..76293309fbf0e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/__init__.py @@ -11,6 +11,7 @@ from ._event_categories_operations import EventCategoriesOperations from ._operations import Operations from ._tenant_activity_logs_operations import TenantActivityLogsOperations +from ._alert_rules_operations import AlertRulesOperations __all__ = [ 'ActivityLogsOperations', @@ -18,4 +19,5 @@ 'EventCategoriesOperations', 'Operations', 'TenantActivityLogsOperations', + 'AlertRulesOperations', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py index 96a18678e7540..e83da6d5d60a8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_activity_logs_operations.py @@ -99,7 +99,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -130,7 +130,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -139,4 +139,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_alert_rules_operations.py new file mode 100644 index 0000000000000..b9931cb2c2b97 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_alert_rules_operations.py @@ -0,0 +1,448 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AlertRulesOperations(object): + """AlertRulesOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + rule_name, # type: str + parameters, # type: "_models.AlertRuleResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AlertRuleResource" + """Creates or updates a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AlertRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AlertRuleResource" + """Gets a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + rule_name, # type: str + alert_rules_resource, # type: "_models.AlertRuleResourcePatch" + **kwargs # type: Any + ): + # type: (...) -> "_models.AlertRuleResource" + """Updates an existing classic metric AlertRuleResource. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param alert_rules_resource: Parameters supplied to the operation. + :type alert_rules_resource: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_04_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AlertRuleResourceCollection"] + """List the classic metric alert rules within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AlertRuleResourceCollection"] + """List the classic metric alert rules within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_04_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py index 0d0d541a15c54..ffd1174490a14 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_autoscale_settings_operations.py @@ -78,7 +78,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -106,7 +106,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -115,7 +115,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore def create_or_update( self, @@ -152,7 +152,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -174,7 +174,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -187,7 +187,7 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore def delete( self, @@ -220,7 +220,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -238,13 +238,13 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore def get( self, @@ -277,7 +277,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -295,7 +295,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -304,7 +304,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore def update( self, @@ -340,7 +340,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'autoscaleSettingName': self._serialize.url("autoscale_setting_name", autoscale_setting_name, 'str'), } @@ -364,7 +364,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AutoscaleSettingResource', pipeline_response) @@ -373,7 +373,7 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}'} # type: ignore def list_by_subscription( self, @@ -404,7 +404,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -432,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -441,4 +441,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py index a694d451cfc9e..c5d271a71e2c9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_event_categories_operations.py @@ -100,7 +100,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -109,4 +109,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/microsoft.insights/eventcategories'} # type: ignore + list.metadata = {'url': '/providers/Microsoft.Insights/eventcategories'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py index 6135ddd2958a4..d57820bb6d719 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_operations.py @@ -89,4 +89,4 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/providers/microsoft.insights/operations'} # type: ignore + list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py index b16eb54262917..91d274582a84f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/operations/_tenant_activity_logs_operations.py @@ -69,10 +69,11 @@ def list( ':code:``' and eventChannels eq 'Admin, Operation'.:code:`
`- List events for a resource provider: $filter=eventTimestamp ge ':code:``' and eventTimestamp le ':code:``' and eventChannels eq 'Admin, Operation' and resourceProvider eq - ':code:``'.:code:`
`- List events for a correlation Id: api- - version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq - ':code:``'.:code:`
`\ **NOTE**\ : No other syntax is allowed. + ':code:``'.:code:`
`- List events for a correlation Id: + api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and + eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + correlationId eq ':code:``'.:code:`
`\ **NOTE**\ : No other syntax is + allowed. :type filter: str :param select: Used to fetch events with only the given properties.:code:`
`The **$select** argument is a comma separated list of property names to be returned. Possible values are: @@ -131,7 +132,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -140,4 +141,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/microsoft.insights/eventtypes/management/values'} # type: ignore + list.metadata = {'url': '/providers/Microsoft.Insights/eventtypes/management/values'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py index 9199b0909a686..224f0bceaf6e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,20 +29,25 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str """ def __init__( self, credential, # type: "TokenCredential" + subscription_id, # type: str **kwargs # type: Any ): # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") super(MonitorManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential - self.api_version = "2015-07-01" + self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json index 04615e710b290..01811c9b22b57 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_metadata.json @@ -1,6 +1,6 @@ { "chosen_version": "2015-07-01", - "total_api_version_list": ["2015-07-01"], + "total_api_version_list": ["2014-04-01", "2015-07-01"], "client": { "name": "MonitorManagementClient", "filename": "_monitor_management_client", @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -18,32 +20,87 @@ "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, # type: \"AsyncTokenCredential\"", + "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" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "service_diagnostic_settings": "ServiceDiagnosticSettingsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "service_diagnostic_settings": "ServiceDiagnosticSettingsOperations", + "metric_definitions": "MetricDefinitionsOperations", + "alert_rules": "AlertRulesOperations", + "operations": "Operations" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py index dfd0c5dbf56ab..2f4d172e5c2af 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py @@ -16,9 +16,13 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ServiceDiagnosticSettingsOperations +from .operations import MetricDefinitionsOperations +from .operations import AlertRulesOperations +from .operations import Operations from . import models @@ -27,21 +31,30 @@ class MonitorManagementClient(object): :ivar service_diagnostic_settings: ServiceDiagnosticSettingsOperations operations :vartype service_diagnostic_settings: $(python-base-namespace).v2015_07_01.operations.ServiceDiagnosticSettingsOperations + :ivar metric_definitions: MetricDefinitionsOperations operations + :vartype metric_definitions: $(python-base-namespace).v2015_07_01.operations.MetricDefinitionsOperations + :ivar alert_rules: AlertRulesOperations operations + :vartype alert_rules: $(python-base-namespace).v2015_07_01.operations.AlertRulesOperations + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2015_07_01.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str :param str base_url: Service URL """ def __init__( self, credential, # type: "TokenCredential" + subscription_id, # type: str base_url=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -51,6 +64,30 @@ def __init__( self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + self.metric_definitions = MetricDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py index 514386e5d2736..a1b513c610d41 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,19 +27,24 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str """ def __init__( self, credential: "AsyncTokenCredential", + subscription_id: str, **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") super(MonitorManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential - self.api_version = "2015-07-01" + self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py index ba78ca1a42c1b..dc53aa1b361b6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -17,6 +18,9 @@ from ._configuration import MonitorManagementClientConfiguration from .operations import ServiceDiagnosticSettingsOperations +from .operations import MetricDefinitionsOperations +from .operations import AlertRulesOperations +from .operations import Operations from .. import models @@ -25,20 +29,29 @@ class MonitorManagementClient(object): :ivar service_diagnostic_settings: ServiceDiagnosticSettingsOperations operations :vartype service_diagnostic_settings: $(python-base-namespace).v2015_07_01.aio.operations.ServiceDiagnosticSettingsOperations + :ivar metric_definitions: MetricDefinitionsOperations operations + :vartype metric_definitions: $(python-base-namespace).v2015_07_01.aio.operations.MetricDefinitionsOperations + :ivar alert_rules: AlertRulesOperations operations + :vartype alert_rules: $(python-base-namespace).v2015_07_01.aio.operations.AlertRulesOperations + :ivar operations: Operations operations + :vartype operations: $(python-base-namespace).v2015_07_01.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str :param str base_url: Service URL """ def __init__( self, credential: "AsyncTokenCredential", + subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -48,6 +61,29 @@ def __init__( self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + self.metric_definitions = MetricDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/__init__.py index c7d51f79a3e23..28c5041be1cd1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/__init__.py @@ -7,7 +7,13 @@ # -------------------------------------------------------------------------- from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations +from ._metric_definitions_operations import MetricDefinitionsOperations +from ._alert_rules_operations import AlertRulesOperations +from ._operations import Operations __all__ = [ 'ServiceDiagnosticSettingsOperations', + 'MetricDefinitionsOperations', + 'AlertRulesOperations', + 'Operations', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_alert_rules_operations.py new file mode 100644 index 0000000000000..cd9b17b873eb8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_alert_rules_operations.py @@ -0,0 +1,438 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AlertRulesOperations: + """AlertRulesOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_07_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + rule_name: str, + parameters: "_models.AlertRuleResource", + **kwargs: Any + ) -> "_models.AlertRuleResource": + """Creates or updates a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AlertRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.AlertRuleResource": + """Gets a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + rule_name: str, + alert_rules_resource: "_models.AlertRuleResourcePatch", + **kwargs: Any + ) -> "_models.AlertRuleResource": + """Updates an existing classic metric AlertRuleResource. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param alert_rules_resource: Parameters supplied to the operation. + :type alert_rules_resource: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: + """List the classic metric alert rules within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: + """List the classic metric alert rules within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_metric_definitions_operations.py new file mode 100644 index 0000000000000..dd48cd1609cb8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_metric_definitions_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MetricDefinitionsOperations: + """MetricDefinitionsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_07_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_uri: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.MetricDefinitionCollection"]: + """Lists the metric definitions for the resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param filter: Reduces the set of data collected by retrieving particular metric definitions + from all the definitions available for the resource.:code:`
`For example, to get just the + definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% + Processor Time'.:code:`
`Multiple metrics can be retrieved by joining together *'name eq + :code:``'* clauses separated by *or* logical operators.:code:`
`\ **NOTE**\ : No + other syntax is allowed. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_07_01.models.MetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MetricDefinitionCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_operations.py new file mode 100644 index 0000000000000..969fd85250f87 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_operations.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_07_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + **kwargs: Any + ) -> "_models.OperationListResult": + """Lists all of the available operations from Microsoft.Insights provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-07-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py index 6032168120e40..12badcc3e8df8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/operations/_service_diagnostic_settings_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get( self, resource_uri: str, - **kwargs + **kwargs: Any ) -> "_models.ServiceDiagnosticSettingsResource": """Gets the active diagnostic settings for the specified resource. @@ -83,7 +83,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) @@ -98,7 +98,7 @@ async def create_or_update( self, resource_uri: str, parameters: "_models.ServiceDiagnosticSettingsResource", - **kwargs + **kwargs: Any ) -> "_models.ServiceDiagnosticSettingsResource": """Create or update new diagnostic settings for the specified resource. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py index f1974dfd3d2d4..751752c69a4bb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py @@ -7,25 +7,123 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AlertRuleResource + from ._models_py3 import AlertRuleResourceCollection + from ._models_py3 import AlertRuleResourcePatch + from ._models_py3 import DimensionProperties + from ._models_py3 import ErrorContract from ._models_py3 import ErrorResponse + from ._models_py3 import LocalizableString + from ._models_py3 import LocationThresholdRuleCondition from ._models_py3 import LogSettings + from ._models_py3 import LogSpecification + from ._models_py3 import ManagementEventAggregationCondition + from ._models_py3 import ManagementEventRuleCondition + from ._models_py3 import MetricAvailability + from ._models_py3 import MetricAvailabilityLocation + from ._models_py3 import MetricDefinition + from ._models_py3 import MetricDefinitionCollection from ._models_py3 import MetricSettings + from ._models_py3 import MetricSpecification + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import Resource from ._models_py3 import RetentionPolicy + from ._models_py3 import RuleAction + from ._models_py3 import RuleCondition + from ._models_py3 import RuleDataSource + from ._models_py3 import RuleEmailAction + from ._models_py3 import RuleManagementEventClaimsDataSource + from ._models_py3 import RuleManagementEventDataSource + from ._models_py3 import RuleMetricDataSource + from ._models_py3 import RuleWebhookAction from ._models_py3 import ServiceDiagnosticSettingsResource + from ._models_py3 import ServiceSpecification + from ._models_py3 import TableInfoEntry + from ._models_py3 import ThresholdRuleCondition except (SyntaxError, ImportError): + from ._models import AlertRuleResource # type: ignore + from ._models import AlertRuleResourceCollection # type: ignore + from ._models import AlertRuleResourcePatch # type: ignore + from ._models import DimensionProperties # type: ignore + from ._models import ErrorContract # type: ignore from ._models import ErrorResponse # type: ignore + from ._models import LocalizableString # type: ignore + from ._models import LocationThresholdRuleCondition # type: ignore from ._models import LogSettings # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagementEventAggregationCondition # type: ignore + from ._models import ManagementEventRuleCondition # type: ignore + from ._models import MetricAvailability # type: ignore + from ._models import MetricAvailabilityLocation # type: ignore + from ._models import MetricDefinition # type: ignore + from ._models import MetricDefinitionCollection # type: ignore from ._models import MetricSettings # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore from ._models import Resource # type: ignore from ._models import RetentionPolicy # type: ignore + from ._models import RuleAction # type: ignore + from ._models import RuleCondition # type: ignore + from ._models import RuleDataSource # type: ignore + from ._models import RuleEmailAction # type: ignore + from ._models import RuleManagementEventClaimsDataSource # type: ignore + from ._models import RuleManagementEventDataSource # type: ignore + from ._models import RuleMetricDataSource # type: ignore + from ._models import RuleWebhookAction # type: ignore from ._models import ServiceDiagnosticSettingsResource # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import TableInfoEntry # type: ignore + from ._models import ThresholdRuleCondition # type: ignore + +from ._monitor_management_client_enums import ( + AggregationType, + ConditionOperator, + TimeAggregationOperator, + Unit, +) __all__ = [ + 'AlertRuleResource', + 'AlertRuleResourceCollection', + 'AlertRuleResourcePatch', + 'DimensionProperties', + 'ErrorContract', 'ErrorResponse', + 'LocalizableString', + 'LocationThresholdRuleCondition', 'LogSettings', + 'LogSpecification', + 'ManagementEventAggregationCondition', + 'ManagementEventRuleCondition', + 'MetricAvailability', + 'MetricAvailabilityLocation', + 'MetricDefinition', + 'MetricDefinitionCollection', 'MetricSettings', + 'MetricSpecification', + 'Operation', + 'OperationDisplay', + 'OperationListResult', 'Resource', 'RetentionPolicy', + 'RuleAction', + 'RuleCondition', + 'RuleDataSource', + 'RuleEmailAction', + 'RuleManagementEventClaimsDataSource', + 'RuleManagementEventDataSource', + 'RuleMetricDataSource', + 'RuleWebhookAction', 'ServiceDiagnosticSettingsResource', + 'ServiceSpecification', + 'TableInfoEntry', + 'ThresholdRuleCondition', + 'AggregationType', + 'ConditionOperator', + 'TimeAggregationOperator', + 'Unit', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py index b6bd008c194f4..6381ac0370dc9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models.py @@ -10,6 +10,265 @@ import msrest.serialization +class Resource(msrest.serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class AlertRuleResource(Resource): + """The alert rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name_properties_name: Required. the name of the alert rule. + :type name_properties_name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: Required. the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_07_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_07_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_07_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'name_properties_name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleResource, self).__init__(**kwargs) + self.name_properties_name = kwargs['name_properties_name'] + self.description = kwargs.get('description', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.is_enabled = kwargs['is_enabled'] + self.condition = kwargs['condition'] + self.action = kwargs.get('action', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + +class AlertRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: list[~$(python-base-namespace).v2015_07_01.models.AlertRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AlertRuleResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class AlertRuleResourcePatch(msrest.serialization.Model): + """The alert rule object for patch operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name: the name of the alert rule. + :type name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_07_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_07_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_07_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.is_enabled = kwargs.get('is_enabled', None) + self.condition = kwargs.get('condition', None) + self.action = kwargs.get('action', None) + self.actions = kwargs.get('actions', None) + self.last_updated_time = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Legacy usage, should not set. + :type to_be_exported_for_shoebox: bool + :param is_hidden: When set, the dimension is hidden from the customer, used in conjunction with + the defaultDimensionValues field below. + :type is_hidden: bool + :param default_dimension_values: Default dimension value to be sent down for the hidden + dimension during query. + :type default_dimension_values: any + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + 'is_hidden': {'key': 'isHidden', 'type': 'bool'}, + 'default_dimension_values': {'key': 'defaultDimensionValues', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) + self.is_hidden = kwargs.get('is_hidden', None) + self.default_dimension_values = kwargs.get('default_dimension_values', None) + + +class ErrorContract(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~$(python-base-namespace).v2015_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorContract, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. @@ -20,52 +279,414 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class LocalizableString(msrest.serialization.Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LocalizableString, self).__init__(**kwargs) + self.value = kwargs['value'] + self.localized_value = kwargs.get('localized_value', None) + + +class RuleCondition(msrest.serialization.Model): + """The condition that results in the alert rule being activated. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: LocationThresholdRuleCondition, ManagementEventRuleCondition, ThresholdRuleCondition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition': 'LocationThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition': 'ManagementEventRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition': 'ThresholdRuleCondition'} + } + + def __init__( + self, + **kwargs + ): + super(RuleCondition, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.data_source = kwargs.get('data_source', None) + + +class LocationThresholdRuleCondition(RuleCondition): + """A rule condition based on a certain number of locations failing. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param failed_location_count: Required. the number of locations that must fail to activate the + alert. + :type failed_location_count: int + """ + + _validation = { + 'odata_type': {'required': True}, + 'failed_location_count': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'failed_location_count': {'key': 'failedLocationCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(LocationThresholdRuleCondition, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' # type: str + self.window_size = kwargs.get('window_size', None) + self.failed_location_count = kwargs['failed_location_count'] + + +class LogSettings(msrest.serialization.Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type this setting is applied + to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET + diagnostic settings operation. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: ~$(python-base-namespace).v2015_07_01.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.enabled = kwargs['enabled'] + self.retention_policy = kwargs.get('retention_policy', None) + + +class LogSpecification(msrest.serialization.Model): + """Log specification of operation. + + :param name: Name of log specification. + :type name: str + :param display_name: Display name of log specification. + :type display_name: str + :param blob_duration: Blob duration of specification. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class ManagementEventAggregationCondition(msrest.serialization.Model): + """How the data that is collected should be combined over time. + + :param operator: the condition operator. Possible values include: "GreaterThan", + "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_07_01.models.ConditionOperator + :param threshold: The threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + """ + + _attribute_map = { + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementEventAggregationCondition, self).__init__(**kwargs) + self.operator = kwargs.get('operator', None) + self.threshold = kwargs.get('threshold', None) + self.window_size = kwargs.get('window_size', None) + + +class ManagementEventRuleCondition(RuleCondition): + """A management event rule condition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + :param aggregation: How the data that is collected should be combined over time and when the + alert is activated. Note that for management event alerts aggregation is optional – if it is + not provided then any event will cause the alert to activate. + :type aggregation: + ~$(python-base-namespace).v2015_07_01.models.ManagementEventAggregationCondition + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'aggregation': {'key': 'aggregation', 'type': 'ManagementEventAggregationCondition'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementEventRuleCondition, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' # type: str + self.aggregation = kwargs.get('aggregation', None) + + +class MetricAvailability(msrest.serialization.Model): + """Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for the metric. Expressed + as a duration 'PT1M', 'P1D', etc. + :type time_grain: ~datetime.timedelta + :param retention: the retention period for the metric at the specified timegrain. Expressed as + a duration 'PT1M', 'P1D', etc. + :type retention: ~datetime.timedelta + :param location: Info about where the metric data is stored. + :type location: ~$(python-base-namespace).v2015_07_01.models.MetricAvailabilityLocation + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + 'location': {'key': 'location', 'type': 'MetricAvailabilityLocation'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.retention = kwargs.get('retention', None) + self.location = kwargs.get('location', None) + + +class MetricAvailabilityLocation(msrest.serialization.Model): + """Info about where the metric data is stored. + + :param table_endpoint: The url for the storage account. + :type table_endpoint: str + :param table_info: Info about the storage tables storing this resources metrics. + :type table_info: list[~$(python-base-namespace).v2015_07_01.models.TableInfoEntry] + :param partition_key: partition key in the table where the metrics for this resource are + stored. + :type partition_key: str + """ + + _attribute_map = { + 'table_endpoint': {'key': 'tableEndpoint', 'type': 'str'}, + 'table_info': {'key': 'tableInfo', 'type': '[TableInfoEntry]'}, + 'partition_key': {'key': 'partitionKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricAvailabilityLocation, self).__init__(**kwargs) + self.table_endpoint = kwargs.get('table_endpoint', None) + self.table_info = kwargs.get('table_info', None) + self.partition_key = kwargs.get('partition_key', None) + + +class MetricDefinition(msrest.serialization.Model): + """Metric definition class specifies the metadata for a metric. + + :param resource_id: The resource identifier of the resource that emitted the metric. + :type resource_id: str + :param resource_uri: The resource identifier of the resource that emitted the metric. + :type resource_uri: str + :param name: the name and the display name of the metric, i.e. it is a localizable string. + :type name: ~$(python-base-namespace).v2015_07_01.models.LocalizableString + :param category: The category of this metric. + :type category: str + :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", + "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds". + :type unit: str or ~$(python-base-namespace).v2015_07_01.models.Unit + :param start_time: Start time of the metadata request timespan. + :type start_time: ~datetime.datetime + :param end_time: End time of the metadata request timespan. + :type end_time: ~datetime.datetime + :param primary_aggregation_type: the primary aggregation type value defining how to use the + values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", + "Total". + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2015_07_01.models.AggregationType + :param supported_aggregation_types: List of all aggregations that are applicable for this + metric. + :type supported_aggregation_types: list[str or + ~$(python-base-namespace).v2015_07_01.models.AggregationType] + :param metric_availabilities: the collection of what aggregation intervals are available to be + queried. + :type metric_availabilities: + list[~$(python-base-namespace).v2015_07_01.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'category': {'key': 'category', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) + super(MetricDefinition, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.resource_uri = kwargs.get('resource_uri', None) + self.name = kwargs.get('name', None) + self.category = kwargs.get('category', None) + self.unit = kwargs.get('unit', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.primary_aggregation_type = kwargs.get('primary_aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.metric_availabilities = kwargs.get('metric_availabilities', None) + self.id = kwargs.get('id', None) -class LogSettings(msrest.serialization.Model): - """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. +class MetricDefinitionCollection(msrest.serialization.Model): + """Represents collection of metric definitions. All required parameters must be populated in order to send to Azure. - :param category: Name of a Diagnostic Log category for a resource type this setting is applied - to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET - diagnostic settings operation. - :type category: str - :param enabled: Required. a value indicating whether this log is enabled. - :type enabled: bool - :param retention_policy: the retention policy for this log. - :type retention_policy: ~$(python-base-namespace).v2015_07_01.models.RetentionPolicy + :param id: Resource Id for these metric definitions. + :type id: str + :param value: Required. the values for the metric definitions. + :type value: list[~$(python-base-namespace).v2015_07_01.models.MetricDefinition] """ _validation = { - 'enabled': {'required': True}, + 'value': {'required': True}, } _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[MetricDefinition]'}, } def __init__( self, **kwargs ): - super(LogSettings, self).__init__(**kwargs) - self.category = kwargs.get('category', None) - self.enabled = kwargs['enabled'] - self.retention_policy = kwargs.get('retention_policy', None) + super(MetricDefinitionCollection, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.value = kwargs['value'] class MetricSettings(msrest.serialization.Model): @@ -102,50 +723,162 @@ def __init__( self.retention_policy = kwargs.get('retention_policy', None) -class Resource(msrest.serialization.Model): - """An azure resource object. +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. - Variables are only populated by the server, and will be ignored when sending a request. + :param name: The name of the metric. + :type name: str + :param display_name: Display name of the metric. + :type display_name: str + :param display_description: Display description of the metric. + :type display_description: str + :param unit: The metric unit. Possible values include: + Count,Bytes,Seconds,Percent,CountPerSecond,BytesPerSecond,MilliSeconds,ByteSeconds,Unspecified,BitsPerSecond,Cores,MilliCores,NanoCores. + :type unit: str + :param aggregation_type: The default metric aggregation type. Possible values include: + Total,Average,Maximum,Minimum,Count. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param availabilities: The supported time grain types for the metrics. + :type availabilities: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param category: Category or type of metric. + :type category: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~$(python-base-namespace).v2015_07_01.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill empty gaps with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ - All required parameters must be populated in order to send to Azure. + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'availabilities': {'key': 'availabilities', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + def __init__( + self, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) + self.availabilities = kwargs.get('availabilities', None) + self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) + self.category = kwargs.get('category', None) + self.dimensions = kwargs.get('dimensions', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) + + +class Operation(msrest.serialization.Model): + """Microsoft Insights API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool + :param display: Display metadata associated with the operation. + :type display: ~$(python-base-namespace).v2015_07_01.models.OperationDisplay + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~$(python-base-namespace).v2015_07_01.models.ServiceSpecification """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.service_specification = kwargs.get('service_specification', None) + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param publisher: The publisher of this operation. + :type publisher: str + :param provider: Service provider: Microsoft.Insights. + :type provider: str + :param resource: Resource on which the operation is performed: AlertRules, Autoscale, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: The description of the operation. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Insights operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of operations supported by the Microsoft.Insights provider. + :type value: list[~$(python-base-namespace).v2015_07_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) class RetentionPolicy(msrest.serialization.Model): @@ -179,6 +912,303 @@ def __init__( self.days = kwargs['days'] +class RuleAction(msrest.serialization.Model): + """The action that is performed when the alert rule becomes active, and when an alert condition is resolved. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleEmailAction, RuleWebhookAction. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleEmailAction': 'RuleEmailAction', 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction': 'RuleWebhookAction'} + } + + def __init__( + self, + **kwargs + ): + super(RuleAction, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + + +class RuleDataSource(msrest.serialization.Model): + """The resource from which the rule collects its data. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleManagementEventDataSource, RuleMetricDataSource. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource': 'RuleManagementEventDataSource', 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource': 'RuleMetricDataSource'} + } + + def __init__( + self, + **kwargs + ): + super(RuleDataSource, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.resource_uri = kwargs.get('resource_uri', None) + self.legacy_resource_id = kwargs.get('legacy_resource_id', None) + self.resource_location = kwargs.get('resource_location', None) + self.metric_namespace = kwargs.get('metric_namespace', None) + + +class RuleEmailAction(RuleAction): + """Specifies the action to send email when the rule condition is evaluated. The discriminator is always RuleEmailAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param send_to_service_owners: Whether the administrators (service and co-administrators) of + the service should be notified when the alert is activated. + :type send_to_service_owners: bool + :param custom_emails: the list of administrator's custom email addresses to notify of the + activation of the alert. + :type custom_emails: list[str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'send_to_service_owners': {'key': 'sendToServiceOwners', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleEmailAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction' # type: str + self.send_to_service_owners = kwargs.get('send_to_service_owners', None) + self.custom_emails = kwargs.get('custom_emails', None) + + +class RuleManagementEventClaimsDataSource(msrest.serialization.Model): + """The claims for a rule management event data source. + + :param email_address: the email address. + :type email_address: str + """ + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleManagementEventClaimsDataSource, self).__init__(**kwargs) + self.email_address = kwargs.get('email_address', None) + + +class RuleManagementEventDataSource(RuleDataSource): + """A rule management event data source. The discriminator fields is always RuleManagementEventDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param event_name: the event name. + :type event_name: str + :param event_source: the event source. + :type event_source: str + :param level: the level. + :type level: str + :param operation_name: The name of the operation that should be checked for. If no name is + provided, any operation will match. + :type operation_name: str + :param resource_group_name: the resource group name. + :type resource_group_name: str + :param resource_provider_name: the resource provider name. + :type resource_provider_name: str + :param status: The status of the operation that should be checked for. If no status is + provided, any status will match. + :type status: str + :param sub_status: the substatus. + :type sub_status: str + :param claims: the claims. + :type claims: ~$(python-base-namespace).v2015_07_01.models.RuleManagementEventClaimsDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'str'}, + 'event_source': {'key': 'eventSource', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'sub_status': {'key': 'subStatus', 'type': 'str'}, + 'claims': {'key': 'claims', 'type': 'RuleManagementEventClaimsDataSource'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleManagementEventDataSource, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' # type: str + self.event_name = kwargs.get('event_name', None) + self.event_source = kwargs.get('event_source', None) + self.level = kwargs.get('level', None) + self.operation_name = kwargs.get('operation_name', None) + self.resource_group_name = kwargs.get('resource_group_name', None) + self.resource_provider_name = kwargs.get('resource_provider_name', None) + self.status = kwargs.get('status', None) + self.sub_status = kwargs.get('sub_status', None) + self.claims = kwargs.get('claims', None) + + +class RuleMetricDataSource(RuleDataSource): + """A rule metric data source. The discriminator value is always RuleMetricDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param metric_name: the name of the metric that defines what the rule monitors. + :type metric_name: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleMetricDataSource, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' # type: str + self.metric_name = kwargs.get('metric_name', None) + + +class RuleWebhookAction(RuleAction): + """Specifies the action to post to service when the rule condition is evaluated. The discriminator is always RuleWebhookAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param service_uri: the service uri to Post the notification when the alert activates or + resolves. + :type service_uri: str + :param properties: the dictionary of custom properties to include with the post operation. + These data are appended to the webhook payload. + :type properties: dict[str, str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleWebhookAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' # type: str + self.service_uri = kwargs.get('service_uri', None) + self.properties = kwargs.get('properties', None) + + class ServiceDiagnosticSettingsResource(Resource): """Description of a service diagnostic setting. @@ -209,8 +1239,7 @@ class ServiceDiagnosticSettingsResource(Resource): :type logs: list[~$(python-base-namespace).v2015_07_01.models.LogSettings] :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -244,3 +1273,123 @@ def __init__( self.metrics = kwargs.get('metrics', None) self.logs = kwargs.get('logs', None) self.workspace_id = kwargs.get('workspace_id', None) + + +class ServiceSpecification(msrest.serialization.Model): + """One property of operation, include log specifications. + + :param log_specifications: Log specifications of operation. + :type log_specifications: list[~$(python-base-namespace).v2015_07_01.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~$(python-base-namespace).v2015_07_01.models.MetricSpecification] + :param legacy_metric_specifications: Legacy Metric specifications for operation. Deprecated, do + not use. + :type legacy_metric_specifications: any + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + 'legacy_metric_specifications': {'key': 'legacyMetricSpecifications', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) + self.legacy_metric_specifications = kwargs.get('legacy_metric_specifications', None) + + +class TableInfoEntry(msrest.serialization.Model): + """Info about a storage table with metric data. + + :param table_name: Name of a table with metric data for this resource. + :type table_name: str + :param start_time: Start time of the metrics in this table. + :type start_time: ~datetime.datetime + :param end_time: End time of the metrics in this table. + :type end_time: ~datetime.datetime + :param sas_token: For the storage account with metrics. + :type sas_token: str + :param sas_token_expiration_time: For the storage account with metrics. + :type sas_token_expiration_time: ~datetime.datetime + """ + + _attribute_map = { + 'table_name': {'key': 'tableName', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'sas_token': {'key': 'sasToken', 'type': 'str'}, + 'sas_token_expiration_time': {'key': 'sasTokenExpirationTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TableInfoEntry, self).__init__(**kwargs) + self.table_name = kwargs.get('table_name', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.sas_token = kwargs.get('sas_token', None) + self.sas_token_expiration_time = kwargs.get('sas_token_expiration_time', None) + + +class ThresholdRuleCondition(RuleCondition): + """A rule condition based on a metric crossing a threshold. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + :param operator: Required. the operator used to compare the data and the threshold. Possible + values include: "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_07_01.models.ConditionOperator + :param threshold: Required. the threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param time_aggregation: the time aggregation operator. How the data that are collected should + be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible + values include: "Average", "Minimum", "Maximum", "Total", "Last". + :type time_aggregation: str or + ~$(python-base-namespace).v2015_07_01.models.TimeAggregationOperator + """ + + _validation = { + 'odata_type': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ThresholdRuleCondition, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' # type: str + self.operator = kwargs['operator'] + self.threshold = kwargs['threshold'] + self.window_size = kwargs.get('window_size', None) + self.time_aggregation = kwargs.get('time_aggregation', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py index 92a694055575d..5b0966ae54965 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_models_py3.py @@ -7,11 +7,304 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._monitor_management_client_enums import * + + +class Resource(msrest.serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class AlertRuleResource(Resource): + """The alert rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name_properties_name: Required. the name of the alert rule. + :type name_properties_name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: Required. the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: Required. the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_07_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_07_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_07_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'name_properties_name': {'required': True}, + 'is_enabled': {'required': True}, + 'condition': {'required': True}, + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + name_properties_name: str, + is_enabled: bool, + condition: "RuleCondition", + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + provisioning_state: Optional[str] = None, + action: Optional["RuleAction"] = None, + actions: Optional[List["RuleAction"]] = None, + **kwargs + ): + super(AlertRuleResource, self).__init__(location=location, tags=tags, **kwargs) + self.name_properties_name = name_properties_name + self.description = description + self.provisioning_state = provisioning_state + self.is_enabled = is_enabled + self.condition = condition + self.action = action + self.actions = actions + self.last_updated_time = None + + +class AlertRuleResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: the values for the alert rule resources. + :type value: list[~$(python-base-namespace).v2015_07_01.models.AlertRuleResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AlertRuleResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["AlertRuleResource"]] = None, + **kwargs + ): + super(AlertRuleResourceCollection, self).__init__(**kwargs) + self.value = value + + +class AlertRuleResourcePatch(msrest.serialization.Model): + """The alert rule object for patch operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param name: the name of the alert rule. + :type name: str + :param description: the description of the alert rule that will be included in the alert email. + :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str + :param is_enabled: the flag that indicates whether the alert rule is enabled. + :type is_enabled: bool + :param condition: the condition that results in the alert rule being activated. + :type condition: ~$(python-base-namespace).v2015_07_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2015_07_01.models.RuleAction + :param actions: the array of actions that are performed when the alert rule becomes active, and + when an alert condition is resolved. + :type actions: list[~$(python-base-namespace).v2015_07_01.models.RuleAction] + :ivar last_updated_time: Last time the rule was updated in ISO8601 format. + :vartype last_updated_time: ~datetime.datetime + """ + + _validation = { + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, + 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, + 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + name: Optional[str] = None, + description: Optional[str] = None, + provisioning_state: Optional[str] = None, + is_enabled: Optional[bool] = None, + condition: Optional["RuleCondition"] = None, + action: Optional["RuleAction"] = None, + actions: Optional[List["RuleAction"]] = None, + **kwargs + ): + super(AlertRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.name = name + self.description = description + self.provisioning_state = provisioning_state + self.is_enabled = is_enabled + self.condition = condition + self.action = action + self.actions = actions + self.last_updated_time = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Legacy usage, should not set. + :type to_be_exported_for_shoebox: bool + :param is_hidden: When set, the dimension is hidden from the customer, used in conjunction with + the defaultDimensionValues field below. + :type is_hidden: bool + :param default_dimension_values: Default dimension value to be sent down for the hidden + dimension during query. + :type default_dimension_values: any + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + 'is_hidden': {'key': 'isHidden', 'type': 'bool'}, + 'default_dimension_values': {'key': 'defaultDimensionValues', 'type': 'object'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + is_hidden: Optional[bool] = None, + default_dimension_values: Optional[Any] = None, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + self.is_hidden = is_hidden + self.default_dimension_values = default_dimension_values + + +class ErrorContract(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~$(python-base-namespace).v2015_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(ErrorContract, self).__init__(**kwargs) + self.error = error + class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. @@ -39,6 +332,128 @@ def __init__( self.message = message +class LocalizableString(msrest.serialization.Model): + """The localizable string class. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. the invariant value. + :type value: str + :param localized_value: the locale specific value. + :type localized_value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: str, + localized_value: Optional[str] = None, + **kwargs + ): + super(LocalizableString, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class RuleCondition(msrest.serialization.Model): + """The condition that results in the alert rule being activated. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: LocationThresholdRuleCondition, ManagementEventRuleCondition, ThresholdRuleCondition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition': 'LocationThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition': 'ManagementEventRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition': 'ThresholdRuleCondition'} + } + + def __init__( + self, + *, + data_source: Optional["RuleDataSource"] = None, + **kwargs + ): + super(RuleCondition, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.data_source = data_source + + +class LocationThresholdRuleCondition(RuleCondition): + """A rule condition based on a certain number of locations failing. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param failed_location_count: Required. the number of locations that must fail to activate the + alert. + :type failed_location_count: int + """ + + _validation = { + 'odata_type': {'required': True}, + 'failed_location_count': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'failed_location_count': {'key': 'failedLocationCount', 'type': 'int'}, + } + + def __init__( + self, + *, + failed_location_count: int, + data_source: Optional["RuleDataSource"] = None, + window_size: Optional[datetime.timedelta] = None, + **kwargs + ): + super(LocationThresholdRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' # type: str + self.window_size = window_size + self.failed_location_count = failed_location_count + + class LogSettings(msrest.serialization.Model): """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. @@ -55,27 +470,310 @@ class LogSettings(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + *, + enabled: bool, + category: Optional[str] = None, + retention_policy: Optional["RetentionPolicy"] = None, + **kwargs + ): + super(LogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled + self.retention_policy = retention_policy + + +class LogSpecification(msrest.serialization.Model): + """Log specification of operation. + + :param name: Name of log specification. + :type name: str + :param display_name: Display name of log specification. + :type display_name: str + :param blob_duration: Blob duration of specification. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagementEventAggregationCondition(msrest.serialization.Model): + """How the data that is collected should be combined over time. + + :param operator: the condition operator. Possible values include: "GreaterThan", + "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_07_01.models.ConditionOperator + :param threshold: The threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + """ + + _attribute_map = { + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + } + + def __init__( + self, + *, + operator: Optional[Union[str, "ConditionOperator"]] = None, + threshold: Optional[float] = None, + window_size: Optional[datetime.timedelta] = None, + **kwargs + ): + super(ManagementEventAggregationCondition, self).__init__(**kwargs) + self.operator = operator + self.threshold = threshold + self.window_size = window_size + + +class ManagementEventRuleCondition(RuleCondition): + """A management event rule condition. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + :param aggregation: How the data that is collected should be combined over time and when the + alert is activated. Note that for management event alerts aggregation is optional – if it is + not provided then any event will cause the alert to activate. + :type aggregation: + ~$(python-base-namespace).v2015_07_01.models.ManagementEventAggregationCondition + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'aggregation': {'key': 'aggregation', 'type': 'ManagementEventAggregationCondition'}, + } + + def __init__( + self, + *, + data_source: Optional["RuleDataSource"] = None, + aggregation: Optional["ManagementEventAggregationCondition"] = None, + **kwargs + ): + super(ManagementEventRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' # type: str + self.aggregation = aggregation + + +class MetricAvailability(msrest.serialization.Model): + """Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain. + + :param time_grain: the time grain specifies the aggregation interval for the metric. Expressed + as a duration 'PT1M', 'P1D', etc. + :type time_grain: ~datetime.timedelta + :param retention: the retention period for the metric at the specified timegrain. Expressed as + a duration 'PT1M', 'P1D', etc. + :type retention: ~datetime.timedelta + :param location: Info about where the metric data is stored. + :type location: ~$(python-base-namespace).v2015_07_01.models.MetricAvailabilityLocation + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'retention': {'key': 'retention', 'type': 'duration'}, + 'location': {'key': 'location', 'type': 'MetricAvailabilityLocation'}, + } + + def __init__( + self, + *, + time_grain: Optional[datetime.timedelta] = None, + retention: Optional[datetime.timedelta] = None, + location: Optional["MetricAvailabilityLocation"] = None, + **kwargs + ): + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = time_grain + self.retention = retention + self.location = location + + +class MetricAvailabilityLocation(msrest.serialization.Model): + """Info about where the metric data is stored. + + :param table_endpoint: The url for the storage account. + :type table_endpoint: str + :param table_info: Info about the storage tables storing this resources metrics. + :type table_info: list[~$(python-base-namespace).v2015_07_01.models.TableInfoEntry] + :param partition_key: partition key in the table where the metrics for this resource are + stored. + :type partition_key: str + """ + + _attribute_map = { + 'table_endpoint': {'key': 'tableEndpoint', 'type': 'str'}, + 'table_info': {'key': 'tableInfo', 'type': '[TableInfoEntry]'}, + 'partition_key': {'key': 'partitionKey', 'type': 'str'}, + } + + def __init__( + self, + *, + table_endpoint: Optional[str] = None, + table_info: Optional[List["TableInfoEntry"]] = None, + partition_key: Optional[str] = None, + **kwargs + ): + super(MetricAvailabilityLocation, self).__init__(**kwargs) + self.table_endpoint = table_endpoint + self.table_info = table_info + self.partition_key = partition_key + + +class MetricDefinition(msrest.serialization.Model): + """Metric definition class specifies the metadata for a metric. + + :param resource_id: The resource identifier of the resource that emitted the metric. + :type resource_id: str + :param resource_uri: The resource identifier of the resource that emitted the metric. + :type resource_uri: str + :param name: the name and the display name of the metric, i.e. it is a localizable string. + :type name: ~$(python-base-namespace).v2015_07_01.models.LocalizableString + :param category: The category of this metric. + :type category: str + :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", + "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds". + :type unit: str or ~$(python-base-namespace).v2015_07_01.models.Unit + :param start_time: Start time of the metadata request timespan. + :type start_time: ~datetime.datetime + :param end_time: End time of the metadata request timespan. + :type end_time: ~datetime.datetime + :param primary_aggregation_type: the primary aggregation type value defining how to use the + values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", + "Total". + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2015_07_01.models.AggregationType + :param supported_aggregation_types: List of all aggregations that are applicable for this + metric. + :type supported_aggregation_types: list[str or + ~$(python-base-namespace).v2015_07_01.models.AggregationType] + :param metric_availabilities: the collection of what aggregation intervals are available to be + queried. + :type metric_availabilities: + list[~$(python-base-namespace).v2015_07_01.models.MetricAvailability] + :param id: the resource identifier of the metric definition. + :type id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'category': {'key': 'category', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + resource_uri: Optional[str] = None, + name: Optional["LocalizableString"] = None, + category: Optional[str] = None, + unit: Optional[Union[str, "Unit"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + primary_aggregation_type: Optional[Union[str, "AggregationType"]] = None, + supported_aggregation_types: Optional[List[Union[str, "AggregationType"]]] = None, + metric_availabilities: Optional[List["MetricAvailability"]] = None, + id: Optional[str] = None, + **kwargs + ): + super(MetricDefinition, self).__init__(**kwargs) + self.resource_id = resource_id + self.resource_uri = resource_uri + self.name = name + self.category = category + self.unit = unit + self.start_time = start_time + self.end_time = end_time + self.primary_aggregation_type = primary_aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.metric_availabilities = metric_availabilities + self.id = id + + +class MetricDefinitionCollection(msrest.serialization.Model): + """Represents collection of metric definitions. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id for these metric definitions. + :type id: str + :param value: Required. the values for the metric definitions. + :type value: list[~$(python-base-namespace).v2015_07_01.models.MetricDefinition] + """ + + _validation = { + 'value': {'required': True}, } _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[MetricDefinition]'}, } def __init__( self, *, - enabled: bool, - category: Optional[str] = None, - retention_policy: Optional["RetentionPolicy"] = None, + value: List["MetricDefinition"], + id: Optional[str] = None, **kwargs ): - super(LogSettings, self).__init__(**kwargs) - self.category = category - self.enabled = enabled - self.retention_policy = retention_policy + super(MetricDefinitionCollection, self).__init__(**kwargs) + self.id = id + self.value = value class MetricSettings(msrest.serialization.Model): @@ -116,53 +814,190 @@ def __init__( self.retention_policy = retention_policy -class Resource(msrest.serialization.Model): - """An azure resource object. +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. - Variables are only populated by the server, and will be ignored when sending a request. + :param name: The name of the metric. + :type name: str + :param display_name: Display name of the metric. + :type display_name: str + :param display_description: Display description of the metric. + :type display_description: str + :param unit: The metric unit. Possible values include: + Count,Bytes,Seconds,Percent,CountPerSecond,BytesPerSecond,MilliSeconds,ByteSeconds,Unspecified,BitsPerSecond,Cores,MilliCores,NanoCores. + :type unit: str + :param aggregation_type: The default metric aggregation type. Possible values include: + Total,Average,Maximum,Minimum,Count. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param availabilities: The supported time grain types for the metrics. + :type availabilities: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param category: Category or type of metric. + :type category: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~$(python-base-namespace).v2015_07_01.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill empty gaps with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ - All required parameters must be populated in order to send to Azure. + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'availabilities': {'key': 'availabilities', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + availabilities: Optional[List[str]] = None, + lock_aggregation_type: Optional[str] = None, + category: Optional[str] = None, + dimensions: Optional[List["DimensionProperties"]] = None, + fill_gap_with_zero: Optional[bool] = None, + internal_metric_name: Optional[str] = None, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.availabilities = availabilities + self.lock_aggregation_type = lock_aggregation_type + self.category = category + self.dimensions = dimensions + self.fill_gap_with_zero = fill_gap_with_zero + self.internal_metric_name = internal_metric_name + + +class Operation(msrest.serialization.Model): + """Microsoft Insights API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool + :param display: Display metadata associated with the operation. + :type display: ~$(python-base-namespace).v2015_07_01.models.OperationDisplay + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~$(python-base-namespace).v2015_07_01.models.ServiceSpecification """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.service_specification = service_specification + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param publisher: The publisher of this operation. + :type publisher: str + :param provider: Service provider: Microsoft.Insights. + :type provider: str + :param resource: Resource on which the operation is performed: AlertRules, Autoscale, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: The description of the operation. + :type description: str + """ + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, + publisher: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, **kwargs ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags + super(OperationDisplay, self).__init__(**kwargs) + self.publisher = publisher + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Insights operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of operations supported by the Microsoft.Insights provider. + :type value: list[~$(python-base-namespace).v2015_07_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link class RetentionPolicy(msrest.serialization.Model): @@ -199,6 +1034,336 @@ def __init__( self.days = days +class RuleAction(msrest.serialization.Model): + """The action that is performed when the alert rule becomes active, and when an alert condition is resolved. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleEmailAction, RuleWebhookAction. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleEmailAction': 'RuleEmailAction', 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction': 'RuleWebhookAction'} + } + + def __init__( + self, + **kwargs + ): + super(RuleAction, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + + +class RuleDataSource(msrest.serialization.Model): + """The resource from which the rule collects its data. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: RuleManagementEventDataSource, RuleMetricDataSource. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource': 'RuleManagementEventDataSource', 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource': 'RuleMetricDataSource'} + } + + def __init__( + self, + *, + resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, + **kwargs + ): + super(RuleDataSource, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + self.resource_uri = resource_uri + self.legacy_resource_id = legacy_resource_id + self.resource_location = resource_location + self.metric_namespace = metric_namespace + + +class RuleEmailAction(RuleAction): + """Specifies the action to send email when the rule condition is evaluated. The discriminator is always RuleEmailAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param send_to_service_owners: Whether the administrators (service and co-administrators) of + the service should be notified when the alert is activated. + :type send_to_service_owners: bool + :param custom_emails: the list of administrator's custom email addresses to notify of the + activation of the alert. + :type custom_emails: list[str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'send_to_service_owners': {'key': 'sendToServiceOwners', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, + } + + def __init__( + self, + *, + send_to_service_owners: Optional[bool] = None, + custom_emails: Optional[List[str]] = None, + **kwargs + ): + super(RuleEmailAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction' # type: str + self.send_to_service_owners = send_to_service_owners + self.custom_emails = custom_emails + + +class RuleManagementEventClaimsDataSource(msrest.serialization.Model): + """The claims for a rule management event data source. + + :param email_address: the email address. + :type email_address: str + """ + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + email_address: Optional[str] = None, + **kwargs + ): + super(RuleManagementEventClaimsDataSource, self).__init__(**kwargs) + self.email_address = email_address + + +class RuleManagementEventDataSource(RuleDataSource): + """A rule management event data source. The discriminator fields is always RuleManagementEventDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param event_name: the event name. + :type event_name: str + :param event_source: the event source. + :type event_source: str + :param level: the level. + :type level: str + :param operation_name: The name of the operation that should be checked for. If no name is + provided, any operation will match. + :type operation_name: str + :param resource_group_name: the resource group name. + :type resource_group_name: str + :param resource_provider_name: the resource provider name. + :type resource_provider_name: str + :param status: The status of the operation that should be checked for. If no status is + provided, any status will match. + :type status: str + :param sub_status: the substatus. + :type sub_status: str + :param claims: the claims. + :type claims: ~$(python-base-namespace).v2015_07_01.models.RuleManagementEventClaimsDataSource + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'event_name': {'key': 'eventName', 'type': 'str'}, + 'event_source': {'key': 'eventSource', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'operation_name': {'key': 'operationName', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'sub_status': {'key': 'subStatus', 'type': 'str'}, + 'claims': {'key': 'claims', 'type': 'RuleManagementEventClaimsDataSource'}, + } + + def __init__( + self, + *, + resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, + event_name: Optional[str] = None, + event_source: Optional[str] = None, + level: Optional[str] = None, + operation_name: Optional[str] = None, + resource_group_name: Optional[str] = None, + resource_provider_name: Optional[str] = None, + status: Optional[str] = None, + sub_status: Optional[str] = None, + claims: Optional["RuleManagementEventClaimsDataSource"] = None, + **kwargs + ): + super(RuleManagementEventDataSource, self).__init__(resource_uri=resource_uri, legacy_resource_id=legacy_resource_id, resource_location=resource_location, metric_namespace=metric_namespace, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' # type: str + self.event_name = event_name + self.event_source = event_source + self.level = level + self.operation_name = operation_name + self.resource_group_name = resource_group_name + self.resource_provider_name = resource_provider_name + self.status = status + self.sub_status = sub_status + self.claims = claims + + +class RuleMetricDataSource(RuleDataSource): + """A rule metric data source. The discriminator value is always RuleMetricDataSource in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of data source. There are two types of rule + data sources: RuleMetricDataSource and RuleManagementEventDataSource.Constant filled by server. + :type odata_type: str + :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : + this property cannot be updated for an existing rule. + :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str + :param metric_name: the name of the metric that defines what the rule monitors. + :type metric_name: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, + metric_name: Optional[str] = None, + **kwargs + ): + super(RuleMetricDataSource, self).__init__(resource_uri=resource_uri, legacy_resource_id=legacy_resource_id, resource_location=resource_location, metric_namespace=metric_namespace, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' # type: str + self.metric_name = metric_name + + +class RuleWebhookAction(RuleAction): + """Specifies the action to post to service when the rule condition is evaluated. The discriminator is always RuleWebhookAction in this case. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of the action. There are two types of actions: + RuleEmailAction and RuleWebhookAction.Constant filled by server. + :type odata_type: str + :param service_uri: the service uri to Post the notification when the alert activates or + resolves. + :type service_uri: str + :param properties: the dictionary of custom properties to include with the post operation. + These data are appended to the webhook payload. + :type properties: dict[str, str] + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + service_uri: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(RuleWebhookAction, self).__init__(**kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' # type: str + self.service_uri = service_uri + self.properties = properties + + class ServiceDiagnosticSettingsResource(Resource): """Description of a service diagnostic setting. @@ -229,8 +1394,7 @@ class ServiceDiagnosticSettingsResource(Resource): :type logs: list[~$(python-base-namespace).v2015_07_01.models.LogSettings] :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -272,3 +1436,139 @@ def __init__( self.metrics = metrics self.logs = logs self.workspace_id = workspace_id + + +class ServiceSpecification(msrest.serialization.Model): + """One property of operation, include log specifications. + + :param log_specifications: Log specifications of operation. + :type log_specifications: list[~$(python-base-namespace).v2015_07_01.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~$(python-base-namespace).v2015_07_01.models.MetricSpecification] + :param legacy_metric_specifications: Legacy Metric specifications for operation. Deprecated, do + not use. + :type legacy_metric_specifications: any + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + 'legacy_metric_specifications': {'key': 'legacyMetricSpecifications', 'type': 'object'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + legacy_metric_specifications: Optional[Any] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + self.legacy_metric_specifications = legacy_metric_specifications + + +class TableInfoEntry(msrest.serialization.Model): + """Info about a storage table with metric data. + + :param table_name: Name of a table with metric data for this resource. + :type table_name: str + :param start_time: Start time of the metrics in this table. + :type start_time: ~datetime.datetime + :param end_time: End time of the metrics in this table. + :type end_time: ~datetime.datetime + :param sas_token: For the storage account with metrics. + :type sas_token: str + :param sas_token_expiration_time: For the storage account with metrics. + :type sas_token_expiration_time: ~datetime.datetime + """ + + _attribute_map = { + 'table_name': {'key': 'tableName', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'sas_token': {'key': 'sasToken', 'type': 'str'}, + 'sas_token_expiration_time': {'key': 'sasTokenExpirationTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + table_name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + sas_token: Optional[str] = None, + sas_token_expiration_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(TableInfoEntry, self).__init__(**kwargs) + self.table_name = table_name + self.start_time = start_time + self.end_time = end_time + self.sas_token = sas_token + self.sas_token_expiration_time = sas_token_expiration_time + + +class ThresholdRuleCondition(RuleCondition): + """A rule condition based on a metric crossing a threshold. + + All required parameters must be populated in order to send to Azure. + + :param odata_type: Required. specifies the type of condition. This can be one of three types: + ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition + (based on the number of failures of a web test), and ThresholdRuleCondition (based on the + threshold of a metric).Constant filled by server. + :type odata_type: str + :param data_source: the resource from which the rule collects its data. For this type + dataSource will always be of type RuleMetricDataSource. + :type data_source: ~$(python-base-namespace).v2015_07_01.models.RuleDataSource + :param operator: Required. the operator used to compare the data and the threshold. Possible + values include: "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual". + :type operator: str or ~$(python-base-namespace).v2015_07_01.models.ConditionOperator + :param threshold: Required. the threshold value that activates the alert. + :type threshold: float + :param window_size: the period of time (in ISO 8601 duration format) that is used to monitor + alert activity based on the threshold. If specified then it must be between 5 minutes and 1 + day. + :type window_size: ~datetime.timedelta + :param time_aggregation: the time aggregation operator. How the data that are collected should + be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible + values include: "Average", "Minimum", "Maximum", "Total", "Last". + :type time_aggregation: str or + ~$(python-base-namespace).v2015_07_01.models.TimeAggregationOperator + """ + + _validation = { + 'odata_type': {'required': True}, + 'operator': {'required': True}, + 'threshold': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'RuleDataSource'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'window_size': {'key': 'windowSize', 'type': 'duration'}, + 'time_aggregation': {'key': 'timeAggregation', 'type': 'str'}, + } + + def __init__( + self, + *, + operator: Union[str, "ConditionOperator"], + threshold: float, + data_source: Optional["RuleDataSource"] = None, + window_size: Optional[datetime.timedelta] = None, + time_aggregation: Optional[Union[str, "TimeAggregationOperator"]] = None, + **kwargs + ): + super(ThresholdRuleCondition, self).__init__(data_source=data_source, **kwargs) + self.odata_type = 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' # type: str + self.operator = operator + self.threshold = threshold + self.window_size = window_size + self.time_aggregation = time_aggregation diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_monitor_management_client_enums.py new file mode 100644 index 0000000000000..c2b5066b1b064 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_monitor_management_client_enums.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes how metric values are aggregated + """ + + NONE = "None" + AVERAGE = "Average" + COUNT = "Count" + MINIMUM = "Minimum" + MAXIMUM = "Maximum" + TOTAL = "Total" + +class ConditionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operators allowed in the rule condition. + """ + + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + +class TimeAggregationOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Aggregation operators allowed in a rule. + """ + + AVERAGE = "Average" + MINIMUM = "Minimum" + MAXIMUM = "Maximum" + TOTAL = "Total" + LAST = "Last" + +class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """the unit of the metric. + """ + + COUNT = "Count" + BYTES = "Bytes" + SECONDS = "Seconds" + COUNT_PER_SECOND = "CountPerSecond" + BYTES_PER_SECOND = "BytesPerSecond" + PERCENT = "Percent" + MILLI_SECONDS = "MilliSeconds" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py index c7d51f79a3e23..28c5041be1cd1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/__init__.py @@ -7,7 +7,13 @@ # -------------------------------------------------------------------------- from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations +from ._metric_definitions_operations import MetricDefinitionsOperations +from ._alert_rules_operations import AlertRulesOperations +from ._operations import Operations __all__ = [ 'ServiceDiagnosticSettingsOperations', + 'MetricDefinitionsOperations', + 'AlertRulesOperations', + 'Operations', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_alert_rules_operations.py new file mode 100644 index 0000000000000..bfbed600aa58c --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_alert_rules_operations.py @@ -0,0 +1,448 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AlertRulesOperations(object): + """AlertRulesOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_07_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + rule_name, # type: str + parameters, # type: "_models.AlertRuleResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AlertRuleResource" + """Creates or updates a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param parameters: The parameters of the rule to create or update. + :type parameters: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AlertRuleResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AlertRuleResource" + """Gets a classic metric alert rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + rule_name, # type: str + alert_rules_resource, # type: "_models.AlertRuleResourcePatch" + **kwargs # type: Any + ): + # type: (...) -> "_models.AlertRuleResource" + """Updates an existing classic metric AlertRuleResource. To update other fields use the + CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param alert_rules_resource: Parameters supplied to the operation. + :type alert_rules_resource: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResourcePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.AlertRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(alert_rules_resource, 'AlertRuleResourcePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AlertRuleResourceCollection"] + """List the classic metric alert rules within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AlertRuleResourceCollection"] + """List the classic metric alert rules within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_07_01.models.AlertRuleResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2014-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_metric_definitions_operations.py new file mode 100644 index 0000000000000..794aff945e516 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_metric_definitions_operations.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MetricDefinitionsOperations(object): + """MetricDefinitionsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_07_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_uri, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MetricDefinitionCollection"] + """Lists the metric definitions for the resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param filter: Reduces the set of data collected by retrieving particular metric definitions + from all the definitions available for the resource.:code:`
`For example, to get just the + definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% + Processor Time'.:code:`
`Multiple metrics can be retrieved by joining together *'name eq + :code:``'* clauses separated by *or* logical operators.:code:`
`\ **NOTE**\ : No + other syntax is allowed. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2015_07_01.models.MetricDefinitionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MetricDefinitionCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_operations.py new file mode 100644 index 0000000000000..a6d8bd648b532 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_operations.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2015_07_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.OperationListResult" + """Lists all of the available operations from Microsoft.Insights provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2015_07_01.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-07-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Insights/operations'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py index b5d62a28a5325..2dc552790fd64 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/operations/_service_diagnostic_settings_operations.py @@ -88,7 +88,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py index b10736e5a2a44..282a42dca8c1f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json index fd3cdba4ddce7..358d4351074f4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,44 +23,84 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "alert_rule_incidents": "AlertRuleIncidentsOperations", "alert_rules": "AlertRulesOperations", "log_profiles": "LogProfilesOperations", "metric_definitions": "MetricDefinitionsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py index 8513c920c077f..8f67a079ad202 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import AlertRuleIncidentsOperations @@ -38,7 +39,7 @@ class MonitorManagementClient(object): :vartype metric_definitions: $(python-base-namespace).v2016_03_01.operations.MetricDefinitionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -70,6 +71,24 @@ def __init__( self.metric_definitions = MetricDefinitionsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py index 6756d6d2267b9..4fb94b055a2b1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py index e5406701f0bea..ab351d603d924 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -36,7 +37,7 @@ class MonitorManagementClient(object): :vartype metric_definitions: $(python-base-namespace).v2016_03_01.aio.operations.MetricDefinitionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -67,6 +68,23 @@ def __init__( self.metric_definitions = MetricDefinitionsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py index 55c06f896b2b7..958a1b2b8603a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rule_incidents_operations.py @@ -46,7 +46,7 @@ async def get( resource_group_name: str, rule_name: str, incident_name: str, - **kwargs + **kwargs: Any ) -> "_models.Incident": """Gets an incident associated to an alert rule. @@ -75,7 +75,7 @@ async def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'incidentName': self._serialize.url("incident_name", incident_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Incident', pipeline_response) @@ -108,7 +108,7 @@ def list_by_alert_rule( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IncidentListResult"]: """Gets a list of incidents associated to an alert rule. @@ -140,7 +140,7 @@ def prepare_request(next_link=None): path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py index eaae66796a3ac..a62a6ec672168 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_alert_rules_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, rule_name: str, parameters: "_models.AlertRuleResource", - **kwargs + **kwargs: Any ) -> "_models.AlertRuleResource": """Creates or updates a classic metric alert rule. @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -110,13 +110,13 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore async def delete( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a classic metric alert rule. @@ -135,13 +135,14 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -151,6 +152,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -158,18 +160,19 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore async def get( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.AlertRuleResource": """Gets a classic metric alert rule. @@ -195,7 +198,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -213,7 +216,8 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AlertRuleResource', pipeline_response) @@ -221,14 +225,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore async def update( self, resource_group_name: str, rule_name: str, alert_rules_resource: "_models.AlertRuleResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.AlertRuleResource": """Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. @@ -256,7 +260,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -280,7 +284,7 @@ async def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -293,12 +297,12 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a resource group. @@ -327,7 +331,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -355,19 +359,20 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertRuleResourceCollection"]: """List the classic metric alert rules within a subscription. @@ -393,7 +398,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,12 +426,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py index 786981108d812..5c218a864c227 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_log_profiles_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def delete( self, log_profile_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes the log profile. @@ -66,7 +66,7 @@ async def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -88,12 +88,12 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore async def get( self, log_profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.LogProfileResource": """Gets the log profile. @@ -116,7 +116,7 @@ async def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -134,7 +134,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -143,13 +143,13 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore async def create_or_update( self, log_profile_name: str, parameters: "_models.LogProfileResource", - **kwargs + **kwargs: Any ) -> "_models.LogProfileResource": """Create or update a log profile in Azure Monitoring REST API. @@ -175,7 +175,7 @@ async def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -205,13 +205,13 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore async def update( self, log_profile_name: str, log_profiles_resource: "_models.LogProfileResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.LogProfileResource": """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. @@ -236,7 +236,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -259,7 +259,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -268,11 +268,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.LogProfileCollection"]: """List the log profiles. @@ -298,7 +298,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -334,4 +334,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py index c4dbe2449afee..12bbcf4c9cc12 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/operations/_metric_definitions_operations.py @@ -45,7 +45,7 @@ def list( self, resource_uri: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricDefinitionCollection"]: """Lists the metric definitions for the resource. @@ -110,7 +110,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py index b4de0f130ae85..d737ca3227e16 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models.py @@ -77,10 +77,15 @@ class AlertRuleResource(Resource): :type name_properties_name: str :param description: the description of the alert rule that will be included in the alert email. :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str :param is_enabled: Required. the flag that indicates whether the alert rule is enabled. :type is_enabled: bool :param condition: Required. the condition that results in the alert rule being activated. :type condition: ~$(python-base-namespace).v2016_03_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2016_03_01.models.RuleAction :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~$(python-base-namespace).v2016_03_01.models.RuleAction] @@ -107,8 +112,10 @@ class AlertRuleResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -120,8 +127,10 @@ def __init__( super(AlertRuleResource, self).__init__(**kwargs) self.name_properties_name = kwargs['name_properties_name'] self.description = kwargs.get('description', None) + self.provisioning_state = kwargs.get('provisioning_state', None) self.is_enabled = kwargs['is_enabled'] self.condition = kwargs['condition'] + self.action = kwargs.get('action', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None @@ -156,10 +165,15 @@ class AlertRuleResourcePatch(msrest.serialization.Model): :type name: str :param description: the description of the alert rule that will be included in the alert email. :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str :param is_enabled: the flag that indicates whether the alert rule is enabled. :type is_enabled: bool :param condition: the condition that results in the alert rule being activated. :type condition: ~$(python-base-namespace).v2016_03_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2016_03_01.models.RuleAction :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~$(python-base-namespace).v2016_03_01.models.RuleAction] @@ -175,8 +189,10 @@ class AlertRuleResourcePatch(msrest.serialization.Model): 'tags': {'key': 'tags', 'type': '{str}'}, 'name': {'key': 'properties.name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -189,8 +205,10 @@ def __init__( self.tags = kwargs.get('tags', None) self.name = kwargs.get('name', None) self.description = kwargs.get('description', None) + self.provisioning_state = kwargs.get('provisioning_state', None) self.is_enabled = kwargs.get('is_enabled', None) self.condition = kwargs.get('condition', None) + self.action = kwargs.get('action', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None @@ -580,8 +598,8 @@ class ManagementEventRuleCondition(RuleCondition): :param aggregation: How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - :type aggregation: ~$(python-base- - namespace).v2016_03_01.models.ManagementEventAggregationCondition + :type aggregation: + ~$(python-base-namespace).v2016_03_01.models.ManagementEventAggregationCondition """ _validation = { @@ -636,17 +654,18 @@ class MetricDefinition(msrest.serialization.Model): :param name: the name and the display name of the metric, i.e. it is a localizable string. :type name: ~$(python-base-namespace).v2016_03_01.models.LocalizableString :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds". + "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", + "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2016_03_01.models.Unit :param primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :type primary_aggregation_type: str or ~$(python-base- - namespace).v2016_03_01.models.AggregationType + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2016_03_01.models.AggregationType :param metric_availabilities: the collection of what aggregation intervals are available to be queried. - :type metric_availabilities: list[~$(python-base- - namespace).v2016_03_01.models.MetricAvailability] + :type metric_availabilities: + list[~$(python-base-namespace).v2016_03_01.models.MetricAvailability] :param id: the resource identifier of the metric definition. :type id: str """ @@ -776,6 +795,13 @@ class RuleDataSource(msrest.serialization.Model): :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : this property cannot be updated for an existing rule. :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str """ _validation = { @@ -785,6 +811,9 @@ class RuleDataSource(msrest.serialization.Model): _attribute_map = { 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, } _subtype_map = { @@ -798,6 +827,9 @@ def __init__( super(RuleDataSource, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] self.resource_uri = kwargs.get('resource_uri', None) + self.legacy_resource_id = kwargs.get('legacy_resource_id', None) + self.resource_location = kwargs.get('resource_location', None) + self.metric_namespace = kwargs.get('metric_namespace', None) class RuleEmailAction(RuleAction): @@ -866,6 +898,13 @@ class RuleManagementEventDataSource(RuleDataSource): :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : this property cannot be updated for an existing rule. :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str :param event_name: the event name. :type event_name: str :param event_source: the event source. @@ -895,6 +934,9 @@ class RuleManagementEventDataSource(RuleDataSource): _attribute_map = { 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'event_name': {'key': 'eventName', 'type': 'str'}, 'event_source': {'key': 'eventSource', 'type': 'str'}, 'level': {'key': 'level', 'type': 'str'}, @@ -934,6 +976,13 @@ class RuleMetricDataSource(RuleDataSource): :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : this property cannot be updated for an existing rule. :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str :param metric_name: the name of the metric that defines what the rule monitors. :type metric_name: str """ @@ -945,6 +994,9 @@ class RuleMetricDataSource(RuleDataSource): _attribute_map = { 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'metric_name': {'key': 'metricName', 'type': 'str'}, } @@ -1018,8 +1070,8 @@ class ThresholdRuleCondition(RuleCondition): :param time_aggregation: the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: "Average", "Minimum", "Maximum", "Total", "Last". - :type time_aggregation: str or ~$(python-base- - namespace).v2016_03_01.models.TimeAggregationOperator + :type time_aggregation: str or + ~$(python-base-namespace).v2016_03_01.models.TimeAggregationOperator """ _validation = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py index 8be2f2a651a5c..f9a35585fc3af 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_models_py3.py @@ -85,10 +85,15 @@ class AlertRuleResource(Resource): :type name_properties_name: str :param description: the description of the alert rule that will be included in the alert email. :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str :param is_enabled: Required. the flag that indicates whether the alert rule is enabled. :type is_enabled: bool :param condition: Required. the condition that results in the alert rule being activated. :type condition: ~$(python-base-namespace).v2016_03_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2016_03_01.models.RuleAction :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~$(python-base-namespace).v2016_03_01.models.RuleAction] @@ -115,8 +120,10 @@ class AlertRuleResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -130,14 +137,18 @@ def __init__( condition: "RuleCondition", tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, + provisioning_state: Optional[str] = None, + action: Optional["RuleAction"] = None, actions: Optional[List["RuleAction"]] = None, **kwargs ): super(AlertRuleResource, self).__init__(location=location, tags=tags, **kwargs) self.name_properties_name = name_properties_name self.description = description + self.provisioning_state = provisioning_state self.is_enabled = is_enabled self.condition = condition + self.action = action self.actions = actions self.last_updated_time = None @@ -174,10 +185,15 @@ class AlertRuleResourcePatch(msrest.serialization.Model): :type name: str :param description: the description of the alert rule that will be included in the alert email. :type description: str + :param provisioning_state: the provisioning state. + :type provisioning_state: str :param is_enabled: the flag that indicates whether the alert rule is enabled. :type is_enabled: bool :param condition: the condition that results in the alert rule being activated. :type condition: ~$(python-base-namespace).v2016_03_01.models.RuleCondition + :param action: action that is performed when the alert rule becomes active, and when an alert + condition is resolved. + :type action: ~$(python-base-namespace).v2016_03_01.models.RuleAction :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~$(python-base-namespace).v2016_03_01.models.RuleAction] @@ -193,8 +209,10 @@ class AlertRuleResourcePatch(msrest.serialization.Model): 'tags': {'key': 'tags', 'type': '{str}'}, 'name': {'key': 'properties.name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, 'condition': {'key': 'properties.condition', 'type': 'RuleCondition'}, + 'action': {'key': 'properties.action', 'type': 'RuleAction'}, 'actions': {'key': 'properties.actions', 'type': '[RuleAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -205,8 +223,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, name: Optional[str] = None, description: Optional[str] = None, + provisioning_state: Optional[str] = None, is_enabled: Optional[bool] = None, condition: Optional["RuleCondition"] = None, + action: Optional["RuleAction"] = None, actions: Optional[List["RuleAction"]] = None, **kwargs ): @@ -214,8 +234,10 @@ def __init__( self.tags = tags self.name = name self.description = description + self.provisioning_state = provisioning_state self.is_enabled = is_enabled self.condition = condition + self.action = action self.actions = actions self.last_updated_time = None @@ -640,8 +662,8 @@ class ManagementEventRuleCondition(RuleCondition): :param aggregation: How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - :type aggregation: ~$(python-base- - namespace).v2016_03_01.models.ManagementEventAggregationCondition + :type aggregation: + ~$(python-base-namespace).v2016_03_01.models.ManagementEventAggregationCondition """ _validation = { @@ -702,17 +724,18 @@ class MetricDefinition(msrest.serialization.Model): :param name: the name and the display name of the metric, i.e. it is a localizable string. :type name: ~$(python-base-namespace).v2016_03_01.models.LocalizableString :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds". + "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", + "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2016_03_01.models.Unit :param primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :type primary_aggregation_type: str or ~$(python-base- - namespace).v2016_03_01.models.AggregationType + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2016_03_01.models.AggregationType :param metric_availabilities: the collection of what aggregation intervals are available to be queried. - :type metric_availabilities: list[~$(python-base- - namespace).v2016_03_01.models.MetricAvailability] + :type metric_availabilities: + list[~$(python-base-namespace).v2016_03_01.models.MetricAvailability] :param id: the resource identifier of the metric definition. :type id: str """ @@ -854,6 +877,13 @@ class RuleDataSource(msrest.serialization.Model): :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : this property cannot be updated for an existing rule. :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str """ _validation = { @@ -863,6 +893,9 @@ class RuleDataSource(msrest.serialization.Model): _attribute_map = { 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, } _subtype_map = { @@ -873,11 +906,17 @@ def __init__( self, *, resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, **kwargs ): super(RuleDataSource, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] self.resource_uri = resource_uri + self.legacy_resource_id = legacy_resource_id + self.resource_location = resource_location + self.metric_namespace = metric_namespace class RuleEmailAction(RuleAction): @@ -951,6 +990,13 @@ class RuleManagementEventDataSource(RuleDataSource): :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : this property cannot be updated for an existing rule. :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str :param event_name: the event name. :type event_name: str :param event_source: the event source. @@ -980,6 +1026,9 @@ class RuleManagementEventDataSource(RuleDataSource): _attribute_map = { 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'event_name': {'key': 'eventName', 'type': 'str'}, 'event_source': {'key': 'eventSource', 'type': 'str'}, 'level': {'key': 'level', 'type': 'str'}, @@ -995,6 +1044,9 @@ def __init__( self, *, resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, event_name: Optional[str] = None, event_source: Optional[str] = None, level: Optional[str] = None, @@ -1006,7 +1058,7 @@ def __init__( claims: Optional["RuleManagementEventClaimsDataSource"] = None, **kwargs ): - super(RuleManagementEventDataSource, self).__init__(resource_uri=resource_uri, **kwargs) + super(RuleManagementEventDataSource, self).__init__(resource_uri=resource_uri, legacy_resource_id=legacy_resource_id, resource_location=resource_location, metric_namespace=metric_namespace, **kwargs) self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' # type: str self.event_name = event_name self.event_source = event_source @@ -1030,6 +1082,13 @@ class RuleMetricDataSource(RuleDataSource): :param resource_uri: the resource identifier of the resource the rule monitors. **NOTE**\ : this property cannot be updated for an existing rule. :type resource_uri: str + :param legacy_resource_id: the legacy resource identifier of the resource the rule monitors. + **NOTE**\ : this property cannot be updated for an existing rule. + :type legacy_resource_id: str + :param resource_location: the location of the resource. + :type resource_location: str + :param metric_namespace: the namespace of the metric. + :type metric_namespace: str :param metric_name: the name of the metric that defines what the rule monitors. :type metric_name: str """ @@ -1041,6 +1100,9 @@ class RuleMetricDataSource(RuleDataSource): _attribute_map = { 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, 'resource_uri': {'key': 'resourceUri', 'type': 'str'}, + 'legacy_resource_id': {'key': 'legacyResourceId', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'metric_name': {'key': 'metricName', 'type': 'str'}, } @@ -1048,10 +1110,13 @@ def __init__( self, *, resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: Optional[str] = None, metric_name: Optional[str] = None, **kwargs ): - super(RuleMetricDataSource, self).__init__(resource_uri=resource_uri, **kwargs) + super(RuleMetricDataSource, self).__init__(resource_uri=resource_uri, legacy_resource_id=legacy_resource_id, resource_location=resource_location, metric_namespace=metric_namespace, **kwargs) self.odata_type = 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' # type: str self.metric_name = metric_name @@ -1120,8 +1185,8 @@ class ThresholdRuleCondition(RuleCondition): :param time_aggregation: the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: "Average", "Minimum", "Maximum", "Total", "Last". - :type time_aggregation: str or ~$(python-base- - namespace).v2016_03_01.models.TimeAggregationOperator + :type time_aggregation: str or + ~$(python-base-namespace).v2016_03_01.models.TimeAggregationOperator """ _validation = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py index 1794d0c7662b8..42b2bb7d2507c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py @@ -57,7 +57,7 @@ class TimeAggregationOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum LAST = "Last" class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """the unit of the metric. + """The unit of the metric. """ COUNT = "Count" @@ -67,3 +67,9 @@ class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" PERCENT = "Percent" MILLI_SECONDS = "MilliSeconds" + BYTE_SECONDS = "ByteSeconds" + UNSPECIFIED = "Unspecified" + CORES = "Cores" + MILLI_CORES = "MilliCores" + NANO_CORES = "NanoCores" + BITS_PER_SECOND = "BitsPerSecond" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py index 054934826b31b..e852df95c9010 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rule_incidents_operations.py @@ -80,7 +80,7 @@ def get( 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'incidentName': self._serialize.url("incident_name", incident_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Incident', pipeline_response) @@ -146,7 +146,7 @@ def prepare_request(next_link=None): path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py index 4193d89ea5255..82bc82bee3de1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_alert_rules_operations.py @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -115,7 +115,7 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore def delete( self, @@ -141,13 +141,14 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -157,6 +158,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -164,12 +166,13 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore def get( self, @@ -202,7 +205,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -220,7 +223,8 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AlertRuleResource', pipeline_response) @@ -228,7 +232,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore def update( self, @@ -264,7 +268,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -288,7 +292,7 @@ def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -301,7 +305,7 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}'} # type: ignore def list_by_resource_group( self, @@ -336,7 +340,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -364,15 +368,16 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules'} # type: ignore def list_by_subscription( self, @@ -403,7 +408,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,12 +436,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py index 742c69dc8f225..84bedb59ac2c0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_log_profiles_operations.py @@ -71,7 +71,7 @@ def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -93,7 +93,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore def get( self, @@ -122,7 +122,7 @@ def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -140,7 +140,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -149,7 +149,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore def create_or_update( self, @@ -182,7 +182,7 @@ def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -212,7 +212,7 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore def update( self, @@ -244,7 +244,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'logProfileName': self._serialize.url("log_profile_name", log_profile_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -267,7 +267,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogProfileResource', pipeline_response) @@ -276,7 +276,7 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}'} # type: ignore def list( self, @@ -307,7 +307,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -343,4 +343,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py index dd1a67a253201..70e65461a6a87 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/operations/_metric_definitions_operations.py @@ -115,7 +115,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py index f4e9ecb35978a..49eeeacfbf315 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json index d595643b716e4..16c3223a2e2fb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -22,7 +24,7 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -30,21 +32,61 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "metrics": "MetricsOperations", "service_diagnostic_settings": "ServiceDiagnosticSettingsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py index 18c80e72a6616..894c99e965147 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import MetricsOperations @@ -57,6 +58,21 @@ def __init__( self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py index 2a28aa7093818..6e6da199d6361 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py index 1c424ce98abcf..c050f4b4aa8fc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -54,6 +55,20 @@ def __init__( self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py index a16847bb3ecd9..4e6584b0e1d95 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_metrics_operations.py @@ -45,7 +45,7 @@ def list( self, resource_uri: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricCollection"]: """Lists the metric values for a resource. @@ -122,7 +122,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py index 44549740b5567..18fcacb6e3f4a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/operations/_service_diagnostic_settings_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get( self, resource_uri: str, - **kwargs + **kwargs: Any ) -> "_models.ServiceDiagnosticSettingsResource": """Gets the active diagnostic settings for the specified resource. **WARNING**\ : This method will be deprecated in future releases. @@ -84,7 +84,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) @@ -99,7 +99,7 @@ async def create_or_update( self, resource_uri: str, parameters: "_models.ServiceDiagnosticSettingsResource", - **kwargs + **kwargs: Any ) -> "_models.ServiceDiagnosticSettingsResource": """Create or update new diagnostic settings for the specified resource. **WARNING**\ : This method will be deprecated in future releases. @@ -161,7 +161,7 @@ async def update( self, resource_uri: str, service_diagnostic_settings_resource: "_models.ServiceDiagnosticSettingsResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.ServiceDiagnosticSettingsResource": """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the CreateOrUpdate method. **WARNING**\ : This method will be deprecated in future releases. @@ -209,7 +209,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py index 86ba147e81317..d5842d8f0aec8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models.py @@ -110,7 +110,8 @@ class Metric(msrest.serialization.Model): string. :type name: ~$(python-base-namespace).v2016_09_01.models.LocalizableString :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes", - "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds". + "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", + "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2016_09_01.models.Unit :param data: Required. Array of data points representing the metric values. :type data: list[~$(python-base-namespace).v2016_09_01.models.MetricValue] @@ -357,8 +358,7 @@ class ServiceDiagnosticSettingsResource(Resource): :type logs: list[~$(python-base-namespace).v2016_09_01.models.LogSettings] :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -417,8 +417,7 @@ class ServiceDiagnosticSettingsResourcePatch(msrest.serialization.Model): :type logs: list[~$(python-base-namespace).v2016_09_01.models.LogSettings] :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py index 34242d1457575..44a91f381556d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_models_py3.py @@ -125,7 +125,8 @@ class Metric(msrest.serialization.Model): string. :type name: ~$(python-base-namespace).v2016_09_01.models.LocalizableString :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes", - "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds". + "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", + "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2016_09_01.models.Unit :param data: Required. Array of data points representing the metric values. :type data: list[~$(python-base-namespace).v2016_09_01.models.MetricValue] @@ -397,8 +398,7 @@ class ServiceDiagnosticSettingsResource(Resource): :type logs: list[~$(python-base-namespace).v2016_09_01.models.LogSettings] :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -466,8 +466,7 @@ class ServiceDiagnosticSettingsResourcePatch(msrest.serialization.Model): :type logs: list[~$(python-base-namespace).v2016_09_01.models.LogSettings] :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_management_client_enums.py index a97775944d3f9..a8d1b59c86f25 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_management_client_enums.py @@ -27,7 +27,7 @@ def __getattr__(cls, name): class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """the unit of the metric. + """The unit of the metric. """ COUNT = "Count" @@ -37,3 +37,9 @@ class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" PERCENT = "Percent" MILLI_SECONDS = "MilliSeconds" + BYTE_SECONDS = "ByteSeconds" + UNSPECIFIED = "Unspecified" + CORES = "Cores" + MILLI_CORES = "MilliCores" + NANO_CORES = "NanoCores" + BITS_PER_SECOND = "BitsPerSecond" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py index cdf6a8557a8d0..09facc2424abd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_metrics_operations.py @@ -127,7 +127,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py index 4bf7526dd8b16..aa768782b641c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/operations/_service_diagnostic_settings_operations.py @@ -89,7 +89,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) @@ -216,7 +216,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceDiagnosticSettingsResource', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py index a79d97c174112..20b896410adb2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json index f34c78eab87d4..fbd1af47ff222 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,41 +23,81 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "activity_log_alerts": "ActivityLogAlertsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py index ddf7efa85be1d..2fd4b9348900d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ActivityLogAlertsOperations @@ -29,7 +30,7 @@ class MonitorManagementClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_03_01_preview.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -55,6 +56,24 @@ def __init__( self.activity_log_alerts = ActivityLogAlertsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py index 916df862bb107..bdfb3a86feb4d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py index 1f97fff0df70e..75051515bdf32 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -27,7 +28,7 @@ class MonitorManagementClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_03_01_preview.aio.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,6 +53,23 @@ def __init__( self.activity_log_alerts = ActivityLogAlertsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py index 292f6ebc7657d..13d3752a35708 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/operations/_activity_log_alerts_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, activity_log_alert_name: str, activity_log_alert: "_models.ActivityLogAlertResource", - **kwargs + **kwargs: Any ) -> "_models.ActivityLogAlertResource": """Create a new activity log alert or update an existing one. @@ -73,7 +73,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, activity_log_alert_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActivityLogAlertResource": """Get an activity log alert. @@ -140,7 +140,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -175,7 +175,7 @@ async def delete( self, resource_group_name: str, activity_log_alert_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an activity log alert. @@ -199,7 +199,7 @@ async def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ async def update( resource_group_name: str, activity_log_alert_name: str, activity_log_alert_patch: "_models.ActivityLogAlertResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.ActivityLogAlertResource": """Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. @@ -260,7 +260,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -284,7 +284,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -297,7 +297,7 @@ async def update( def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a subscription. @@ -323,7 +323,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -351,7 +351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,7 +365,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a resource group. @@ -393,7 +393,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -422,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py index abd716595d156..c8f2e52df3ed6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models.py @@ -45,8 +45,8 @@ class ActivityLogAlertActionList(msrest.serialization.Model): """A list of activity log alert actions. :param action_groups: The list of activity log alerts. - :type action_groups: list[~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertActionGroup] + :type action_groups: + list[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertActionGroup] """ _attribute_map = { @@ -67,8 +67,8 @@ class ActivityLogAlertAllOfCondition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param all_of: Required. The list of activity log alert conditions. - :type all_of: list[~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertLeafCondition] + :type all_of: + list[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertLeafCondition] """ _validation = { @@ -125,8 +125,8 @@ class ActivityLogAlertList(msrest.serialization.Model): """A list of activity log alerts. :param value: The list of activity log alerts. - :type value: list[~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertResource] + :type value: + list[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource] """ _attribute_map = { @@ -212,8 +212,8 @@ class ActivityLogAlertResource(Resource): is not enabled, then none of its actions will be activated. :type enabled: bool :param condition: The condition that will cause this alert to activate. - :type condition: ~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertAllOfCondition + :type condition: + ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertAllOfCondition :param actions: The actions that will activate when the condition is met. :type actions: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertActionList :param description: A description of this activity log alert. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py index a55fcbeb7e5b4..e22fb206fcee7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/models/_models_py3.py @@ -50,8 +50,8 @@ class ActivityLogAlertActionList(msrest.serialization.Model): """A list of activity log alert actions. :param action_groups: The list of activity log alerts. - :type action_groups: list[~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertActionGroup] + :type action_groups: + list[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertActionGroup] """ _attribute_map = { @@ -74,8 +74,8 @@ class ActivityLogAlertAllOfCondition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param all_of: Required. The list of activity log alert conditions. - :type all_of: list[~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertLeafCondition] + :type all_of: + list[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertLeafCondition] """ _validation = { @@ -137,8 +137,8 @@ class ActivityLogAlertList(msrest.serialization.Model): """A list of activity log alerts. :param value: The list of activity log alerts. - :type value: list[~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertResource] + :type value: + list[~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertResource] """ _attribute_map = { @@ -229,8 +229,8 @@ class ActivityLogAlertResource(Resource): is not enabled, then none of its actions will be activated. :type enabled: bool :param condition: The condition that will cause this alert to activate. - :type condition: ~$(python-base- - namespace).v2017_03_01_preview.models.ActivityLogAlertAllOfCondition + :type condition: + ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertAllOfCondition :param actions: The actions that will activate when the condition is met. :type actions: ~$(python-base-namespace).v2017_03_01_preview.models.ActivityLogAlertActionList :param description: A description of this activity log alert. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py index 94da74734c8c4..c820ce837e517 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/operations/_activity_log_alerts_operations.py @@ -78,7 +78,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -146,7 +146,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -206,7 +206,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -268,7 +268,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -292,7 +292,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -332,7 +332,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -360,7 +360,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -403,7 +403,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -432,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py index 46edaf2a13012..5f2a86e565f74 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json index 1dd24a1ad48dc..9eb75d5214178 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,42 +23,82 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "action_groups": "ActionGroupsOperations", "activity_log_alerts": "ActivityLogAlertsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py index ae156e7cffec3..c030a475a77b5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ActionGroupsOperations @@ -32,7 +33,7 @@ class MonitorManagementClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_04_01.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -60,6 +61,24 @@ def __init__( self.activity_log_alerts = ActivityLogAlertsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py index 57fdcb118a0d0..77ab731e4a416 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py index e2c0fd2efe6ba..b23f3b73ad1ab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -30,7 +31,7 @@ class MonitorManagementClient(object): :vartype activity_log_alerts: $(python-base-namespace).v2017_04_01.aio.operations.ActivityLogAlertsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -57,6 +58,23 @@ def __init__( self.activity_log_alerts = ActivityLogAlertsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py index 353ce2bc22232..8dcaae576727f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_action_groups_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, action_group_name: str, action_group: "_models.ActionGroupResource", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Get an action group. @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -175,7 +175,7 @@ async def delete( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an action group. @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ async def update( resource_group_name: str, action_group_name: str, action_group_patch: "_models.ActionGroupPatchBody", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -296,7 +296,7 @@ async def update( def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -364,7 +364,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -437,7 +437,7 @@ async def enable_receiver( resource_group_name: str, action_group_name: str, enable_request: "_models.EnableRequest", - **kwargs + **kwargs: Any ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py index 9b26a1bb6b0b7..f58a8bf3f2a1f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/operations/_activity_log_alerts_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, activity_log_alert_name: str, activity_log_alert: "_models.ActivityLogAlertResource", - **kwargs + **kwargs: Any ) -> "_models.ActivityLogAlertResource": """Create a new activity log alert or update an existing one. @@ -73,7 +73,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, activity_log_alert_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActivityLogAlertResource": """Get an activity log alert. @@ -140,7 +140,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -175,7 +175,7 @@ async def delete( self, resource_group_name: str, activity_log_alert_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an activity log alert. @@ -199,7 +199,7 @@ async def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ async def update( resource_group_name: str, activity_log_alert_name: str, activity_log_alert_patch: "_models.ActivityLogAlertPatchBody", - **kwargs + **kwargs: Any ) -> "_models.ActivityLogAlertResource": """Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. @@ -260,7 +260,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -284,7 +284,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -297,7 +297,7 @@ async def update( def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a subscription. @@ -323,7 +323,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -351,7 +351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,7 +365,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActivityLogAlertList"]: """Get a list of all activity log alerts in a resource group. @@ -393,7 +393,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -422,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py index ede1d65b4331c..a4233a3199459 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models.py @@ -135,12 +135,12 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2017_04_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2017_04_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2017_04_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2017_04_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2017_04_01.models.AutomationRunbookReceiver] """ _validation = { @@ -217,8 +217,8 @@ class ActivityLogAlertActionList(msrest.serialization.Model): """A list of activity log alert actions. :param action_groups: The list of activity log alerts. - :type action_groups: list[~$(python-base- - namespace).v2017_04_01.models.ActivityLogAlertActionGroup] + :type action_groups: + list[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertActionGroup] """ _attribute_map = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py index 35eed01fff8e3..e7619cc6add36 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_models_py3.py @@ -146,12 +146,12 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2017_04_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2017_04_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2017_04_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2017_04_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2017_04_01.models.AutomationRunbookReceiver] """ _validation = { @@ -242,8 +242,8 @@ class ActivityLogAlertActionList(msrest.serialization.Model): """A list of activity log alert actions. :param action_groups: The list of activity log alerts. - :type action_groups: list[~$(python-base- - namespace).v2017_04_01.models.ActivityLogAlertActionGroup] + :type action_groups: + list[~$(python-base-namespace).v2017_04_01.models.ActivityLogAlertActionGroup] """ _attribute_map = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py index 689b1d5d14217..ea02f9051b2b3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_action_groups_operations.py @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py index 5854c48a1409d..f1b3eaf39f846 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py @@ -78,7 +78,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -146,7 +146,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -206,7 +206,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -268,7 +268,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), } @@ -292,7 +292,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) @@ -332,7 +332,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -360,7 +360,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -403,7 +403,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -432,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py index 022f5a44fa55d..7f204474d1896 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,19 +29,25 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str """ def __init__( self, credential, # type: "TokenCredential" + subscription_id, # type: str **kwargs # type: Any ): # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") super(MonitorManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential + self.subscription_id = subscription_id self.api_version = "2017-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json index 30b3ab224ba84..1ae63ddbf3366 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -18,26 +20,82 @@ "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, # type: \"AsyncTokenCredential\"", + "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" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "diagnostic_settings_category": "DiagnosticSettingsCategoryOperations", @@ -45,9 +103,5 @@ "metric_definitions": "MetricDefinitionsOperations", "metrics": "MetricsOperations", "subscription_diagnostic_settings": "SubscriptionDiagnosticSettingsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py index 32bfe4c988873..bc4d0dc8dbcd5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import DiagnosticSettingsCategoryOperations @@ -41,19 +42,22 @@ class MonitorManagementClient(object): :vartype subscription_diagnostic_settings: $(python-base-namespace).v2017_05_01_preview.operations.SubscriptionDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str :param str base_url: Service URL """ def __init__( self, credential, # type: "TokenCredential" + subscription_id, # type: str base_url=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -72,6 +76,24 @@ def __init__( self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py index 2db414bb10961..45862e08ab639 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,18 +27,24 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str """ def __init__( self, credential: "AsyncTokenCredential", + subscription_id: str, **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") super(MonitorManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential + self.subscription_id = subscription_id self.api_version = "2017-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py index 61dc9b9b1aac7..f01ad0b4a80c6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -39,18 +40,21 @@ class MonitorManagementClient(object): :vartype subscription_diagnostic_settings: $(python-base-namespace).v2017_05_01_preview.aio.operations.SubscriptionDiagnosticSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str :param str base_url: Service URL """ def __init__( self, credential: "AsyncTokenCredential", + subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -69,6 +73,23 @@ def __init__( self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py index cb356ad37a9a6..45f9db049d631 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py @@ -44,7 +44,7 @@ async def get( self, resource_uri: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.DiagnosticSettingsCategoryResource": """Gets the diagnostic settings category for the specified resource. @@ -87,7 +87,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResource', pipeline_response) @@ -96,12 +96,12 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore async def list( self, resource_uri: str, - **kwargs + **kwargs: Any ) -> "_models.DiagnosticSettingsCategoryResourceCollection": """Lists the diagnostic settings categories for the specified resource. @@ -141,7 +141,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) @@ -150,4 +150,4 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py index 95c8a5fd4f212..6e9b20cb81468 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py @@ -44,7 +44,7 @@ async def get( self, resource_uri: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.DiagnosticSettingsResource": """Gets the active diagnostic settings for the specified resource. @@ -87,7 +87,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -96,14 +96,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore async def create_or_update( self, resource_uri: str, name: str, parameters: "_models.DiagnosticSettingsResource", - **kwargs + **kwargs: Any ) -> "_models.DiagnosticSettingsResource": """Creates or updates diagnostic settings for the specified resource. @@ -153,7 +153,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -162,13 +162,13 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore async def delete( self, resource_uri: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes existing diagnostic settings for the specified resource. @@ -211,18 +211,18 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore async def list( self, resource_uri: str, - **kwargs + **kwargs: Any ) -> "_models.DiagnosticSettingsResourceCollection": """Gets the active diagnostic settings list for the specified resource. @@ -262,7 +262,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) @@ -271,4 +271,4 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py index de54aaaa25486..2f1e2fcc8abb1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metric_definitions_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, resource_uri: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricDefinitionCollection"]: """Lists the metric definitions for the resource. @@ -100,7 +100,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py index e5acd4985819d..c67d4fab6b8a9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_metrics_operations.py @@ -52,7 +52,7 @@ async def list( orderby: Optional[str] = None, filter: Optional[str] = None, result_type: Optional[Union[str, "_models.ResultType"]] = None, - **kwargs + **kwargs: Any ) -> "_models.Response": """**Lists the metric values for a resource**. @@ -138,7 +138,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py index 8d38157011b2a..64ba48d799b05 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py @@ -42,14 +42,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get( self, - subscription_id: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.SubscriptionDiagnosticSettingsResource": """Gets the active subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -68,7 +65,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -87,7 +84,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -100,15 +97,12 @@ async def get( async def create_or_update( self, - subscription_id: str, name: str, parameters: "_models.SubscriptionDiagnosticSettingsResource", - **kwargs + **kwargs: Any ) -> "_models.SubscriptionDiagnosticSettingsResource": """Creates or updates subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :param parameters: Parameters supplied to the operation. @@ -130,7 +124,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -153,7 +147,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -166,14 +160,11 @@ async def create_or_update( async def delete( self, - subscription_id: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes existing subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -192,7 +183,7 @@ async def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -211,7 +202,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -221,13 +212,10 @@ async def delete( async def list( self, - subscription_id: str, - **kwargs + **kwargs: Any ) -> "_models.SubscriptionDiagnosticSettingsResourceCollection": """Gets the active subscription diagnostic settings list for the specified subscriptionId. - :param subscription_id: The subscription id. - :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionDiagnosticSettingsResourceCollection, or the result of cls(response) :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection @@ -244,7 +232,7 @@ async def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -262,7 +250,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py index eec0efc4acc0b..4f1b71bd9ceec 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models.py @@ -86,8 +86,8 @@ class DiagnosticSettingsCategoryResourceCollection(msrest.serialization.Model): """Represents a collection of diagnostic setting category resources. :param value: The collection of diagnostic settings category resources. - :type value: list[~$(python-base- - namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResource] + :type value: + list[~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResource] """ _attribute_map = { @@ -130,8 +130,7 @@ class DiagnosticSettingsResource(ProxyOnlyResource): :type logs: list[~$(python-base-namespace).v2017_05_01_preview.models.LogSettings] :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str :param log_analytics_destination_type: A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type @@ -179,8 +178,8 @@ class DiagnosticSettingsResourceCollection(msrest.serialization.Model): """Represents a collection of alert rule resources. :param value: The collection of diagnostic settings resources;. - :type value: list[~$(python-base- - namespace).v2017_05_01_preview.models.DiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResource] """ _attribute_map = { @@ -317,9 +316,15 @@ class Metric(msrest.serialization.Model): :param name: Required. the name and the display name of the metric, i.e. it is localizable string. :type name: ~$(python-base-namespace).v2017_05_01_preview.models.LocalizableString + :param display_description: Detailed description of this metric. + :type display_description: str + :param error_code: 'Success' or the error details on query failures for this metric. + :type error_code: str + :param error_message: Error message encountered querying this specific metric. + :type error_message: str :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", - "Unspecified". + "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2017_05_01_preview.models.Unit :param timeseries: Required. the time series returned when a data query is performed. :type timeseries: list[~$(python-base-namespace).v2017_05_01_preview.models.TimeSeriesElement] @@ -337,6 +342,9 @@ class Metric(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, } @@ -349,6 +357,9 @@ def __init__( self.id = kwargs['id'] self.type = kwargs['type'] self.name = kwargs['name'] + self.display_description = kwargs.get('display_description', None) + self.error_code = kwargs.get('error_code', None) + self.error_message = kwargs.get('error_message', None) self.unit = kwargs['unit'] self.timeseries = kwargs['timeseries'] @@ -387,18 +398,23 @@ class MetricDefinition(msrest.serialization.Model): :type resource_id: str :param name: the name and the display name of the metric, i.e. it is a localizable string. :type name: ~$(python-base-namespace).v2017_05_01_preview.models.LocalizableString + :param display_description: Detailed description of this metric. + :type display_description: str + :param category: Custom category name for this metric. + :type category: str :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified". + "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", + "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2017_05_01_preview.models.Unit :param primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :type primary_aggregation_type: str or ~$(python-base- - namespace).v2017_05_01_preview.models.AggregationType + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2017_05_01_preview.models.AggregationType :param metric_availabilities: the collection of what aggregation intervals are available to be queried. - :type metric_availabilities: list[~$(python-base- - namespace).v2017_05_01_preview.models.MetricAvailability] + :type metric_availabilities: + list[~$(python-base-namespace).v2017_05_01_preview.models.MetricAvailability] :param id: the resource identifier of the metric definition. :type id: str :param dimensions: the name and the display name of the dimension, i.e. it is a localizable @@ -410,6 +426,8 @@ class MetricDefinition(msrest.serialization.Model): 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, @@ -425,6 +443,8 @@ def __init__( self.is_dimension_required = kwargs.get('is_dimension_required', None) self.resource_id = kwargs.get('resource_id', None) self.name = kwargs.get('name', None) + self.display_description = kwargs.get('display_description', None) + self.category = kwargs.get('category', None) self.unit = kwargs.get('unit', None) self.primary_aggregation_type = kwargs.get('primary_aggregation_type', None) self.metric_availabilities = kwargs.get('metric_availabilities', None) @@ -547,7 +567,7 @@ class Response(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param cost: The integer value representing the cost of the query, for data case. + :param cost: The integer value representing the relative cost of the query. :type cost: int :param timespan: Required. The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned @@ -683,8 +703,7 @@ class SubscriptionDiagnosticSettingsResource(SubscriptionProxyOnlyResource): :type logs: list[~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionLogSettings] :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -724,8 +743,8 @@ class SubscriptionDiagnosticSettingsResourceCollection(msrest.serialization.Mode """Represents a collection of subscription diagnostic settings resources. :param value: The collection of subscription diagnostic settings resources. - :type value: list[~$(python-base- - namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource] """ _attribute_map = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py index 1ab88ae839f49..c5e381a974b89 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_models_py3.py @@ -93,8 +93,8 @@ class DiagnosticSettingsCategoryResourceCollection(msrest.serialization.Model): """Represents a collection of diagnostic setting category resources. :param value: The collection of diagnostic settings category resources. - :type value: list[~$(python-base- - namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResource] + :type value: + list[~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsCategoryResource] """ _attribute_map = { @@ -139,8 +139,7 @@ class DiagnosticSettingsResource(ProxyOnlyResource): :type logs: list[~$(python-base-namespace).v2017_05_01_preview.models.LogSettings] :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str :param log_analytics_destination_type: A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type @@ -197,8 +196,8 @@ class DiagnosticSettingsResourceCollection(msrest.serialization.Model): """Represents a collection of alert rule resources. :param value: The collection of diagnostic settings resources;. - :type value: list[~$(python-base- - namespace).v2017_05_01_preview.models.DiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2017_05_01_preview.models.DiagnosticSettingsResource] """ _attribute_map = { @@ -350,9 +349,15 @@ class Metric(msrest.serialization.Model): :param name: Required. the name and the display name of the metric, i.e. it is localizable string. :type name: ~$(python-base-namespace).v2017_05_01_preview.models.LocalizableString + :param display_description: Detailed description of this metric. + :type display_description: str + :param error_code: 'Success' or the error details on query failures for this metric. + :type error_code: str + :param error_message: Error message encountered querying this specific metric. + :type error_message: str :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", - "Unspecified". + "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2017_05_01_preview.models.Unit :param timeseries: Required. the time series returned when a data query is performed. :type timeseries: list[~$(python-base-namespace).v2017_05_01_preview.models.TimeSeriesElement] @@ -370,6 +375,9 @@ class Metric(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, } @@ -382,12 +390,18 @@ def __init__( name: "LocalizableString", unit: Union[str, "Unit"], timeseries: List["TimeSeriesElement"], + display_description: Optional[str] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, **kwargs ): super(Metric, self).__init__(**kwargs) self.id = id self.type = type self.name = name + self.display_description = display_description + self.error_code = error_code + self.error_message = error_message self.unit = unit self.timeseries = timeseries @@ -429,18 +443,23 @@ class MetricDefinition(msrest.serialization.Model): :type resource_id: str :param name: the name and the display name of the metric, i.e. it is a localizable string. :type name: ~$(python-base-namespace).v2017_05_01_preview.models.LocalizableString + :param display_description: Detailed description of this metric. + :type display_description: str + :param category: Custom category name for this metric. + :type category: str :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified". + "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", + "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :type unit: str or ~$(python-base-namespace).v2017_05_01_preview.models.Unit :param primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :type primary_aggregation_type: str or ~$(python-base- - namespace).v2017_05_01_preview.models.AggregationType + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2017_05_01_preview.models.AggregationType :param metric_availabilities: the collection of what aggregation intervals are available to be queried. - :type metric_availabilities: list[~$(python-base- - namespace).v2017_05_01_preview.models.MetricAvailability] + :type metric_availabilities: + list[~$(python-base-namespace).v2017_05_01_preview.models.MetricAvailability] :param id: the resource identifier of the metric definition. :type id: str :param dimensions: the name and the display name of the dimension, i.e. it is a localizable @@ -452,6 +471,8 @@ class MetricDefinition(msrest.serialization.Model): 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, @@ -465,6 +486,8 @@ def __init__( is_dimension_required: Optional[bool] = None, resource_id: Optional[str] = None, name: Optional["LocalizableString"] = None, + display_description: Optional[str] = None, + category: Optional[str] = None, unit: Optional[Union[str, "Unit"]] = None, primary_aggregation_type: Optional[Union[str, "AggregationType"]] = None, metric_availabilities: Optional[List["MetricAvailability"]] = None, @@ -476,6 +499,8 @@ def __init__( self.is_dimension_required = is_dimension_required self.resource_id = resource_id self.name = name + self.display_description = display_description + self.category = category self.unit = unit self.primary_aggregation_type = primary_aggregation_type self.metric_availabilities = metric_availabilities @@ -612,7 +637,7 @@ class Response(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param cost: The integer value representing the cost of the query, for data case. + :param cost: The integer value representing the relative cost of the query. :type cost: int :param timespan: Required. The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned @@ -758,8 +783,7 @@ class SubscriptionDiagnosticSettingsResource(SubscriptionProxyOnlyResource): :type logs: list[~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionLogSettings] :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -807,8 +831,8 @@ class SubscriptionDiagnosticSettingsResourceCollection(msrest.serialization.Mode """Represents a collection of subscription diagnostic settings resources. :param value: The collection of subscription diagnostic settings resources. - :type value: list[~$(python-base- - namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResource] """ _attribute_map = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py index 929a353a9bea5..a9c23992cba4f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py @@ -50,7 +50,7 @@ class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): METADATA = "Metadata" class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """the unit of the metric. + """The unit of the metric. """ COUNT = "Count" @@ -62,3 +62,7 @@ class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MILLI_SECONDS = "MilliSeconds" BYTE_SECONDS = "ByteSeconds" UNSPECIFIED = "Unspecified" + CORES = "Cores" + MILLI_CORES = "MilliCores" + NANO_CORES = "NanoCores" + BITS_PER_SECOND = "BitsPerSecond" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py index b4f988ccfad0a..34a67c997d289 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_category_operations.py @@ -92,7 +92,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResource', pipeline_response) @@ -101,7 +101,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore def list( self, @@ -147,7 +147,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) @@ -156,4 +156,4 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py index c1a0017ef0070..1a0812a78dbd9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_diagnostic_settings_operations.py @@ -92,7 +92,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -101,7 +101,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore def create_or_update( self, @@ -159,7 +159,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) @@ -168,7 +168,7 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore def delete( self, @@ -218,13 +218,13 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'} # type: ignore + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore def list( self, @@ -270,7 +270,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) @@ -279,4 +279,4 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/diagnosticSettings'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py index fe8410940a9dc..8ea5c705647b0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metric_definitions_operations.py @@ -105,7 +105,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py index f784c87fe1669..797f7c758f493 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_metrics_operations.py @@ -143,7 +143,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py index b8f0928e298b4..00fd46a8c8773 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/operations/_subscription_diagnostic_settings_operations.py @@ -46,15 +46,12 @@ def __init__(self, client, config, serializer, deserializer): def get( self, - subscription_id, # type: str name, # type: str **kwargs # type: Any ): # type: (...) -> "_models.SubscriptionDiagnosticSettingsResource" """Gets the active subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -73,7 +70,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -92,7 +89,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -105,7 +102,6 @@ def get( def create_or_update( self, - subscription_id, # type: str name, # type: str parameters, # type: "_models.SubscriptionDiagnosticSettingsResource" **kwargs # type: Any @@ -113,8 +109,6 @@ def create_or_update( # type: (...) -> "_models.SubscriptionDiagnosticSettingsResource" """Creates or updates subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :param parameters: Parameters supplied to the operation. @@ -136,7 +130,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -159,7 +153,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) @@ -172,15 +166,12 @@ def create_or_update( def delete( self, - subscription_id, # type: str name, # type: str **kwargs # type: Any ): # type: (...) -> None """Deletes existing subscription diagnostic settings for the specified resource. - :param subscription_id: The subscription id. - :type subscription_id: str :param name: The name of the diagnostic setting. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -199,7 +190,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'name': self._serialize.url("name", name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -218,7 +209,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -228,14 +219,11 @@ def delete( def list( self, - subscription_id, # type: str **kwargs # type: Any ): # type: (...) -> "_models.SubscriptionDiagnosticSettingsResourceCollection" """Gets the active subscription diagnostic settings list for the specified subscriptionId. - :param subscription_id: The subscription id. - :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SubscriptionDiagnosticSettingsResourceCollection, or the result of cls(response) :rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection @@ -252,7 +240,7 @@ def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str', skip_quote=True), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -270,7 +258,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py index 294afff25011d..6dd30405ac622 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json index 2ab7a7ecdf97e..be87d4f16fcc7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -22,7 +24,7 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -30,20 +32,60 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "metric_baseline": "MetricBaselineOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py index a2ab9af3b53c9..6b0003ef7c341 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import MetricBaselineOperations @@ -52,6 +53,21 @@ def __init__( self.metric_baseline = MetricBaselineOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py index 6d9125dcdd75b..f0599c4e5ec28 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py index 0c7128dc2c6d1..66e7e2379476e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -49,6 +50,20 @@ def __init__( self.metric_baseline = MetricBaselineOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py index d4b82f738fea6..dbf2ab029f66a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/operations/_metric_baseline_operations.py @@ -50,7 +50,7 @@ async def get( aggregation: Optional[str] = None, sensitivities: Optional[str] = None, result_type: Optional[Union[str, "_models.ResultType"]] = None, - **kwargs + **kwargs: Any ) -> "_models.BaselineResponse": """**Gets the baseline values for a specific metric**. @@ -118,7 +118,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -127,13 +127,13 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore async def calculate_baseline( self, resource_uri: str, time_series_information: "_models.TimeSeriesInformation", - **kwargs + **kwargs: Any ) -> "_models.CalculateBaselineResponse": """**Lists the baseline values for a resource**. @@ -184,7 +184,7 @@ async def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) @@ -193,4 +193,4 @@ async def calculate_baseline( return cls(pipeline_response, deserialized, {}) return deserialized - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} # type: ignore + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py index ce966a8a01032..7cdac8f92b2a6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models.py @@ -22,6 +22,8 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] """ _validation = { @@ -34,6 +36,7 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, } def __init__( @@ -44,6 +47,7 @@ def __init__( self.sensitivity = kwargs['sensitivity'] self.low_thresholds = kwargs['low_thresholds'] self.high_thresholds = kwargs['high_thresholds'] + self.timestamps = kwargs.get('timestamps', None) class BaselineMetadataValue(msrest.serialization.Model): @@ -95,8 +99,8 @@ class BaselineResponse(msrest.serialization.Model): :param baseline: the baseline values for each sensitivity. :type baseline: list[~$(python-base-namespace).v2017_11_01_preview.models.Baseline] :param metadata: the baseline metadata values. - :type metadata: list[~$(python-base- - namespace).v2017_11_01_preview.models.BaselineMetadataValue] + :type metadata: + list[~$(python-base-namespace).v2017_11_01_preview.models.BaselineMetadataValue] """ _validation = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py index 595b15225092c..343075e3c0dca 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_models_py3.py @@ -27,6 +27,8 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] """ _validation = { @@ -39,6 +41,7 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, } def __init__( @@ -47,12 +50,14 @@ def __init__( sensitivity: Union[str, "Sensitivity"], low_thresholds: List[float], high_thresholds: List[float], + timestamps: Optional[List[datetime.datetime]] = None, **kwargs ): super(Baseline, self).__init__(**kwargs) self.sensitivity = sensitivity self.low_thresholds = low_thresholds self.high_thresholds = high_thresholds + self.timestamps = timestamps class BaselineMetadataValue(msrest.serialization.Model): @@ -107,8 +112,8 @@ class BaselineResponse(msrest.serialization.Model): :param baseline: the baseline values for each sensitivity. :type baseline: list[~$(python-base-namespace).v2017_11_01_preview.models.Baseline] :param metadata: the baseline metadata values. - :type metadata: list[~$(python-base- - namespace).v2017_11_01_preview.models.BaselineMetadataValue] + :type metadata: + list[~$(python-base-namespace).v2017_11_01_preview.models.BaselineMetadataValue] """ _validation = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py index 1974d16f13c47..d3198ee568826 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/operations/_metric_baseline_operations.py @@ -123,7 +123,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -132,7 +132,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore def calculate_baseline( self, @@ -190,7 +190,7 @@ def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) @@ -199,4 +199,4 @@ def calculate_baseline( return cls(pipeline_response, deserialized, {}) return deserialized - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} # type: ignore + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py index 51f3be0f9102e..a1191ae931c45 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json index f4feaa1b41d5f..d10acf8b52db7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -22,7 +24,7 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -30,20 +32,60 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "metric_namespaces": "MetricNamespacesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py index 52d74ca8855f1..fde0624d94752 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import MetricNamespacesOperations @@ -52,6 +53,21 @@ def __init__( self.metric_namespaces = MetricNamespacesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py index b1944665bb4c2..8278395d0e83b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py index 6aa7637f579ca..174248807f3e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -49,6 +50,20 @@ def __init__( self.metric_namespaces = MetricNamespacesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py index 15497b8ed00c8..0db0d9d75a4e6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/operations/_metric_namespaces_operations.py @@ -45,7 +45,7 @@ def list( self, resource_uri: str, start_time: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricNamespaceCollection"]: """Lists the metric namespaces for the resource. @@ -106,7 +106,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py index cad75a24b7470..243ba1098bad6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/__init__.py @@ -17,9 +17,14 @@ from ._models import MetricNamespaceCollection # type: ignore from ._models import MetricNamespaceName # type: ignore +from ._monitor_management_client_enums import ( + NamespaceClassification, +) + __all__ = [ 'ErrorResponse', 'MetricNamespace', 'MetricNamespaceCollection', 'MetricNamespaceName', + 'NamespaceClassification', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py index 4ef2490bee1af..4e9ee9c2fe299 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models.py @@ -36,12 +36,15 @@ def __init__( class MetricNamespace(msrest.serialization.Model): """Metric namespace class specifies the metadata for a metric namespace. - :param id: The ID of the metricNamespace. + :param id: The ID of the metric namespace. :type id: str :param type: The type of the namespace. :type type: str - :param name: The name of the namespace. + :param name: The escaped name of the namespace. :type name: str + :param classification: Kind of namespace. Possible values include: "Platform", "Custom", "Qos". + :type classification: str or + ~$(python-base-namespace).v2017_12_01_preview.models.NamespaceClassification :param properties: Properties which include the fully qualified namespace name. :type properties: ~$(python-base-namespace).v2017_12_01_preview.models.MetricNamespaceName """ @@ -50,6 +53,7 @@ class MetricNamespace(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'classification': {'key': 'classification', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, } @@ -61,6 +65,7 @@ def __init__( self.id = kwargs.get('id', None) self.type = kwargs.get('type', None) self.name = kwargs.get('name', None) + self.classification = kwargs.get('classification', None) self.properties = kwargs.get('properties', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py index 76eba589eb68d..e31361dc0b99e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +from typing import List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._monitor_management_client_enums import * + class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. @@ -41,12 +43,15 @@ def __init__( class MetricNamespace(msrest.serialization.Model): """Metric namespace class specifies the metadata for a metric namespace. - :param id: The ID of the metricNamespace. + :param id: The ID of the metric namespace. :type id: str :param type: The type of the namespace. :type type: str - :param name: The name of the namespace. + :param name: The escaped name of the namespace. :type name: str + :param classification: Kind of namespace. Possible values include: "Platform", "Custom", "Qos". + :type classification: str or + ~$(python-base-namespace).v2017_12_01_preview.models.NamespaceClassification :param properties: Properties which include the fully qualified namespace name. :type properties: ~$(python-base-namespace).v2017_12_01_preview.models.MetricNamespaceName """ @@ -55,6 +60,7 @@ class MetricNamespace(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'classification': {'key': 'classification', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, } @@ -64,6 +70,7 @@ def __init__( id: Optional[str] = None, type: Optional[str] = None, name: Optional[str] = None, + classification: Optional[Union[str, "NamespaceClassification"]] = None, properties: Optional["MetricNamespaceName"] = None, **kwargs ): @@ -71,6 +78,7 @@ def __init__( self.id = id self.type = type self.name = name + self.classification = classification self.properties = properties diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_monitor_management_client_enums.py new file mode 100644 index 0000000000000..8df48e53f31df --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/models/_monitor_management_client_enums.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class NamespaceClassification(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Kind of namespace + """ + + PLATFORM = "Platform" + CUSTOM = "Custom" + QOS = "Qos" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py index 247d93eac5fde..97505136a4766 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/operations/_metric_namespaces_operations.py @@ -111,7 +111,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py index e27bbe464ee65..2a02767f7a672 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json index f2ee9c91c5daa..213c25c681a7b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -22,7 +24,7 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -30,21 +32,61 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "metric_definitions": "MetricDefinitionsOperations", "metrics": "MetricsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py index 4426433aa4e4f..5059198cc5e5d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import MetricDefinitionsOperations @@ -57,6 +58,21 @@ def __init__( self.metrics = MetricsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py index bcfe5f45da24b..693bca4bcf259 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py index d35ab95edecf6..b1fe92be01a38 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -54,6 +55,20 @@ def __init__( self.metrics = MetricsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py index 634aa84501b5b..0345cdbc7dcbf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metric_definitions_operations.py @@ -45,7 +45,7 @@ def list( self, resource_uri: str, metricnamespace: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricDefinitionCollection"]: """Lists the metric definitions for the resource. @@ -105,7 +105,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -114,4 +114,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py index f59760d272b8f..dca74acb8dcf7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/operations/_metrics_operations.py @@ -53,7 +53,7 @@ async def list( filter: Optional[str] = None, result_type: Optional[Union[str, "_models.ResultType"]] = None, metricnamespace: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.Response": """**Lists the metric values for a resource**. @@ -64,7 +64,9 @@ async def list( :type timespan: str :param interval: The interval (i.e. timegrain) of the query. :type interval: ~datetime.timedelta - :param metricnames: The names of the metrics (comma separated) to retrieve. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param aggregation: The list of aggregation types (comma separated) to retrieve. :type aggregation: str @@ -76,15 +78,18 @@ async def list( Only one order can be specified. Examples: sum asc. :type orderby: str - :param filter: The **$filter** is used to reduce the set of metric data - returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`- - Return all time series of C where A = a1 and B = b1 or b2:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`
`- Invalid variant::code:`
`\ **$filter=A - eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`
`This is invalid because the - logical or operator cannot separate two different metadata names.:code:`
`- Return all time - series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq - ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘\ *’ and C eq ‘*\ ’**. + :param filter: The **$filter** is used to reduce the set of metric data returned. Example: + Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or + b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A + eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or + operator cannot separate two different metadata names. - Return all time series where A = a1, B + = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series + where A = a1 **$filter=A eq 'a1' and B eq '\ *' and C eq '*\ '**. Special case: When dimension + name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** + Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ + ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ + ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. :type filter: str :param result_type: Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. @@ -143,7 +148,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) @@ -152,4 +157,4 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metrics'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.py index 5602c66d77af6..7e8c48f6ea43a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/__init__.py @@ -31,8 +31,9 @@ from ._monitor_management_client_enums import ( AggregationType, + MetricClass, + MetricUnit, ResultType, - Unit, ) __all__ = [ @@ -47,6 +48,7 @@ 'Response', 'TimeSeriesElement', 'AggregationType', + 'MetricClass', + 'MetricUnit', 'ResultType', - 'Unit', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py index 187e8d93f7c30..f474ab6343f0b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models.py @@ -97,10 +97,16 @@ class Metric(msrest.serialization.Model): :param name: Required. the name and the display name of the metric, i.e. it is localizable string. :type name: ~$(python-base-namespace).v2018_01_01.models.LocalizableString - :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes", + :param display_description: Detailed description of this metric. + :type display_description: str + :param error_code: 'Success' or the error details on query failures for this metric. + :type error_code: str + :param error_message: Error message encountered querying this specific metric. + :type error_message: str + :param unit: Required. The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". - :type unit: str or ~$(python-base-namespace).v2018_01_01.models.Unit + :type unit: str or ~$(python-base-namespace).v2018_01_01.models.MetricUnit :param timeseries: Required. the time series returned when a data query is performed. :type timeseries: list[~$(python-base-namespace).v2018_01_01.models.TimeSeriesElement] """ @@ -117,6 +123,9 @@ class Metric(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, } @@ -129,6 +138,9 @@ def __init__( self.id = kwargs['id'] self.type = kwargs['type'] self.name = kwargs['name'] + self.display_description = kwargs.get('display_description', None) + self.error_code = kwargs.get('error_code', None) + self.error_message = kwargs.get('error_message', None) self.unit = kwargs['unit'] self.timeseries = kwargs['timeseries'] @@ -169,22 +181,29 @@ class MetricDefinition(msrest.serialization.Model): :type namespace: str :param name: the name and the display name of the metric, i.e. it is a localizable string. :type name: ~$(python-base-namespace).v2018_01_01.models.LocalizableString - :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", + :param display_description: Detailed description of this metric. + :type display_description: str + :param category: Custom category name for this metric. + :type category: str + :param metric_class: The class of the metric. Possible values include: "Availability", + "Transactions", "Errors", "Latency", "Saturation". + :type metric_class: str or ~$(python-base-namespace).v2018_01_01.models.MetricClass + :param unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". - :type unit: str or ~$(python-base-namespace).v2018_01_01.models.Unit + :type unit: str or ~$(python-base-namespace).v2018_01_01.models.MetricUnit :param primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :type primary_aggregation_type: str or ~$(python-base- - namespace).v2018_01_01.models.AggregationType + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2018_01_01.models.AggregationType :param supported_aggregation_types: the collection of what aggregation types are supported. - :type supported_aggregation_types: list[str or ~$(python-base- - namespace).v2018_01_01.models.AggregationType] + :type supported_aggregation_types: list[str or + ~$(python-base-namespace).v2018_01_01.models.AggregationType] :param metric_availabilities: the collection of what aggregation intervals are available to be queried. - :type metric_availabilities: list[~$(python-base- - namespace).v2018_01_01.models.MetricAvailability] + :type metric_availabilities: + list[~$(python-base-namespace).v2018_01_01.models.MetricAvailability] :param id: the resource identifier of the metric definition. :type id: str :param dimensions: the name and the display name of the dimension, i.e. it is a localizable @@ -197,6 +216,9 @@ class MetricDefinition(msrest.serialization.Model): 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'namespace': {'key': 'namespace', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'metric_class': {'key': 'metricClass', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, @@ -214,6 +236,9 @@ def __init__( self.resource_id = kwargs.get('resource_id', None) self.namespace = kwargs.get('namespace', None) self.name = kwargs.get('name', None) + self.display_description = kwargs.get('display_description', None) + self.category = kwargs.get('category', None) + self.metric_class = kwargs.get('metric_class', None) self.unit = kwargs.get('unit', None) self.primary_aggregation_type = kwargs.get('primary_aggregation_type', None) self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) @@ -298,7 +323,7 @@ class Response(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param cost: The integer value representing the cost of the query, for data case. + :param cost: The integer value representing the relative cost of the query. :type cost: int :param timespan: Required. The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned @@ -308,9 +333,9 @@ class Response(msrest.serialization.Model): may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. :type interval: ~datetime.timedelta - :param namespace: The namespace of the metrics been queried. + :param namespace: The namespace of the metrics being queried. :type namespace: str - :param resourceregion: The region of the resource been queried for metrics. + :param resourceregion: The region of the resource being queried for metrics. :type resourceregion: str :param value: Required. the value of the collection. :type value: list[~$(python-base-namespace).v2018_01_01.models.Metric] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py index 5b49d941a646d..d82c93e35b597 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_models_py3.py @@ -111,10 +111,16 @@ class Metric(msrest.serialization.Model): :param name: Required. the name and the display name of the metric, i.e. it is localizable string. :type name: ~$(python-base-namespace).v2018_01_01.models.LocalizableString - :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes", + :param display_description: Detailed description of this metric. + :type display_description: str + :param error_code: 'Success' or the error details on query failures for this metric. + :type error_code: str + :param error_message: Error message encountered querying this specific metric. + :type error_message: str + :param unit: Required. The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". - :type unit: str or ~$(python-base-namespace).v2018_01_01.models.Unit + :type unit: str or ~$(python-base-namespace).v2018_01_01.models.MetricUnit :param timeseries: Required. the time series returned when a data query is performed. :type timeseries: list[~$(python-base-namespace).v2018_01_01.models.TimeSeriesElement] """ @@ -131,6 +137,9 @@ class Metric(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, } @@ -141,14 +150,20 @@ def __init__( id: str, type: str, name: "LocalizableString", - unit: Union[str, "Unit"], + unit: Union[str, "MetricUnit"], timeseries: List["TimeSeriesElement"], + display_description: Optional[str] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, **kwargs ): super(Metric, self).__init__(**kwargs) self.id = id self.type = type self.name = name + self.display_description = display_description + self.error_code = error_code + self.error_message = error_message self.unit = unit self.timeseries = timeseries @@ -192,22 +207,29 @@ class MetricDefinition(msrest.serialization.Model): :type namespace: str :param name: the name and the display name of the metric, i.e. it is a localizable string. :type name: ~$(python-base-namespace).v2018_01_01.models.LocalizableString - :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", + :param display_description: Detailed description of this metric. + :type display_description: str + :param category: Custom category name for this metric. + :type category: str + :param metric_class: The class of the metric. Possible values include: "Availability", + "Transactions", "Errors", "Latency", "Saturation". + :type metric_class: str or ~$(python-base-namespace).v2018_01_01.models.MetricClass + :param unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". - :type unit: str or ~$(python-base-namespace).v2018_01_01.models.Unit + :type unit: str or ~$(python-base-namespace).v2018_01_01.models.MetricUnit :param primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :type primary_aggregation_type: str or ~$(python-base- - namespace).v2018_01_01.models.AggregationType + :type primary_aggregation_type: str or + ~$(python-base-namespace).v2018_01_01.models.AggregationType :param supported_aggregation_types: the collection of what aggregation types are supported. - :type supported_aggregation_types: list[str or ~$(python-base- - namespace).v2018_01_01.models.AggregationType] + :type supported_aggregation_types: list[str or + ~$(python-base-namespace).v2018_01_01.models.AggregationType] :param metric_availabilities: the collection of what aggregation intervals are available to be queried. - :type metric_availabilities: list[~$(python-base- - namespace).v2018_01_01.models.MetricAvailability] + :type metric_availabilities: + list[~$(python-base-namespace).v2018_01_01.models.MetricAvailability] :param id: the resource identifier of the metric definition. :type id: str :param dimensions: the name and the display name of the dimension, i.e. it is a localizable @@ -220,6 +242,9 @@ class MetricDefinition(msrest.serialization.Model): 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'namespace': {'key': 'namespace', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'metric_class': {'key': 'metricClass', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, @@ -235,7 +260,10 @@ def __init__( resource_id: Optional[str] = None, namespace: Optional[str] = None, name: Optional["LocalizableString"] = None, - unit: Optional[Union[str, "Unit"]] = None, + display_description: Optional[str] = None, + category: Optional[str] = None, + metric_class: Optional[Union[str, "MetricClass"]] = None, + unit: Optional[Union[str, "MetricUnit"]] = None, primary_aggregation_type: Optional[Union[str, "AggregationType"]] = None, supported_aggregation_types: Optional[List[Union[str, "AggregationType"]]] = None, metric_availabilities: Optional[List["MetricAvailability"]] = None, @@ -248,6 +276,9 @@ def __init__( self.resource_id = resource_id self.namespace = namespace self.name = name + self.display_description = display_description + self.category = category + self.metric_class = metric_class self.unit = unit self.primary_aggregation_type = primary_aggregation_type self.supported_aggregation_types = supported_aggregation_types @@ -341,7 +372,7 @@ class Response(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param cost: The integer value representing the cost of the query, for data case. + :param cost: The integer value representing the relative cost of the query. :type cost: int :param timespan: Required. The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned @@ -351,9 +382,9 @@ class Response(msrest.serialization.Model): may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. :type interval: ~datetime.timedelta - :param namespace: The namespace of the metrics been queried. + :param namespace: The namespace of the metrics being queried. :type namespace: str - :param resourceregion: The region of the resource been queried for metrics. + :param resourceregion: The region of the resource being queried for metrics. :type resourceregion: str :param value: Required. the value of the collection. :type value: list[~$(python-base-namespace).v2018_01_01.models.Metric] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py index 02a44ae871bf2..6f8d86605f131 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py @@ -37,13 +37,18 @@ class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MAXIMUM = "Maximum" TOTAL = "Total" -class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricClass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The class of the metric. + """ - DATA = "Data" - METADATA = "Metadata" + AVAILABILITY = "Availability" + TRANSACTIONS = "Transactions" + ERRORS = "Errors" + LATENCY = "Latency" + SATURATION = "Saturation" -class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """the unit of the metric. +class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit of the metric. """ COUNT = "Count" @@ -59,3 +64,8 @@ class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MILLI_CORES = "MilliCores" NANO_CORES = "NanoCores" BITS_PER_SECOND = "BitsPerSecond" + +class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DATA = "Data" + METADATA = "Metadata" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py index 03e9da0f5741c..c3c1565f29c72 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metric_definitions_operations.py @@ -110,7 +110,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -119,4 +119,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py index 0c4201e92e8ab..5f9c37f406805 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/operations/_metrics_operations.py @@ -69,7 +69,9 @@ def list( :type timespan: str :param interval: The interval (i.e. timegrain) of the query. :type interval: ~datetime.timedelta - :param metricnames: The names of the metrics (comma separated) to retrieve. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param aggregation: The list of aggregation types (comma separated) to retrieve. :type aggregation: str @@ -81,15 +83,18 @@ def list( Only one order can be specified. Examples: sum asc. :type orderby: str - :param filter: The **$filter** is used to reduce the set of metric data - returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`- - Return all time series of C where A = a1 and B = b1 or b2:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`
`- Invalid variant::code:`
`\ **$filter=A - eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`
`This is invalid because the - logical or operator cannot separate two different metadata names.:code:`
`- Return all time - series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq - ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘\ *’ and C eq ‘*\ ’**. + :param filter: The **$filter** is used to reduce the set of metric data returned. Example: + Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or + b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A + eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or + operator cannot separate two different metadata names. - Return all time series where A = a1, B + = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series + where A = a1 **$filter=A eq 'a1' and B eq '\ *' and C eq '*\ '**. Special case: When dimension + name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** + Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ + ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ + ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. :type filter: str :param result_type: Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. @@ -148,7 +153,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Response', pipeline_response) @@ -157,4 +162,4 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metrics'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py index c8591f1762c2e..779b6a13b7c4a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json index c4e4884f37a9d..72ef172f93062 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,43 +23,83 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "action_groups": "ActionGroupsOperations", "metric_alerts": "MetricAlertsOperations", "metric_alerts_status": "MetricAlertsStatusOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py index fd71e69c92ba8..bdf4e77f7ef00 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ActionGroupsOperations @@ -35,7 +36,7 @@ class MonitorManagementClient(object): :vartype metric_alerts_status: $(python-base-namespace).v2018_03_01.operations.MetricAlertsStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -65,6 +66,24 @@ def __init__( self.metric_alerts_status = MetricAlertsStatusOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py index 01b940070f935..aa202fc38ef3a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py index 85660a0938d79..c4d3e8ba5c329 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -33,7 +34,7 @@ class MonitorManagementClient(object): :vartype metric_alerts_status: $(python-base-namespace).v2018_03_01.aio.operations.MetricAlertsStatusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -62,6 +63,23 @@ def __init__( self.metric_alerts_status = MetricAlertsStatusOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py index b5887d78df964..9f3045ddf232d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_action_groups_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, action_group_name: str, action_group: "_models.ActionGroupResource", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Get an action group. @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -175,7 +175,7 @@ async def delete( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an action group. @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ async def update( resource_group_name: str, action_group_name: str, action_group_patch: "_models.ActionGroupPatchBody", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -296,7 +296,7 @@ async def update( def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -364,7 +364,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -437,7 +437,7 @@ async def enable_receiver( resource_group_name: str, action_group_name: str, enable_request: "_models.EnableRequest", - **kwargs + **kwargs: Any ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py index f05312f25a402..96cb5971700c7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricAlertResourceCollection"]: """Retrieve alert rule definitions in a subscription. @@ -69,7 +69,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -97,7 +97,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -111,7 +111,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricAlertResourceCollection"]: """Retrieve alert rule definitions in a resource group. @@ -139,7 +139,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -168,7 +168,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -183,7 +183,7 @@ async def get( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.MetricAlertResource": """Retrieve an alert rule definition. @@ -207,7 +207,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -227,7 +227,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -243,7 +243,7 @@ async def create_or_update( resource_group_name: str, rule_name: str, parameters: "_models.MetricAlertResource", - **kwargs + **kwargs: Any ) -> "_models.MetricAlertResource": """Create or update an metric alert definition. @@ -270,7 +270,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -294,7 +294,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -310,7 +310,7 @@ async def update( resource_group_name: str, rule_name: str, parameters: "_models.MetricAlertResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.MetricAlertResource": """Update an metric alert definition. @@ -337,7 +337,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -361,7 +361,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -376,7 +376,7 @@ async def delete( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an alert rule definition. @@ -395,11 +395,12 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -411,6 +412,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -418,7 +420,8 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py index 8700d6231456b..0c216dfd66531 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/operations/_metric_alerts_status_operations.py @@ -44,7 +44,7 @@ async def list( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.MetricAlertStatusCollection": """Retrieve an alert rule status. @@ -68,7 +68,7 @@ async def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -88,7 +88,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) @@ -104,7 +104,7 @@ async def list_by_name( resource_group_name: str, rule_name: str, status_name: str, - **kwargs + **kwargs: Any ) -> "_models.MetricAlertStatusCollection": """Retrieve an alert rule status. @@ -130,7 +130,7 @@ async def list_by_name( # Construct URL url = self.list_by_name.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'statusName': self._serialize.url("status_name", status_name, 'str'), @@ -151,7 +151,7 @@ async def list_by_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py index 5c062c3233c5b..6feb745bd3331 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/__init__.py @@ -72,7 +72,7 @@ from ._models import WebtestLocationAvailabilityCriteria # type: ignore from ._monitor_management_client_enums import ( - AggregationType, + AggregationTypeEnum, CriterionType, DynamicThresholdOperator, DynamicThresholdSensitivity, @@ -113,7 +113,7 @@ 'VoiceReceiver', 'WebhookReceiver', 'WebtestLocationAvailabilityCriteria', - 'AggregationType', + 'AggregationTypeEnum', 'CriterionType', 'DynamicThresholdOperator', 'DynamicThresholdSensitivity', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py index 71bcd9cc55e57..6b9f2a314e5fc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models.py @@ -135,20 +135,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2018_03_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2018_03_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2018_03_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2018_03_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2018_03_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2018_03_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2018_03_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2018_03_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2018_03_01.models.AzureFunctionReceiver] """ _validation = { @@ -327,7 +327,7 @@ class MultiMetricCriteria(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param criterion_type: Required. Specifies the type of threshold criteria.Constant filled by server. Possible values include: "StaticThresholdCriterion", "DynamicThresholdCriterion". :type criterion_type: str or ~$(python-base-namespace).v2018_03_01.models.CriterionType @@ -339,7 +339,7 @@ class MultiMetricCriteria(msrest.serialization.Model): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -391,7 +391,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param criterion_type: Required. Specifies the type of threshold criteria.Constant filled by server. Possible values include: "StaticThresholdCriterion", "DynamicThresholdCriterion". :type criterion_type: str or ~$(python-base-namespace).v2018_03_01.models.CriterionType @@ -403,7 +403,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -415,12 +415,12 @@ class DynamicMetricCriteria(MultiMetricCriteria): :param alert_sensitivity: Required. The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: "Low", "Medium", "High". - :type alert_sensitivity: str or ~$(python-base- - namespace).v2018_03_01.models.DynamicThresholdSensitivity + :type alert_sensitivity: str or + ~$(python-base-namespace).v2018_03_01.models.DynamicThresholdSensitivity :param failing_periods: Required. The minimum number of violations required within the selected lookback time window required to raise an alert. - :type failing_periods: ~$(python-base- - namespace).v2018_03_01.models.DynamicThresholdFailingPeriods + :type failing_periods: + ~$(python-base-namespace).v2018_03_01.models.DynamicThresholdFailingPeriods :param ignore_data_before: Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format). :type ignore_data_before: ~datetime.datetime @@ -673,7 +673,8 @@ class MetricAlertAction(msrest.serialization.Model): :param action_group_id: the id of the action group to use. :type action_group_id: str - :param web_hook_properties: The properties of a webhook object. + :param web_hook_properties: This field allows specifying custom properties, which would be + appended to the alert payload sent as input to the webhook. :type web_hook_properties: dict[str, str] """ @@ -701,7 +702,7 @@ class MetricAlertCriteria(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", @@ -739,7 +740,7 @@ class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", @@ -786,14 +787,14 @@ class MetricAlertResource(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param description: Required. the description of the metric alert that will be included in the - alert email. + :param description: the description of the metric alert that will be included in the alert + email. :type description: str :param severity: Required. Alert severity {0, 1, 2, 3, 4}. :type severity: int :param enabled: Required. the flag that indicates whether the metric alert is enabled. :type enabled: bool - :param scopes: the list of resource id's that this metric alert is scoped to. + :param scopes: Required. the list of resource id's that this metric alert is scoped to. :type scopes: list[str] :param evaluation_frequency: Required. how often the metric alert is evaluated represented in ISO 8601 duration format. @@ -802,10 +803,12 @@ class MetricAlertResource(Resource): monitor alert activity based on the threshold. :type window_size: ~datetime.timedelta :param target_resource_type: the resource type of the target resource(s) on which the alert is - created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + created/updated. Mandatory if the scope contains a subscription, resource group, or more than + one resource. :type target_resource_type: str :param target_resource_region: the region of the target resource(s) on which the alert is - created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + created/updated. Mandatory if the scope contains a subscription, resource group, or more than + one resource. :type target_resource_region: str :param criteria: Required. defines the specific alert criteria information. :type criteria: ~$(python-base-namespace).v2018_03_01.models.MetricAlertCriteria @@ -817,6 +820,8 @@ class MetricAlertResource(Resource): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: bool """ _validation = { @@ -824,13 +829,14 @@ class MetricAlertResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'description': {'required': True}, 'severity': {'required': True}, 'enabled': {'required': True}, + 'scopes': {'required': True}, 'evaluation_frequency': {'required': True}, 'window_size': {'required': True}, 'criteria': {'required': True}, 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -851,6 +857,7 @@ class MetricAlertResource(Resource): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'bool'}, } def __init__( @@ -858,10 +865,10 @@ def __init__( **kwargs ): super(MetricAlertResource, self).__init__(**kwargs) - self.description = kwargs['description'] + self.description = kwargs.get('description', None) self.severity = kwargs['severity'] self.enabled = kwargs['enabled'] - self.scopes = kwargs.get('scopes', None) + self.scopes = kwargs['scopes'] self.evaluation_frequency = kwargs['evaluation_frequency'] self.window_size = kwargs['window_size'] self.target_resource_type = kwargs.get('target_resource_type', None) @@ -870,6 +877,7 @@ def __init__( self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None + self.is_migrated = None class MetricAlertResourceCollection(msrest.serialization.Model): @@ -929,10 +937,13 @@ class MetricAlertResourcePatch(msrest.serialization.Model): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: bool """ _validation = { 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -949,6 +960,7 @@ class MetricAlertResourcePatch(msrest.serialization.Model): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'bool'}, } def __init__( @@ -969,6 +981,7 @@ def __init__( self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None + self.is_migrated = None class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): @@ -978,7 +991,7 @@ class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", @@ -1092,7 +1105,7 @@ class MetricCriteria(MultiMetricCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param criterion_type: Required. Specifies the type of threshold criteria.Constant filled by server. Possible values include: "StaticThresholdCriterion", "DynamicThresholdCriterion". :type criterion_type: str or ~$(python-base-namespace).v2018_03_01.models.CriterionType @@ -1104,7 +1117,7 @@ class MetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -1302,7 +1315,7 @@ class WebtestLocationAvailabilityCriteria(MetricAlertCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py index ae64742a6783a..10e28085291b7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_models_py3.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -149,20 +149,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2018_03_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2018_03_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2018_03_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2018_03_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2018_03_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2018_03_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2018_03_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2018_03_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2018_03_01.models.AzureFunctionReceiver] """ _validation = { @@ -370,7 +370,7 @@ class MultiMetricCriteria(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param criterion_type: Required. Specifies the type of threshold criteria.Constant filled by server. Possible values include: "StaticThresholdCriterion", "DynamicThresholdCriterion". :type criterion_type: str or ~$(python-base-namespace).v2018_03_01.models.CriterionType @@ -382,7 +382,7 @@ class MultiMetricCriteria(msrest.serialization.Model): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -417,8 +417,8 @@ def __init__( *, name: str, metric_name: str, - time_aggregation: Union[str, "AggregationType"], - additional_properties: Optional[Dict[str, object]] = None, + time_aggregation: Union[str, "AggregationTypeEnum"], + additional_properties: Optional[Dict[str, Any]] = None, metric_namespace: Optional[str] = None, dimensions: Optional[List["MetricDimension"]] = None, skip_metric_validation: Optional[bool] = None, @@ -442,7 +442,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param criterion_type: Required. Specifies the type of threshold criteria.Constant filled by server. Possible values include: "StaticThresholdCriterion", "DynamicThresholdCriterion". :type criterion_type: str or ~$(python-base-namespace).v2018_03_01.models.CriterionType @@ -454,7 +454,7 @@ class DynamicMetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -466,12 +466,12 @@ class DynamicMetricCriteria(MultiMetricCriteria): :param alert_sensitivity: Required. The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: "Low", "Medium", "High". - :type alert_sensitivity: str or ~$(python-base- - namespace).v2018_03_01.models.DynamicThresholdSensitivity + :type alert_sensitivity: str or + ~$(python-base-namespace).v2018_03_01.models.DynamicThresholdSensitivity :param failing_periods: Required. The minimum number of violations required within the selected lookback time window required to raise an alert. - :type failing_periods: ~$(python-base- - namespace).v2018_03_01.models.DynamicThresholdFailingPeriods + :type failing_periods: + ~$(python-base-namespace).v2018_03_01.models.DynamicThresholdFailingPeriods :param ignore_data_before: Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format). :type ignore_data_before: ~datetime.datetime @@ -507,11 +507,11 @@ def __init__( *, name: str, metric_name: str, - time_aggregation: Union[str, "AggregationType"], + time_aggregation: Union[str, "AggregationTypeEnum"], operator: Union[str, "DynamicThresholdOperator"], alert_sensitivity: Union[str, "DynamicThresholdSensitivity"], failing_periods: "DynamicThresholdFailingPeriods", - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, metric_namespace: Optional[str] = None, dimensions: Optional[List["MetricDimension"]] = None, skip_metric_validation: Optional[bool] = None, @@ -757,7 +757,8 @@ class MetricAlertAction(msrest.serialization.Model): :param action_group_id: the id of the action group to use. :type action_group_id: str - :param web_hook_properties: The properties of a webhook object. + :param web_hook_properties: This field allows specifying custom properties, which would be + appended to the alert payload sent as input to the webhook. :type web_hook_properties: dict[str, str] """ @@ -788,7 +789,7 @@ class MetricAlertCriteria(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", @@ -813,7 +814,7 @@ class MetricAlertCriteria(msrest.serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): super(MetricAlertCriteria, self).__init__(**kwargs) @@ -828,7 +829,7 @@ class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", @@ -852,7 +853,7 @@ class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): def __init__( self, *, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, all_of: Optional[List["MultiMetricCriteria"]] = None, **kwargs ): @@ -878,14 +879,14 @@ class MetricAlertResource(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param description: Required. the description of the metric alert that will be included in the - alert email. + :param description: the description of the metric alert that will be included in the alert + email. :type description: str :param severity: Required. Alert severity {0, 1, 2, 3, 4}. :type severity: int :param enabled: Required. the flag that indicates whether the metric alert is enabled. :type enabled: bool - :param scopes: the list of resource id's that this metric alert is scoped to. + :param scopes: Required. the list of resource id's that this metric alert is scoped to. :type scopes: list[str] :param evaluation_frequency: Required. how often the metric alert is evaluated represented in ISO 8601 duration format. @@ -894,10 +895,12 @@ class MetricAlertResource(Resource): monitor alert activity based on the threshold. :type window_size: ~datetime.timedelta :param target_resource_type: the resource type of the target resource(s) on which the alert is - created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + created/updated. Mandatory if the scope contains a subscription, resource group, or more than + one resource. :type target_resource_type: str :param target_resource_region: the region of the target resource(s) on which the alert is - created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + created/updated. Mandatory if the scope contains a subscription, resource group, or more than + one resource. :type target_resource_region: str :param criteria: Required. defines the specific alert criteria information. :type criteria: ~$(python-base-namespace).v2018_03_01.models.MetricAlertCriteria @@ -909,6 +912,8 @@ class MetricAlertResource(Resource): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: bool """ _validation = { @@ -916,13 +921,14 @@ class MetricAlertResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'description': {'required': True}, 'severity': {'required': True}, 'enabled': {'required': True}, + 'scopes': {'required': True}, 'evaluation_frequency': {'required': True}, 'window_size': {'required': True}, 'criteria': {'required': True}, 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -943,20 +949,21 @@ class MetricAlertResource(Resource): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'bool'}, } def __init__( self, *, location: str, - description: str, severity: int, enabled: bool, + scopes: List[str], evaluation_frequency: datetime.timedelta, window_size: datetime.timedelta, criteria: "MetricAlertCriteria", tags: Optional[Dict[str, str]] = None, - scopes: Optional[List[str]] = None, + description: Optional[str] = None, target_resource_type: Optional[str] = None, target_resource_region: Optional[str] = None, auto_mitigate: Optional[bool] = None, @@ -976,6 +983,7 @@ def __init__( self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None + self.is_migrated = None class MetricAlertResourceCollection(msrest.serialization.Model): @@ -1037,10 +1045,13 @@ class MetricAlertResourcePatch(msrest.serialization.Model): :type actions: list[~$(python-base-namespace).v2018_03_01.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: ~datetime.datetime + :ivar is_migrated: the value indicating whether this alert rule is migrated. + :vartype is_migrated: bool """ _validation = { 'last_updated_time': {'readonly': True}, + 'is_migrated': {'readonly': True}, } _attribute_map = { @@ -1057,6 +1068,7 @@ class MetricAlertResourcePatch(msrest.serialization.Model): 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, + 'is_migrated': {'key': 'properties.isMigrated', 'type': 'bool'}, } def __init__( @@ -1090,6 +1102,7 @@ def __init__( self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None + self.is_migrated = None class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): @@ -1099,7 +1112,7 @@ class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", @@ -1123,7 +1136,7 @@ class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): def __init__( self, *, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, all_of: Optional[List["MetricCriteria"]] = None, **kwargs ): @@ -1227,7 +1240,7 @@ class MetricCriteria(MultiMetricCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param criterion_type: Required. Specifies the type of threshold criteria.Constant filled by server. Possible values include: "StaticThresholdCriterion", "DynamicThresholdCriterion". :type criterion_type: str or ~$(python-base-namespace).v2018_03_01.models.CriterionType @@ -1239,7 +1252,7 @@ class MetricCriteria(MultiMetricCriteria): :type metric_namespace: str :param time_aggregation: Required. the criteria time aggregation types. Possible values include: "Average", "Count", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationType + :type time_aggregation: str or ~$(python-base-namespace).v2018_03_01.models.AggregationTypeEnum :param dimensions: List of dimension conditions. :type dimensions: list[~$(python-base-namespace).v2018_03_01.models.MetricDimension] :param skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet @@ -1279,10 +1292,10 @@ def __init__( *, name: str, metric_name: str, - time_aggregation: Union[str, "AggregationType"], + time_aggregation: Union[str, "AggregationTypeEnum"], operator: Union[str, "Operator"], threshold: float, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, metric_namespace: Optional[str] = None, dimensions: Optional[List["MetricDimension"]] = None, skip_metric_validation: Optional[bool] = None, @@ -1462,7 +1475,7 @@ class WebtestLocationAvailabilityCriteria(MetricAlertCriteria): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_type: Required. specifies the type of the alert criteria.Constant filled by server. Possible values include: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", @@ -1498,7 +1511,7 @@ def __init__( web_test_id: str, component_id: str, failed_location_count: float, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): super(WebtestLocationAvailabilityCriteria, self).__init__(additional_properties=additional_properties, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py index 974c2895a8cb3..8e62d4320379b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py @@ -26,7 +26,7 @@ def __getattr__(cls, name): raise AttributeError(name) -class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregationTypeEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """the criteria time aggregation types. """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py index 3bf283074e85f..d50c72b70007f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py index 497d473da137a..4a6efc48270ef 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_operations.py @@ -74,7 +74,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -102,7 +102,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -145,7 +145,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -174,7 +174,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -214,7 +214,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -234,7 +234,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -278,7 +278,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -302,7 +302,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -346,7 +346,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -370,7 +370,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertResource', pipeline_response) @@ -405,11 +405,12 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -421,6 +422,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -428,7 +430,8 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py index 82aa2f529a36c..121c90a9fdaaa 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_metric_alerts_status_operations.py @@ -73,7 +73,7 @@ def list( # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -93,7 +93,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) @@ -136,7 +136,7 @@ def list_by_name( # Construct URL url = self.list_by_name.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), 'statusName': self._serialize.url("status_name", status_name, 'str'), @@ -157,7 +157,7 @@ def list_by_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricAlertStatusCollection', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py index 93b3c96a4a307..b6128ee1573c7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json index 391f8c05034da..1096c3229c333 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,41 +23,81 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "scheduled_query_rules": "ScheduledQueryRulesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py index 775dcebb84e46..956b94a97ccb6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ScheduledQueryRulesOperations @@ -29,7 +30,7 @@ class MonitorManagementClient(object): :vartype scheduled_query_rules: $(python-base-namespace).v2018_04_16.operations.ScheduledQueryRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -55,6 +56,24 @@ def __init__( self.scheduled_query_rules = ScheduledQueryRulesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py index 621208fc53b3f..601c1798da2a0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py index 72801e36fa29a..ea933cca6b443 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -27,7 +28,7 @@ class MonitorManagementClient(object): :vartype scheduled_query_rules: $(python-base-namespace).v2018_04_16.aio.operations.ScheduledQueryRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,6 +53,23 @@ def __init__( self.scheduled_query_rules = ScheduledQueryRulesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py index 655f208582878..67665d0db68e9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/operations/_scheduled_query_rules_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, rule_name: str, parameters: "_models.LogSearchRuleResource", - **kwargs + **kwargs: Any ) -> "_models.LogSearchRuleResource": """Creates or updates an log search rule. @@ -73,7 +73,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -110,13 +110,13 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore async def get( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.LogSearchRuleResource": """Gets an Log Search rule. @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -169,14 +169,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore async def update( self, resource_group_name: str, rule_name: str, parameters: "_models.LogSearchRuleResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.LogSearchRuleResource": """Update log search Rule. @@ -203,7 +203,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -227,7 +227,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -236,13 +236,13 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore async def delete( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a Log Search rule. @@ -268,7 +268,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -286,18 +286,18 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def list_by_subscription( self, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.LogSearchRuleResourceCollection"]: """List the Log Search rules within a subscription group. @@ -326,7 +326,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -356,7 +356,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -365,13 +365,13 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore def list_by_resource_group( self, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.LogSearchRuleResourceCollection"]: """List the Log Search rules within a resource group. @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -433,7 +433,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -442,4 +442,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py index 2d034d8b31165..31b0b1f63a155 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/__init__.py @@ -12,6 +12,7 @@ from ._models_py3 import AzNsActionGroup from ._models_py3 import Criteria from ._models_py3 import Dimension + from ._models_py3 import ErrorContract from ._models_py3 import ErrorResponse from ._models_py3 import LogMetricTrigger from ._models_py3 import LogSearchRuleResource @@ -28,6 +29,7 @@ from ._models import AzNsActionGroup # type: ignore from ._models import Criteria # type: ignore from ._models import Dimension # type: ignore + from ._models import ErrorContract # type: ignore from ._models import ErrorResponse # type: ignore from ._models import LogMetricTrigger # type: ignore from ._models import LogSearchRuleResource # type: ignore @@ -55,6 +57,7 @@ 'AzNsActionGroup', 'Criteria', 'Dimension', + 'ErrorContract', 'ErrorResponse', 'LogMetricTrigger', 'LogSearchRuleResource', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py index 6fd144dc7a89b..b59b0546318ab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models.py @@ -180,6 +180,25 @@ def __init__( self.values = kwargs['values'] +class ErrorContract(msrest.serialization.Model): + """Describes the format of Error response. + + :param error: The error details. + :type error: ~$(python-base-namespace).v2018_04_16.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorContract, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. @@ -207,15 +226,16 @@ class LogMetricTrigger(msrest.serialization.Model): """A log metrics trigger descriptor. :param threshold_operator: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or - 'Equal'. Possible values include: "GreaterThan", "LessThan", "Equal". - :type threshold_operator: str or ~$(python-base- - namespace).v2018_04_16.models.ConditionalOperator + 'Equal'. Possible values include: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", + "LessThan", "Equal". Default value: "GreaterThanOrEqual". + :type threshold_operator: str or + ~$(python-base-namespace).v2018_04_16.models.ConditionalOperator :param threshold: The threshold of the metric trigger. :type threshold: float :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or 'Total'. Possible values - include: "Consecutive", "Total". - :type metric_trigger_type: str or ~$(python-base- - namespace).v2018_04_16.models.MetricTriggerType + include: "Consecutive", "Total". Default value: "Consecutive". + :type metric_trigger_type: str or + ~$(python-base-namespace).v2018_04_16.models.MetricTriggerType :param metric_column: Evaluation of metric on a particular column. :type metric_column: str """ @@ -232,9 +252,9 @@ def __init__( **kwargs ): super(LogMetricTrigger, self).__init__(**kwargs) - self.threshold_operator = kwargs.get('threshold_operator', None) + self.threshold_operator = kwargs.get('threshold_operator', "GreaterThanOrEqual") self.threshold = kwargs.get('threshold', None) - self.metric_trigger_type = kwargs.get('metric_trigger_type', None) + self.metric_trigger_type = kwargs.get('metric_trigger_type', "Consecutive") self.metric_column = kwargs.get('metric_column', None) @@ -255,6 +275,16 @@ class Resource(msrest.serialization.Model): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :vartype kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str """ _validation = { @@ -262,6 +292,8 @@ class Resource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'kind': {'readonly': True}, + 'etag': {'readonly': True}, } _attribute_map = { @@ -270,6 +302,8 @@ class Resource(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, } def __init__( @@ -282,6 +316,8 @@ def __init__( self.type = None self.location = kwargs['location'] self.tags = kwargs.get('tags', None) + self.kind = None + self.etag = None class LogSearchRuleResource(Resource): @@ -301,8 +337,27 @@ class LogSearchRuleResource(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :vartype kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the Log Search rule. :type description: str + :param display_name: The display name of the alert rule. + :type display_name: str + :param auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is false. + :type auto_mitigate: bool :param enabled: The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: "true", "false". :type enabled: str or ~$(python-base-namespace).v2018_04_16.models.Enabled @@ -310,8 +365,8 @@ class LogSearchRuleResource(Resource): :vartype last_updated_time: ~datetime.datetime :ivar provisioning_state: Provisioning state of the scheduled query rule. Possible values include: "Succeeded", "Deploying", "Canceled", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2018_04_16.models.ProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2018_04_16.models.ProvisioningState :param source: Required. Data Source against which rule will Query Data. :type source: ~$(python-base-namespace).v2018_04_16.models.Source :param schedule: Schedule (Frequency, Time Window) for rule. Required for action type - @@ -326,6 +381,10 @@ class LogSearchRuleResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'kind': {'readonly': True}, + 'etag': {'readonly': True}, + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, 'last_updated_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'source': {'required': True}, @@ -338,7 +397,13 @@ class LogSearchRuleResource(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'enabled': {'key': 'properties.enabled', 'type': 'str'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -352,7 +417,11 @@ def __init__( **kwargs ): super(LogSearchRuleResource, self).__init__(**kwargs) + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.auto_mitigate = kwargs.get('auto_mitigate', False) self.enabled = kwargs.get('enabled', None) self.last_updated_time = None self.provisioning_state = None @@ -510,9 +579,10 @@ class TriggerCondition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param threshold_operator: Required. Evaluation operation for rule - 'GreaterThan' or - 'LessThan. Possible values include: "GreaterThan", "LessThan", "Equal". - :type threshold_operator: str or ~$(python-base- - namespace).v2018_04_16.models.ConditionalOperator + 'LessThan. Possible values include: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", + "LessThan", "Equal". Default value: "GreaterThanOrEqual". + :type threshold_operator: str or + ~$(python-base-namespace).v2018_04_16.models.ConditionalOperator :param threshold: Required. Result or count threshold based on which rule should be triggered. :type threshold: float :param metric_trigger: Trigger condition for metric query rule. @@ -535,6 +605,6 @@ def __init__( **kwargs ): super(TriggerCondition, self).__init__(**kwargs) - self.threshold_operator = kwargs['threshold_operator'] + self.threshold_operator = kwargs.get('threshold_operator', "GreaterThanOrEqual") self.threshold = kwargs['threshold'] self.metric_trigger = kwargs.get('metric_trigger', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py index 97978ed148539..97d28d3679a99 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_models_py3.py @@ -200,6 +200,27 @@ def __init__( self.values = values +class ErrorContract(msrest.serialization.Model): + """Describes the format of Error response. + + :param error: The error details. + :type error: ~$(python-base-namespace).v2018_04_16.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(ErrorContract, self).__init__(**kwargs) + self.error = error + + class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. @@ -230,15 +251,16 @@ class LogMetricTrigger(msrest.serialization.Model): """A log metrics trigger descriptor. :param threshold_operator: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or - 'Equal'. Possible values include: "GreaterThan", "LessThan", "Equal". - :type threshold_operator: str or ~$(python-base- - namespace).v2018_04_16.models.ConditionalOperator + 'Equal'. Possible values include: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", + "LessThan", "Equal". Default value: "GreaterThanOrEqual". + :type threshold_operator: str or + ~$(python-base-namespace).v2018_04_16.models.ConditionalOperator :param threshold: The threshold of the metric trigger. :type threshold: float :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or 'Total'. Possible values - include: "Consecutive", "Total". - :type metric_trigger_type: str or ~$(python-base- - namespace).v2018_04_16.models.MetricTriggerType + include: "Consecutive", "Total". Default value: "Consecutive". + :type metric_trigger_type: str or + ~$(python-base-namespace).v2018_04_16.models.MetricTriggerType :param metric_column: Evaluation of metric on a particular column. :type metric_column: str """ @@ -253,9 +275,9 @@ class LogMetricTrigger(msrest.serialization.Model): def __init__( self, *, - threshold_operator: Optional[Union[str, "ConditionalOperator"]] = None, + threshold_operator: Optional[Union[str, "ConditionalOperator"]] = "GreaterThanOrEqual", threshold: Optional[float] = None, - metric_trigger_type: Optional[Union[str, "MetricTriggerType"]] = None, + metric_trigger_type: Optional[Union[str, "MetricTriggerType"]] = "Consecutive", metric_column: Optional[str] = None, **kwargs ): @@ -283,6 +305,16 @@ class Resource(msrest.serialization.Model): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :vartype kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str """ _validation = { @@ -290,6 +322,8 @@ class Resource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'kind': {'readonly': True}, + 'etag': {'readonly': True}, } _attribute_map = { @@ -298,6 +332,8 @@ class Resource(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, } def __init__( @@ -313,6 +349,8 @@ def __init__( self.type = None self.location = location self.tags = tags + self.kind = None + self.etag = None class LogSearchRuleResource(Resource): @@ -332,8 +370,27 @@ class LogSearchRuleResource(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :vartype kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the Log Search rule. :type description: str + :param display_name: The display name of the alert rule. + :type display_name: str + :param auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is false. + :type auto_mitigate: bool :param enabled: The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: "true", "false". :type enabled: str or ~$(python-base-namespace).v2018_04_16.models.Enabled @@ -341,8 +398,8 @@ class LogSearchRuleResource(Resource): :vartype last_updated_time: ~datetime.datetime :ivar provisioning_state: Provisioning state of the scheduled query rule. Possible values include: "Succeeded", "Deploying", "Canceled", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2018_04_16.models.ProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2018_04_16.models.ProvisioningState :param source: Required. Data Source against which rule will Query Data. :type source: ~$(python-base-namespace).v2018_04_16.models.Source :param schedule: Schedule (Frequency, Time Window) for rule. Required for action type - @@ -357,6 +414,10 @@ class LogSearchRuleResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'kind': {'readonly': True}, + 'etag': {'readonly': True}, + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, 'last_updated_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'source': {'required': True}, @@ -369,7 +430,13 @@ class LogSearchRuleResource(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'enabled': {'key': 'properties.enabled', 'type': 'str'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -386,12 +453,18 @@ def __init__( action: "Action", tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, + display_name: Optional[str] = None, + auto_mitigate: Optional[bool] = False, enabled: Optional[Union[str, "Enabled"]] = None, schedule: Optional["Schedule"] = None, **kwargs ): super(LogSearchRuleResource, self).__init__(location=location, tags=tags, **kwargs) + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = description + self.display_name = display_name + self.auto_mitigate = auto_mitigate self.enabled = enabled self.last_updated_time = None self.provisioning_state = None @@ -564,9 +637,10 @@ class TriggerCondition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param threshold_operator: Required. Evaluation operation for rule - 'GreaterThan' or - 'LessThan. Possible values include: "GreaterThan", "LessThan", "Equal". - :type threshold_operator: str or ~$(python-base- - namespace).v2018_04_16.models.ConditionalOperator + 'LessThan. Possible values include: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", + "LessThan", "Equal". Default value: "GreaterThanOrEqual". + :type threshold_operator: str or + ~$(python-base-namespace).v2018_04_16.models.ConditionalOperator :param threshold: Required. Result or count threshold based on which rule should be triggered. :type threshold: float :param metric_trigger: Trigger condition for metric query rule. @@ -587,7 +661,7 @@ class TriggerCondition(msrest.serialization.Model): def __init__( self, *, - threshold_operator: Union[str, "ConditionalOperator"], + threshold_operator: Union[str, "ConditionalOperator"] = "GreaterThanOrEqual", threshold: float, metric_trigger: Optional["LogMetricTrigger"] = None, **kwargs diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_management_client_enums.py index 67e81c2a01444..ce9b4a5dd1d83 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_management_client_enums.py @@ -41,6 +41,8 @@ class ConditionalOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 'Equal'. """ + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" GREATER_THAN = "GreaterThan" LESS_THAN = "LessThan" EQUAL = "Equal" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py index 63d29f5e963f9..3df057ea56657 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/operations/_scheduled_query_rules_operations.py @@ -78,7 +78,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -115,7 +115,7 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def get( self, @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -175,7 +175,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def update( self, @@ -210,7 +210,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -234,7 +234,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -243,7 +243,7 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def delete( self, @@ -276,7 +276,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -294,13 +294,13 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}'} # type: ignore def list_by_subscription( self, @@ -335,7 +335,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -365,7 +365,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -374,7 +374,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore def list_by_resource_group( self, @@ -413,7 +413,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -443,7 +443,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -452,4 +452,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py index 3dfeecfa782b7..f6b03c03aaa59 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json index 61819c227554e..cfd4d8a7a17be 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,42 +23,82 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "guest_diagnostics_settings_association": "GuestDiagnosticsSettingsAssociationOperations", "guest_diagnostics_settings": "GuestDiagnosticsSettingsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py index dd2026fed6b0d..9eec57542a682 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import GuestDiagnosticsSettingsAssociationOperations @@ -32,7 +33,7 @@ class MonitorManagementClient(object): :vartype guest_diagnostics_settings: $(python-base-namespace).v2018_06_01_preview.operations.GuestDiagnosticsSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -60,6 +61,24 @@ def __init__( self.guest_diagnostics_settings = GuestDiagnosticsSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py index 0a08001c004ef..3219bb1c9dc8f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py index fe83fe02be0cd..06402e692be06 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -30,7 +31,7 @@ class MonitorManagementClient(object): :vartype guest_diagnostics_settings: $(python-base-namespace).v2018_06_01_preview.aio.operations.GuestDiagnosticsSettingsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -57,6 +58,23 @@ def __init__( self.guest_diagnostics_settings = GuestDiagnosticsSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py index 176032de5bc6f..897035d273d32 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_association_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_uri: str, association_name: str, diagnostic_settings_association: "_models.GuestDiagnosticSettingsAssociationResource", - **kwargs + **kwargs: Any ) -> "_models.GuestDiagnosticSettingsAssociationResource": """Creates or updates guest diagnostics settings association. @@ -98,7 +98,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -117,7 +117,7 @@ async def get( self, resource_uri: str, association_name: str, - **kwargs + **kwargs: Any ) -> "_models.GuestDiagnosticSettingsAssociationResource": """Gets guest diagnostics association settings. @@ -161,7 +161,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -176,7 +176,7 @@ async def delete( self, resource_uri: str, association_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete guest diagnostics association settings. @@ -220,7 +220,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -233,7 +233,7 @@ async def update( resource_uri: str, association_name: str, parameters: "_models.GuestDiagnosticSettingsAssociationResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.GuestDiagnosticSettingsAssociationResource": """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use the CreateOrUpdate method. @@ -285,7 +285,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -298,7 +298,7 @@ async def update( def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.GuestDiagnosticSettingsAssociationList"]: """Get a list of all guest diagnostic settings association in a subscription. @@ -324,7 +324,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -352,7 +352,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -366,7 +366,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.GuestDiagnosticSettingsAssociationList"]: """Get a list of all guest diagnostic settings association in a resource group. @@ -395,7 +395,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -423,7 +423,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py index a9b8d306d9e59..3e4d561f62566 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/operations/_guest_diagnostics_settings_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, diagnostic_settings_name: str, diagnostic_settings: "_models.GuestDiagnosticSettingsResource", - **kwargs + **kwargs: Any ) -> "_models.GuestDiagnosticSettingsResource": """Creates or updates guest diagnostics settings. @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, diagnostic_settings_name: str, - **kwargs + **kwargs: Any ) -> "_models.GuestDiagnosticSettingsResource": """Gets guest diagnostics settings. @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -176,7 +176,7 @@ async def update( resource_group_name: str, diagnostic_settings_name: str, parameters: "_models.GuestDiagnosticSettingsPatchResource", - **kwargs + **kwargs: Any ) -> "_models.GuestDiagnosticSettingsResource": """Updates guest diagnostics settings. @@ -205,7 +205,7 @@ async def update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -227,7 +227,7 @@ async def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -246,7 +246,7 @@ async def delete( self, resource_group_name: str, diagnostic_settings_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete guest diagnostics settings. @@ -272,7 +272,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -290,7 +290,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -300,7 +300,7 @@ async def delete( def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.GuestDiagnosticSettingsList"]: """Get a list of all guest diagnostic settings in a subscription. @@ -326,7 +326,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -354,7 +354,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -368,7 +368,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.GuestDiagnosticSettingsList"]: """Get a list of all guest diagnostic settings in a resource group. @@ -397,7 +397,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -425,7 +425,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py index 09b3fa00ced5a..06ae1bbd2382c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models.py @@ -19,8 +19,8 @@ class DataSource(msrest.serialization.Model): "ETWProviders", "WindowsEventLogs". :type kind: str or ~$(python-base-namespace).v2018_06_01_preview.models.DataSourceKind :param configuration: Required. - :type configuration: ~$(python-base- - namespace).v2018_06_01_preview.models.DataSourceConfiguration + :type configuration: + ~$(python-base-namespace).v2018_06_01_preview.models.DataSourceConfiguration :param sinks: Required. :type sinks: list[~$(python-base-namespace).v2018_06_01_preview.models.SinkConfiguration] """ @@ -51,14 +51,14 @@ class DataSourceConfiguration(msrest.serialization.Model): """DataSourceConfiguration. :param providers: ETW providers configuration. - :type providers: list[~$(python-base- - namespace).v2018_06_01_preview.models.EtwProviderConfiguration] + :type providers: + list[~$(python-base-namespace).v2018_06_01_preview.models.EtwProviderConfiguration] :param perf_counters: Performance counter configuration. - :type perf_counters: list[~$(python-base- - namespace).v2018_06_01_preview.models.PerformanceCounterConfiguration] + :type perf_counters: + list[~$(python-base-namespace).v2018_06_01_preview.models.PerformanceCounterConfiguration] :param event_logs: Windows event logs configuration. - :type event_logs: list[~$(python-base- - namespace).v2018_06_01_preview.models.EventLogConfiguration] + :type event_logs: + list[~$(python-base-namespace).v2018_06_01_preview.models.EventLogConfiguration] """ _attribute_map = { @@ -197,8 +197,8 @@ class GuestDiagnosticSettingsAssociationList(msrest.serialization.Model): """A list of guest diagnostic settings association. :param value: The list of guest diagnostic settings association. - :type value: list[~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource] + :type value: + list[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource] :param next_link: Provides the link to retrieve the next set of elements. :type next_link: str """ @@ -336,8 +336,8 @@ class GuestDiagnosticSettingsList(msrest.serialization.Model): """A list of guest diagnostic settings. :param value: The list of guest diagnostic settings. - :type value: list[~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource] :param next_link: Provides the link to retrieve the next set of elements. :type next_link: str """ @@ -363,8 +363,8 @@ class GuestDiagnosticSettingsPatchResource(msrest.serialization.Model): :type tags: dict[str, str] :param os_type: Operating system type for the configuration. Possible values include: "Windows", "Linux". - :type os_type: str or ~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType + :type os_type: str or + ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType :param data_sources: the array of data source object which are configured to collect and send data. :type data_sources: list[~$(python-base-namespace).v2018_06_01_preview.models.DataSource] @@ -409,8 +409,8 @@ class GuestDiagnosticSettingsResource(Resource): :type tags: dict[str, str] :param os_type: Operating system type for the configuration. Possible values include: "Windows", "Linux". - :type os_type: str or ~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType + :type os_type: str or + ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType :param data_sources: the array of data source object which are configured to collect and send data. :type data_sources: list[~$(python-base-namespace).v2018_06_01_preview.models.DataSource] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py index 15c655c3ba32f..9f72f55fcb223 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_models_py3.py @@ -23,8 +23,8 @@ class DataSource(msrest.serialization.Model): "ETWProviders", "WindowsEventLogs". :type kind: str or ~$(python-base-namespace).v2018_06_01_preview.models.DataSourceKind :param configuration: Required. - :type configuration: ~$(python-base- - namespace).v2018_06_01_preview.models.DataSourceConfiguration + :type configuration: + ~$(python-base-namespace).v2018_06_01_preview.models.DataSourceConfiguration :param sinks: Required. :type sinks: list[~$(python-base-namespace).v2018_06_01_preview.models.SinkConfiguration] """ @@ -59,14 +59,14 @@ class DataSourceConfiguration(msrest.serialization.Model): """DataSourceConfiguration. :param providers: ETW providers configuration. - :type providers: list[~$(python-base- - namespace).v2018_06_01_preview.models.EtwProviderConfiguration] + :type providers: + list[~$(python-base-namespace).v2018_06_01_preview.models.EtwProviderConfiguration] :param perf_counters: Performance counter configuration. - :type perf_counters: list[~$(python-base- - namespace).v2018_06_01_preview.models.PerformanceCounterConfiguration] + :type perf_counters: + list[~$(python-base-namespace).v2018_06_01_preview.models.PerformanceCounterConfiguration] :param event_logs: Windows event logs configuration. - :type event_logs: list[~$(python-base- - namespace).v2018_06_01_preview.models.EventLogConfiguration] + :type event_logs: + list[~$(python-base-namespace).v2018_06_01_preview.models.EventLogConfiguration] """ _attribute_map = { @@ -222,8 +222,8 @@ class GuestDiagnosticSettingsAssociationList(msrest.serialization.Model): """A list of guest diagnostic settings association. :param value: The list of guest diagnostic settings association. - :type value: list[~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource] + :type value: + list[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsAssociationResource] :param next_link: Provides the link to retrieve the next set of elements. :type next_link: str """ @@ -374,8 +374,8 @@ class GuestDiagnosticSettingsList(msrest.serialization.Model): """A list of guest diagnostic settings. :param value: The list of guest diagnostic settings. - :type value: list[~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsResource] :param next_link: Provides the link to retrieve the next set of elements. :type next_link: str """ @@ -404,8 +404,8 @@ class GuestDiagnosticSettingsPatchResource(msrest.serialization.Model): :type tags: dict[str, str] :param os_type: Operating system type for the configuration. Possible values include: "Windows", "Linux". - :type os_type: str or ~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType + :type os_type: str or + ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType :param data_sources: the array of data source object which are configured to collect and send data. :type data_sources: list[~$(python-base-namespace).v2018_06_01_preview.models.DataSource] @@ -455,8 +455,8 @@ class GuestDiagnosticSettingsResource(Resource): :type tags: dict[str, str] :param os_type: Operating system type for the configuration. Possible values include: "Windows", "Linux". - :type os_type: str or ~$(python-base- - namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType + :type os_type: str or + ~$(python-base-namespace).v2018_06_01_preview.models.GuestDiagnosticSettingsOsType :param data_sources: the array of data source object which are configured to collect and send data. :type data_sources: list[~$(python-base-namespace).v2018_06_01_preview.models.DataSource] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py index 2c977cb690f05..21e8b221b17a8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_association_operations.py @@ -103,7 +103,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -167,7 +167,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -227,7 +227,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -293,7 +293,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsAssociationResource', pipeline_response) @@ -333,7 +333,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -361,7 +361,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -405,7 +405,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -433,7 +433,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py index 1e45f3485e868..c7b5ae16539e8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/operations/_guest_diagnostics_settings_operations.py @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GuestDiagnosticSettingsResource', pipeline_response) @@ -212,7 +212,7 @@ def update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -234,7 +234,7 @@ def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -280,7 +280,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'diagnosticSettingsName': self._serialize.url("diagnostic_settings_name", diagnostic_settings_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -298,7 +298,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -335,7 +335,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -363,7 +363,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -407,7 +407,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -435,7 +435,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py index ed38a6efebf48..08864a6775762 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json index 16f8f621713d7..11badcc855fc4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,43 +23,83 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "action_groups": "ActionGroupsOperations", "metric_baseline": "MetricBaselineOperations", "baseline": "BaselineOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py index cd65097c83547..cdaddbe303282 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ActionGroupsOperations @@ -35,7 +36,7 @@ class MonitorManagementClient(object): :vartype baseline: $(python-base-namespace).v2018_09_01.operations.BaselineOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -65,6 +66,24 @@ def __init__( self.baseline = BaselineOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py index 003ad367aa619..c2ff4d18ad786 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py index b4c6c5e5f83a2..52c95081d8ecc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -33,7 +34,7 @@ class MonitorManagementClient(object): :vartype baseline: $(python-base-namespace).v2018_09_01.aio.operations.BaselineOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -62,6 +63,23 @@ def __init__( self.baseline = BaselineOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py index 784c2646f6e52..fbf6c3294322c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_action_groups_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, action_group_name: str, action_group: "_models.ActionGroupResource", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Get an action group. @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -175,7 +175,7 @@ async def delete( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an action group. @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ async def update( resource_group_name: str, action_group_name: str, action_group_patch: "_models.ActionGroupPatchBody", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -296,7 +296,7 @@ async def update( def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -364,7 +364,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -437,7 +437,7 @@ async def enable_receiver( resource_group_name: str, action_group_name: str, enable_request: "_models.EnableRequest", - **kwargs + **kwargs: Any ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py index 2e13edf2f29d0..c8c76e693c6ae 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baseline_operations.py @@ -52,7 +52,7 @@ async def get( result_type: Optional[Union[str, "_models.ResultType"]] = None, metricnamespace: Optional[str] = None, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.BaselineResponse": """**Gets the baseline values for a resource**. @@ -61,7 +61,9 @@ async def get( For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param timespan: The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. @@ -130,7 +132,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -139,4 +141,4 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py index cf63e10acad95..0bc346ea0e7e6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_metric_baseline_operations.py @@ -52,7 +52,7 @@ async def get( result_type: Optional[Union[str, "_models.ResultType"]] = None, metricnamespace: Optional[str] = None, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.BaselineResponse": """**Gets the baseline values for a specific metric**. @@ -129,7 +129,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -138,13 +138,13 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore async def calculate_baseline( self, resource_uri: str, time_series_information: "_models.TimeSeriesInformation", - **kwargs + **kwargs: Any ) -> "_models.CalculateBaselineResponse": """**Lists the baseline values for a resource**. @@ -195,7 +195,7 @@ async def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) @@ -204,4 +204,4 @@ async def calculate_baseline( return cls(pipeline_response, deserialized, {}) return deserialized - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} # type: ignore + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py index fcd33d0536b55..b7bdabe81db6c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/__init__.py @@ -18,6 +18,7 @@ from ._models_py3 import BaselineMetadataValue from ._models_py3 import BaselineResponse from ._models_py3 import CalculateBaselineResponse + from ._models_py3 import CalculateBaselineResponseStatistics from ._models_py3 import EmailReceiver from ._models_py3 import EnableRequest from ._models_py3 import ErrorResponse @@ -41,6 +42,7 @@ from ._models import BaselineMetadataValue # type: ignore from ._models import BaselineResponse # type: ignore from ._models import CalculateBaselineResponse # type: ignore + from ._models import CalculateBaselineResponseStatistics # type: ignore from ._models import EmailReceiver # type: ignore from ._models import EnableRequest # type: ignore from ._models import ErrorResponse # type: ignore @@ -54,6 +56,8 @@ from ._models import WebhookReceiver # type: ignore from ._monitor_management_client_enums import ( + ErrorType, + PredictionResultType, ReceiverStatus, ResultType, Sensitivity, @@ -71,6 +75,7 @@ 'BaselineMetadataValue', 'BaselineResponse', 'CalculateBaselineResponse', + 'CalculateBaselineResponseStatistics', 'EmailReceiver', 'EnableRequest', 'ErrorResponse', @@ -82,6 +87,8 @@ 'TimeSeriesInformation', 'VoiceReceiver', 'WebhookReceiver', + 'ErrorType', + 'PredictionResultType', 'ReceiverStatus', 'ResultType', 'Sensitivity', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py index 8ffeb77fca187..5e39f2d75afc1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models.py @@ -135,20 +135,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2018_09_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2018_09_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2018_09_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2018_09_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2018_09_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2018_09_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2018_09_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2018_09_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2018_09_01.models.AzureFunctionReceiver] :param arm_role_receivers: The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. :type arm_role_receivers: list[~$(python-base-namespace).v2018_09_01.models.ArmRoleReceiver] @@ -365,6 +365,15 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] + :param prediction_result_type: The prediction result type of the baseline. Possible values + include: "0", "1", "2". + :type prediction_result_type: str or + ~$(python-base-namespace).v2018_09_01.models.PredictionResultType + :param error_type: The error type of the baseline. Possible values include: "0", "1", "2", "3", + "4", "100", "200". + :type error_type: str or ~$(python-base-namespace).v2018_09_01.models.ErrorType """ _validation = { @@ -377,6 +386,9 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'prediction_result_type': {'key': 'PredictionResultType', 'type': 'str'}, + 'error_type': {'key': 'ErrorType', 'type': 'str'}, } def __init__( @@ -387,6 +399,9 @@ def __init__( self.sensitivity = kwargs['sensitivity'] self.low_thresholds = kwargs['low_thresholds'] self.high_thresholds = kwargs['high_thresholds'] + self.timestamps = kwargs.get('timestamps', None) + self.prediction_result_type = kwargs.get('prediction_result_type', None) + self.error_type = kwargs.get('error_type', None) class BaselineMetadataValue(msrest.serialization.Model): @@ -423,6 +438,19 @@ class BaselineResponse(msrest.serialization.Model): :vartype type: str :ivar name: The name and the display name of the metric, i.e. it is localizable string. :vartype name: ~$(python-base-namespace).v2018_09_01.models.LocalizableString + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] + :param baseline: The baseline values for each sensitivity. + :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] + :param metdata: The baseline metadata values. + :type metdata: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadataValue] + :param prediction_result_type: The prediction result type of the baseline. Possible values + include: "0", "1", "2". + :type prediction_result_type: str or + ~$(python-base-namespace).v2018_09_01.models.PredictionResultType + :param error_type: The error type of the baseline. Possible values include: "0", "1", "2", "3", + "4", "100", "200". + :type error_type: str or ~$(python-base-namespace).v2018_09_01.models.ErrorType :param timespan: The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. @@ -433,30 +461,30 @@ class BaselineResponse(msrest.serialization.Model): :type interval: ~datetime.timedelta :param aggregation: The aggregation type of the metric. :type aggregation: str - :param timestamps: The array of timestamps of the baselines. - :type timestamps: list[~datetime.datetime] - :param baseline: The baseline values for each sensitivity. - :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] - :param metadata: The baseline metadata values. - :type metadata: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadataValue] + :ivar internal_operation_id: internal operation id. + :vartype internal_operation_id: str """ _validation = { 'id': {'readonly': True}, 'type': {'readonly': True}, 'name': {'readonly': True}, + 'internal_operation_id': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + 'metdata': {'key': 'metdata', 'type': '[BaselineMetadataValue]'}, + 'prediction_result_type': {'key': 'predictionResultType', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, 'timespan': {'key': 'properties.timespan', 'type': 'str'}, 'interval': {'key': 'properties.interval', 'type': 'duration'}, 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, - 'timestamps': {'key': 'properties.timestamps', 'type': '[iso-8601]'}, - 'baseline': {'key': 'properties.baseline', 'type': '[Baseline]'}, - 'metadata': {'key': 'properties.metadata', 'type': '[BaselineMetadataValue]'}, + 'internal_operation_id': {'key': 'properties.internalOperationId', 'type': 'str'}, } def __init__( @@ -467,17 +495,22 @@ def __init__( self.id = None self.type = None self.name = None + self.timestamps = kwargs.get('timestamps', None) + self.baseline = kwargs.get('baseline', None) + self.metdata = kwargs.get('metdata', None) + self.prediction_result_type = kwargs.get('prediction_result_type', None) + self.error_type = kwargs.get('error_type', None) self.timespan = kwargs.get('timespan', None) self.interval = kwargs.get('interval', None) self.aggregation = kwargs.get('aggregation', None) - self.timestamps = kwargs.get('timestamps', None) - self.baseline = kwargs.get('baseline', None) - self.metadata = kwargs.get('metadata', None) + self.internal_operation_id = None class CalculateBaselineResponse(msrest.serialization.Model): """The response to a calculate baseline call. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :param type: Required. The resource type of the baseline resource. @@ -486,17 +519,29 @@ class CalculateBaselineResponse(msrest.serialization.Model): :type timestamps: list[~datetime.datetime] :param baseline: Required. The baseline values for each sensitivity. :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] + :param statistics: The statistics. + :type statistics: + ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponseStatistics + :ivar internal_operation_id: internal operation id. + :vartype internal_operation_id: str + :param error_type: The error type for calculating the baseline. Possible values include: "0", + "1", "2", "3", "4", "100", "200". + :type error_type: str or ~$(python-base-namespace).v2018_09_01.models.ErrorType """ _validation = { 'type': {'required': True}, 'baseline': {'required': True}, + 'internal_operation_id': {'readonly': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + 'statistics': {'key': 'statistics', 'type': 'CalculateBaselineResponseStatistics'}, + 'internal_operation_id': {'key': 'internalOperationId', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, } def __init__( @@ -507,6 +552,36 @@ def __init__( self.type = kwargs['type'] self.timestamps = kwargs.get('timestamps', None) self.baseline = kwargs['baseline'] + self.statistics = kwargs.get('statistics', None) + self.internal_operation_id = None + self.error_type = kwargs.get('error_type', None) + + +class CalculateBaselineResponseStatistics(msrest.serialization.Model): + """The statistics. + + :param is_eligible: is series eligible for dynamic threshold analysis. + :type is_eligible: bool + :param status: The list of extended status for calculating the baseline. + :type status: list[str] + :param seasonality_period: The seasonality period for calculating the baseline. + :type seasonality_period: int + """ + + _attribute_map = { + 'is_eligible': {'key': 'isEligible', 'type': 'bool'}, + 'status': {'key': 'status', 'type': '[str]'}, + 'seasonality_period': {'key': 'seasonalityPeriod', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CalculateBaselineResponseStatistics, self).__init__(**kwargs) + self.is_eligible = kwargs.get('is_eligible', None) + self.status = kwargs.get('status', None) + self.seasonality_period = kwargs.get('seasonality_period', None) class EmailReceiver(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py index fcd6b542c2ca8..6bb97b5a84c68 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_models_py3.py @@ -149,20 +149,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2018_09_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2018_09_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2018_09_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2018_09_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2018_09_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2018_09_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2018_09_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2018_09_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2018_09_01.models.AzureFunctionReceiver] :param arm_role_receivers: The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. :type arm_role_receivers: list[~$(python-base-namespace).v2018_09_01.models.ArmRoleReceiver] @@ -412,6 +412,15 @@ class Baseline(msrest.serialization.Model): :type low_thresholds: list[float] :param high_thresholds: Required. The high thresholds of the baseline. :type high_thresholds: list[float] + :param timestamps: the array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] + :param prediction_result_type: The prediction result type of the baseline. Possible values + include: "0", "1", "2". + :type prediction_result_type: str or + ~$(python-base-namespace).v2018_09_01.models.PredictionResultType + :param error_type: The error type of the baseline. Possible values include: "0", "1", "2", "3", + "4", "100", "200". + :type error_type: str or ~$(python-base-namespace).v2018_09_01.models.ErrorType """ _validation = { @@ -424,6 +433,9 @@ class Baseline(msrest.serialization.Model): 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'prediction_result_type': {'key': 'PredictionResultType', 'type': 'str'}, + 'error_type': {'key': 'ErrorType', 'type': 'str'}, } def __init__( @@ -432,12 +444,18 @@ def __init__( sensitivity: Union[str, "Sensitivity"], low_thresholds: List[float], high_thresholds: List[float], + timestamps: Optional[List[datetime.datetime]] = None, + prediction_result_type: Optional[Union[str, "PredictionResultType"]] = None, + error_type: Optional[Union[str, "ErrorType"]] = None, **kwargs ): super(Baseline, self).__init__(**kwargs) self.sensitivity = sensitivity self.low_thresholds = low_thresholds self.high_thresholds = high_thresholds + self.timestamps = timestamps + self.prediction_result_type = prediction_result_type + self.error_type = error_type class BaselineMetadataValue(msrest.serialization.Model): @@ -477,6 +495,19 @@ class BaselineResponse(msrest.serialization.Model): :vartype type: str :ivar name: The name and the display name of the metric, i.e. it is localizable string. :vartype name: ~$(python-base-namespace).v2018_09_01.models.LocalizableString + :param timestamps: The array of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] + :param baseline: The baseline values for each sensitivity. + :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] + :param metdata: The baseline metadata values. + :type metdata: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadataValue] + :param prediction_result_type: The prediction result type of the baseline. Possible values + include: "0", "1", "2". + :type prediction_result_type: str or + ~$(python-base-namespace).v2018_09_01.models.PredictionResultType + :param error_type: The error type of the baseline. Possible values include: "0", "1", "2", "3", + "4", "100", "200". + :type error_type: str or ~$(python-base-namespace).v2018_09_01.models.ErrorType :param timespan: The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. @@ -487,58 +518,65 @@ class BaselineResponse(msrest.serialization.Model): :type interval: ~datetime.timedelta :param aggregation: The aggregation type of the metric. :type aggregation: str - :param timestamps: The array of timestamps of the baselines. - :type timestamps: list[~datetime.datetime] - :param baseline: The baseline values for each sensitivity. - :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] - :param metadata: The baseline metadata values. - :type metadata: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadataValue] + :ivar internal_operation_id: internal operation id. + :vartype internal_operation_id: str """ _validation = { 'id': {'readonly': True}, 'type': {'readonly': True}, 'name': {'readonly': True}, + 'internal_operation_id': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + 'metdata': {'key': 'metdata', 'type': '[BaselineMetadataValue]'}, + 'prediction_result_type': {'key': 'predictionResultType', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, 'timespan': {'key': 'properties.timespan', 'type': 'str'}, 'interval': {'key': 'properties.interval', 'type': 'duration'}, 'aggregation': {'key': 'properties.aggregation', 'type': 'str'}, - 'timestamps': {'key': 'properties.timestamps', 'type': '[iso-8601]'}, - 'baseline': {'key': 'properties.baseline', 'type': '[Baseline]'}, - 'metadata': {'key': 'properties.metadata', 'type': '[BaselineMetadataValue]'}, + 'internal_operation_id': {'key': 'properties.internalOperationId', 'type': 'str'}, } def __init__( self, *, + timestamps: Optional[List[datetime.datetime]] = None, + baseline: Optional[List["Baseline"]] = None, + metdata: Optional[List["BaselineMetadataValue"]] = None, + prediction_result_type: Optional[Union[str, "PredictionResultType"]] = None, + error_type: Optional[Union[str, "ErrorType"]] = None, timespan: Optional[str] = None, interval: Optional[datetime.timedelta] = None, aggregation: Optional[str] = None, - timestamps: Optional[List[datetime.datetime]] = None, - baseline: Optional[List["Baseline"]] = None, - metadata: Optional[List["BaselineMetadataValue"]] = None, **kwargs ): super(BaselineResponse, self).__init__(**kwargs) self.id = None self.type = None self.name = None + self.timestamps = timestamps + self.baseline = baseline + self.metdata = metdata + self.prediction_result_type = prediction_result_type + self.error_type = error_type self.timespan = timespan self.interval = interval self.aggregation = aggregation - self.timestamps = timestamps - self.baseline = baseline - self.metadata = metadata + self.internal_operation_id = None class CalculateBaselineResponse(msrest.serialization.Model): """The response to a calculate baseline call. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :param type: Required. The resource type of the baseline resource. @@ -547,17 +585,29 @@ class CalculateBaselineResponse(msrest.serialization.Model): :type timestamps: list[~datetime.datetime] :param baseline: Required. The baseline values for each sensitivity. :type baseline: list[~$(python-base-namespace).v2018_09_01.models.Baseline] + :param statistics: The statistics. + :type statistics: + ~$(python-base-namespace).v2018_09_01.models.CalculateBaselineResponseStatistics + :ivar internal_operation_id: internal operation id. + :vartype internal_operation_id: str + :param error_type: The error type for calculating the baseline. Possible values include: "0", + "1", "2", "3", "4", "100", "200". + :type error_type: str or ~$(python-base-namespace).v2018_09_01.models.ErrorType """ _validation = { 'type': {'required': True}, 'baseline': {'required': True}, + 'internal_operation_id': {'readonly': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, 'baseline': {'key': 'baseline', 'type': '[Baseline]'}, + 'statistics': {'key': 'statistics', 'type': 'CalculateBaselineResponseStatistics'}, + 'internal_operation_id': {'key': 'internalOperationId', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, } def __init__( @@ -566,12 +616,48 @@ def __init__( type: str, baseline: List["Baseline"], timestamps: Optional[List[datetime.datetime]] = None, + statistics: Optional["CalculateBaselineResponseStatistics"] = None, + error_type: Optional[Union[str, "ErrorType"]] = None, **kwargs ): super(CalculateBaselineResponse, self).__init__(**kwargs) self.type = type self.timestamps = timestamps self.baseline = baseline + self.statistics = statistics + self.internal_operation_id = None + self.error_type = error_type + + +class CalculateBaselineResponseStatistics(msrest.serialization.Model): + """The statistics. + + :param is_eligible: is series eligible for dynamic threshold analysis. + :type is_eligible: bool + :param status: The list of extended status for calculating the baseline. + :type status: list[str] + :param seasonality_period: The seasonality period for calculating the baseline. + :type seasonality_period: int + """ + + _attribute_map = { + 'is_eligible': {'key': 'isEligible', 'type': 'bool'}, + 'status': {'key': 'status', 'type': '[str]'}, + 'seasonality_period': {'key': 'seasonalityPeriod', 'type': 'int'}, + } + + def __init__( + self, + *, + is_eligible: Optional[bool] = None, + status: Optional[List[str]] = None, + seasonality_period: Optional[int] = None, + **kwargs + ): + super(CalculateBaselineResponseStatistics, self).__init__(**kwargs) + self.is_eligible = is_eligible + self.status = status + self.seasonality_period = seasonality_period class EmailReceiver(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py index 26ccadca63031..2968ce09e7c21 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py @@ -26,6 +26,26 @@ def __getattr__(cls, name): raise AttributeError(name) +class ErrorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The error type of the baseline. + """ + + ZERO = "0" + ONE = "1" + TWO = "2" + THREE = "3" + FOUR = "4" + ONE_HUNDRED = "100" + TWO_HUNDRED = "200" + +class PredictionResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The prediction result type of the baseline. + """ + + ZERO = "0" + ONE = "1" + TWO = "2" + class ReceiverStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py index 46614344a75b1..cbaa9affec088 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_action_groups_operations.py @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py index 2afba907f9419..15dd5f3f22de6 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baseline_operations.py @@ -66,7 +66,9 @@ def get( For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1. :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param timespan: The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. @@ -135,7 +137,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -144,4 +146,4 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py index e312106466af7..a5b894a44c006 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_metric_baseline_operations.py @@ -134,7 +134,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BaselineResponse', pipeline_response) @@ -143,7 +143,7 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/baseline/{metricName}'} # type: ignore + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}'} # type: ignore def calculate_baseline( self, @@ -201,7 +201,7 @@ def calculate_baseline( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CalculateBaselineResponse', pipeline_response) @@ -210,4 +210,4 @@ def calculate_baseline( return cls(pipeline_response, deserialized, {}) return deserialized - calculate_baseline.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/calculatebaseline'} # type: ignore + calculate_baseline.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/calculatebaseline'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py index 0982355d24b66..3b7dbb10194cd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json index ae013cb651cfc..108ef76686e18 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -22,7 +24,7 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -30,20 +32,60 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vm_insights": "VMInsightsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py index 6005223afa1bd..4c8063f8d99dd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import VMInsightsOperations @@ -52,6 +53,21 @@ def __init__( self.vm_insights = VMInsightsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py index 47ad42a1a50cc..d8d2e140bf30b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py index 14ccf5f02108d..d517e654aef76 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -49,6 +50,20 @@ def __init__( self.vm_insights = VMInsightsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py index e79fd543f141b..fa9ce068a20a4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/operations/_vm_insights_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_onboarding_status( self, resource_uri: str, - **kwargs + **kwargs: Any ) -> "_models.VMInsightsOnboardingStatus": """Retrieves the VM Insights onboarding status for the specified resource or resource scope. @@ -84,7 +84,7 @@ async def get_onboarding_status( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResponseWithError, response) + error = self._deserialize.failsafe_deserialize(_models.ResponseWithError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VMInsightsOnboardingStatus', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py index 1e5a12042acdb..05352ea9024f8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models.py @@ -141,8 +141,8 @@ class VMInsightsOnboardingStatus(ProxyResource): :param onboarding_status: The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: "onboarded", "notOnboarded", "unknown". - :type onboarding_status: str or ~$(python-base- - namespace).v2018_11_27_preview.models.OnboardingStatus + :type onboarding_status: str or + ~$(python-base-namespace).v2018_11_27_preview.models.OnboardingStatus :param data_status: The status of VM Insights data from the resource. When reported as ``present`` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: "present", "notPresent". diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py index 85a106bf95eb8..d377f3d4a19cb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_models_py3.py @@ -152,8 +152,8 @@ class VMInsightsOnboardingStatus(ProxyResource): :param onboarding_status: The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: "onboarded", "notOnboarded", "unknown". - :type onboarding_status: str or ~$(python-base- - namespace).v2018_11_27_preview.models.OnboardingStatus + :type onboarding_status: str or + ~$(python-base-namespace).v2018_11_27_preview.models.OnboardingStatus :param data_status: The status of VM Insights data from the resource. When reported as ``present`` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: "present", "notPresent". diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py index b2b629ba9c057..323b2fefa1b0f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/operations/_vm_insights_operations.py @@ -89,7 +89,7 @@ def get_onboarding_status( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResponseWithError, response) + error = self._deserialize.failsafe_deserialize(_models.ResponseWithError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VMInsightsOnboardingStatus', pipeline_response) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py index 19db68b6105a9..bae7197d43612 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json index 0cda759be0784..1195426a660ac 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,42 +23,82 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "action_groups": "ActionGroupsOperations", "baselines": "BaselinesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py index 64272557194e3..e8cda37fc5dec 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ActionGroupsOperations @@ -32,7 +33,7 @@ class MonitorManagementClient(object): :vartype baselines: $(python-base-namespace).v2019_03_01.operations.BaselinesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -60,6 +61,24 @@ def __init__( self.baselines = BaselinesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py index 39a3184e2abaa..14d8957671d3c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py index 07f26ba351e4c..1c5b2606dd68b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -30,7 +31,7 @@ class MonitorManagementClient(object): :vartype baselines: $(python-base-namespace).v2019_03_01.aio.operations.BaselinesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -57,6 +58,23 @@ def __init__( self.baselines = BaselinesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py index 97335a1b91b4a..809dc6eb6dc61 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_action_groups_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, action_group_name: str, action_group: "_models.ActionGroupResource", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Get an action group. @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -175,7 +175,7 @@ async def delete( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an action group. @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ async def update( resource_group_name: str, action_group_name: str, action_group_patch: "_models.ActionGroupPatchBody", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -296,7 +296,7 @@ async def update( def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -364,7 +364,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -437,7 +437,7 @@ async def enable_receiver( resource_group_name: str, action_group_name: str, enable_request: "_models.EnableRequest", - **kwargs + **kwargs: Any ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py index a3b9afcfcf6d0..da5a7bec335fd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/operations/_baselines_operations.py @@ -53,13 +53,15 @@ def list( sensitivities: Optional[str] = None, filter: Optional[str] = None, result_type: Optional[Union[str, "_models.ResultType"]] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MetricBaselinesResponse"]: """**Lists the metric baseline values for a resource**. :param resource_uri: The identifier of the resource. :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param metricnamespace: Metric namespace to query metric definitions for. :type metricnamespace: str @@ -72,15 +74,18 @@ def list( :type aggregation: str :param sensitivities: The list of sensitivities (comma separated) to retrieve. :type sensitivities: str - :param filter: The **$filter** is used to reduce the set of metric data - returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`- - Return all time series of C where A = a1 and B = b1 or b2:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`
`- Invalid variant::code:`
`\ **$filter=A - eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`
`This is invalid because the - logical or operator cannot separate two different metadata names.:code:`
`- Return all time - series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq - ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘\ *’ and C eq ‘*\ ’**. + :param filter: The **$filter** is used to reduce the set of metric data returned. Example: + Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or + b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A + eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or + operator cannot separate two different metadata names. - Return all time series where A = a1, B + = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series + where A = a1 **$filter=A eq 'a1' and B eq '\ *' and C eq '*\ '**. Special case: When dimension + name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** + Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ + ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ + ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. :type filter: str :param result_type: Allows retrieving only metadata of the baseline. On data request all information is retrieved. @@ -151,7 +156,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -160,4 +165,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricBaselines'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricBaselines'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py index eda2bcda5d852..d2c6946d97e5d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/__init__.py @@ -14,6 +14,7 @@ from ._models_py3 import AutomationRunbookReceiver from ._models_py3 import AzureAppPushReceiver from ._models_py3 import AzureFunctionReceiver + from ._models_py3 import AzureResource from ._models_py3 import BaselineMetadata from ._models_py3 import EmailReceiver from ._models_py3 import EnableRequest @@ -22,7 +23,6 @@ from ._models_py3 import LogicAppReceiver from ._models_py3 import MetricBaselinesResponse from ._models_py3 import MetricSingleDimension - from ._models_py3 import Resource from ._models_py3 import SingleBaseline from ._models_py3 import SingleMetricBaseline from ._models_py3 import SmsReceiver @@ -37,6 +37,7 @@ from ._models import AutomationRunbookReceiver # type: ignore from ._models import AzureAppPushReceiver # type: ignore from ._models import AzureFunctionReceiver # type: ignore + from ._models import AzureResource # type: ignore from ._models import BaselineMetadata # type: ignore from ._models import EmailReceiver # type: ignore from ._models import EnableRequest # type: ignore @@ -45,7 +46,6 @@ from ._models import LogicAppReceiver # type: ignore from ._models import MetricBaselinesResponse # type: ignore from ._models import MetricSingleDimension # type: ignore - from ._models import Resource # type: ignore from ._models import SingleBaseline # type: ignore from ._models import SingleMetricBaseline # type: ignore from ._models import SmsReceiver # type: ignore @@ -67,6 +67,7 @@ 'AutomationRunbookReceiver', 'AzureAppPushReceiver', 'AzureFunctionReceiver', + 'AzureResource', 'BaselineMetadata', 'EmailReceiver', 'EnableRequest', @@ -75,7 +76,6 @@ 'LogicAppReceiver', 'MetricBaselinesResponse', 'MetricSingleDimension', - 'Resource', 'SingleBaseline', 'SingleMetricBaseline', 'SmsReceiver', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py index 5b874c6d560f8..2276db6bcae09 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models.py @@ -57,7 +57,7 @@ def __init__( self.enabled = kwargs.get('enabled', True) -class Resource(msrest.serialization.Model): +class AzureResource(msrest.serialization.Model): """An azure resource object. Variables are only populated by the server, and will be ignored when sending a request. @@ -70,6 +70,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -80,6 +84,8 @@ class Resource(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, } @@ -87,6 +93,8 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -95,15 +103,17 @@ def __init__( self, **kwargs ): - super(Resource, self).__init__(**kwargs) + super(AzureResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.kind = None + self.identity = None self.location = kwargs['location'] self.tags = kwargs.get('tags', None) -class ActionGroupResource(Resource): +class ActionGroupResource(AzureResource): """An action group resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -116,6 +126,10 @@ class ActionGroupResource(Resource): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -135,20 +149,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2019_03_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2019_03_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2019_03_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2019_03_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2019_03_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2019_03_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2019_03_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2019_03_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2019_03_01.models.AzureFunctionReceiver] :param arm_role_receivers: The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. :type arm_role_receivers: list[~$(python-base-namespace).v2019_03_01.models.ArmRoleReceiver] @@ -158,6 +172,8 @@ class ActionGroupResource(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, 'group_short_name': {'max_length': 12, 'min_length': 0}, } @@ -166,6 +182,8 @@ class ActionGroupResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, @@ -211,14 +229,13 @@ class ArmRoleReceiver(msrest.serialization.Model): :type name: str :param role_id: Required. The arm role id. :type role_id: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'role_id': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -234,7 +251,7 @@ def __init__( super(ArmRoleReceiver, self).__init__(**kwargs) self.name = kwargs['name'] self.role_id = kwargs['role_id'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class AutomationRunbookReceiver(msrest.serialization.Model): @@ -255,7 +272,7 @@ class AutomationRunbookReceiver(msrest.serialization.Model): :type name: str :param service_uri: The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -264,7 +281,6 @@ class AutomationRunbookReceiver(msrest.serialization.Model): 'runbook_name': {'required': True}, 'webhook_resource_id': {'required': True}, 'is_global_runbook': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -288,7 +304,7 @@ def __init__( self.is_global_runbook = kwargs['is_global_runbook'] self.name = kwargs.get('name', None) self.service_uri = kwargs.get('service_uri', None) - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class AzureAppPushReceiver(msrest.serialization.Model): @@ -336,7 +352,7 @@ class AzureFunctionReceiver(msrest.serialization.Model): :type function_name: str :param http_trigger_url: Required. The http trigger url where http request sent to. :type http_trigger_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -345,7 +361,6 @@ class AzureFunctionReceiver(msrest.serialization.Model): 'function_app_resource_id': {'required': True}, 'function_name': {'required': True}, 'http_trigger_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -365,7 +380,7 @@ def __init__( self.function_app_resource_id = kwargs['function_app_resource_id'] self.function_name = kwargs['function_name'] self.http_trigger_url = kwargs['http_trigger_url'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class BaselineMetadata(msrest.serialization.Model): @@ -410,7 +425,7 @@ class EmailReceiver(msrest.serialization.Model): :type name: str :param email_address: Required. The email address of this receiver. :type email_address: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool :ivar status: The receiver status of the e-mail. Possible values include: "NotSpecified", "Enabled", "Disabled". @@ -420,7 +435,6 @@ class EmailReceiver(msrest.serialization.Model): _validation = { 'name': {'required': True}, 'email_address': {'required': True}, - 'use_common_alert_schema': {'required': True}, 'status': {'readonly': True}, } @@ -438,7 +452,7 @@ def __init__( super(EmailReceiver, self).__init__(**kwargs) self.name = kwargs['name'] self.email_address = kwargs['email_address'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) self.status = None @@ -551,7 +565,7 @@ class LogicAppReceiver(msrest.serialization.Model): :type resource_id: str :param callback_url: Required. The callback url where http request sent to. :type callback_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -559,7 +573,6 @@ class LogicAppReceiver(msrest.serialization.Model): 'name': {'required': True}, 'resource_id': {'required': True}, 'callback_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -577,7 +590,7 @@ def __init__( self.name = kwargs['name'] self.resource_id = kwargs['resource_id'] self.callback_url = kwargs['callback_url'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class MetricBaselinesResponse(msrest.serialization.Model): @@ -780,8 +793,8 @@ class TimeSeriesBaseline(msrest.serialization.Model): :type timestamps: list[~datetime.datetime] :param data: Required. The baseline values for each sensitivity. :type data: list[~$(python-base-namespace).v2019_03_01.models.SingleBaseline] - :param metadata: The baseline metadata values. - :type metadata: list[~$(python-base-namespace).v2019_03_01.models.BaselineMetadata] + :param metadata_values: The baseline metadata values. + :type metadata_values: list[~$(python-base-namespace).v2019_03_01.models.BaselineMetadata] """ _validation = { @@ -795,7 +808,7 @@ class TimeSeriesBaseline(msrest.serialization.Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, 'data': {'key': 'data', 'type': '[SingleBaseline]'}, - 'metadata': {'key': 'metadata', 'type': '[BaselineMetadata]'}, + 'metadata_values': {'key': 'metadataValues', 'type': '[BaselineMetadata]'}, } def __init__( @@ -807,7 +820,7 @@ def __init__( self.dimensions = kwargs.get('dimensions', None) self.timestamps = kwargs['timestamps'] self.data = kwargs['data'] - self.metadata = kwargs.get('metadata', None) + self.metadata_values = kwargs.get('metadata_values', None) class VoiceReceiver(msrest.serialization.Model): @@ -856,14 +869,13 @@ class WebhookReceiver(msrest.serialization.Model): :type name: str :param service_uri: Required. The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'service_uri': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -879,4 +891,4 @@ def __init__( super(WebhookReceiver, self).__init__(**kwargs) self.name = kwargs['name'] self.service_uri = kwargs['service_uri'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py index ae73ab8d590ab..fcf507eee0814 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_models_py3.py @@ -68,7 +68,7 @@ def __init__( self.enabled = enabled -class Resource(msrest.serialization.Model): +class AzureResource(msrest.serialization.Model): """An azure resource object. Variables are only populated by the server, and will be ignored when sending a request. @@ -81,6 +81,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -91,6 +95,8 @@ class Resource(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, } @@ -98,6 +104,8 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -109,15 +117,17 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): - super(Resource, self).__init__(**kwargs) + super(AzureResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.kind = None + self.identity = None self.location = location self.tags = tags -class ActionGroupResource(Resource): +class ActionGroupResource(AzureResource): """An action group resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -130,6 +140,10 @@ class ActionGroupResource(Resource): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -149,20 +163,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2019_03_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2019_03_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2019_03_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2019_03_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2019_03_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2019_03_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2019_03_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2019_03_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2019_03_01.models.AzureFunctionReceiver] :param arm_role_receivers: The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. :type arm_role_receivers: list[~$(python-base-namespace).v2019_03_01.models.ArmRoleReceiver] @@ -172,6 +186,8 @@ class ActionGroupResource(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, 'group_short_name': {'max_length': 12, 'min_length': 0}, } @@ -180,6 +196,8 @@ class ActionGroupResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, @@ -240,14 +258,13 @@ class ArmRoleReceiver(msrest.serialization.Model): :type name: str :param role_id: Required. The arm role id. :type role_id: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'role_id': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -261,7 +278,7 @@ def __init__( *, name: str, role_id: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(ArmRoleReceiver, self).__init__(**kwargs) @@ -288,7 +305,7 @@ class AutomationRunbookReceiver(msrest.serialization.Model): :type name: str :param service_uri: The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -297,7 +314,6 @@ class AutomationRunbookReceiver(msrest.serialization.Model): 'runbook_name': {'required': True}, 'webhook_resource_id': {'required': True}, 'is_global_runbook': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -317,9 +333,9 @@ def __init__( runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, - use_common_alert_schema: bool, name: Optional[str] = None, service_uri: Optional[str] = None, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(AutomationRunbookReceiver, self).__init__(**kwargs) @@ -380,7 +396,7 @@ class AzureFunctionReceiver(msrest.serialization.Model): :type function_name: str :param http_trigger_url: Required. The http trigger url where http request sent to. :type http_trigger_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -389,7 +405,6 @@ class AzureFunctionReceiver(msrest.serialization.Model): 'function_app_resource_id': {'required': True}, 'function_name': {'required': True}, 'http_trigger_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -407,7 +422,7 @@ def __init__( function_app_resource_id: str, function_name: str, http_trigger_url: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(AzureFunctionReceiver, self).__init__(**kwargs) @@ -463,7 +478,7 @@ class EmailReceiver(msrest.serialization.Model): :type name: str :param email_address: Required. The email address of this receiver. :type email_address: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool :ivar status: The receiver status of the e-mail. Possible values include: "NotSpecified", "Enabled", "Disabled". @@ -473,7 +488,6 @@ class EmailReceiver(msrest.serialization.Model): _validation = { 'name': {'required': True}, 'email_address': {'required': True}, - 'use_common_alert_schema': {'required': True}, 'status': {'readonly': True}, } @@ -489,7 +503,7 @@ def __init__( *, name: str, email_address: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(EmailReceiver, self).__init__(**kwargs) @@ -619,7 +633,7 @@ class LogicAppReceiver(msrest.serialization.Model): :type resource_id: str :param callback_url: Required. The callback url where http request sent to. :type callback_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -627,7 +641,6 @@ class LogicAppReceiver(msrest.serialization.Model): 'name': {'required': True}, 'resource_id': {'required': True}, 'callback_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -643,7 +656,7 @@ def __init__( name: str, resource_id: str, callback_url: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(LogicAppReceiver, self).__init__(**kwargs) @@ -874,8 +887,8 @@ class TimeSeriesBaseline(msrest.serialization.Model): :type timestamps: list[~datetime.datetime] :param data: Required. The baseline values for each sensitivity. :type data: list[~$(python-base-namespace).v2019_03_01.models.SingleBaseline] - :param metadata: The baseline metadata values. - :type metadata: list[~$(python-base-namespace).v2019_03_01.models.BaselineMetadata] + :param metadata_values: The baseline metadata values. + :type metadata_values: list[~$(python-base-namespace).v2019_03_01.models.BaselineMetadata] """ _validation = { @@ -889,7 +902,7 @@ class TimeSeriesBaseline(msrest.serialization.Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, 'data': {'key': 'data', 'type': '[SingleBaseline]'}, - 'metadata': {'key': 'metadata', 'type': '[BaselineMetadata]'}, + 'metadata_values': {'key': 'metadataValues', 'type': '[BaselineMetadata]'}, } def __init__( @@ -899,7 +912,7 @@ def __init__( timestamps: List[datetime.datetime], data: List["SingleBaseline"], dimensions: Optional[List["MetricSingleDimension"]] = None, - metadata: Optional[List["BaselineMetadata"]] = None, + metadata_values: Optional[List["BaselineMetadata"]] = None, **kwargs ): super(TimeSeriesBaseline, self).__init__(**kwargs) @@ -907,7 +920,7 @@ def __init__( self.dimensions = dimensions self.timestamps = timestamps self.data = data - self.metadata = metadata + self.metadata_values = metadata_values class VoiceReceiver(msrest.serialization.Model): @@ -960,14 +973,13 @@ class WebhookReceiver(msrest.serialization.Model): :type name: str :param service_uri: Required. The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'service_uri': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -981,7 +993,7 @@ def __init__( *, name: str, service_uri: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(WebhookReceiver, self).__init__(**kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py index c9fbe20773ceb..7be428a477149 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_action_groups_operations.py @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py index 694d1ae0d6c6f..d880d7505e7bb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/operations/_baselines_operations.py @@ -64,7 +64,9 @@ def list( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param metricnamespace: Metric namespace to query metric definitions for. :type metricnamespace: str @@ -77,15 +79,18 @@ def list( :type aggregation: str :param sensitivities: The list of sensitivities (comma separated) to retrieve. :type sensitivities: str - :param filter: The **$filter** is used to reduce the set of metric data - returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`- - Return all time series of C where A = a1 and B = b1 or b2:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`
`- Invalid variant::code:`
`\ **$filter=A - eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`
`This is invalid because the - logical or operator cannot separate two different metadata names.:code:`
`- Return all time - series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq - ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and - B eq ‘\ *’ and C eq ‘*\ ’**. + :param filter: The **$filter** is used to reduce the set of metric data returned. Example: + Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or + b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A + eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or + operator cannot separate two different metadata names. - Return all time series where A = a1, B + = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series + where A = a1 **$filter=A eq 'a1' and B eq '\ *' and C eq '*\ '**. Special case: When dimension + name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** + Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ + ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ + ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. :type filter: str :param result_type: Allows retrieving only metadata of the baseline. On data request all information is retrieved. @@ -156,7 +161,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -165,4 +170,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricBaselines'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricBaselines'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py index 986ddf51548aa..21e5e61b754ab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json index b08a44abb8eae..5e2ddffbca2bc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,41 +23,81 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "action_groups": "ActionGroupsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py index 8602679e95fb4..aa90ea634327b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ActionGroupsOperations @@ -29,7 +30,7 @@ class MonitorManagementClient(object): :vartype action_groups: $(python-base-namespace).v2019_06_01.operations.ActionGroupsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -55,6 +56,24 @@ def __init__( self.action_groups = ActionGroupsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py index 5a6acb7a7c8e2..95f4e81a04ba3 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py index defe4fa3c7211..e23a7c650d226 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -27,7 +28,7 @@ class MonitorManagementClient(object): :vartype action_groups: $(python-base-namespace).v2019_06_01.aio.operations.ActionGroupsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,6 +53,23 @@ def __init__( self.action_groups = ActionGroupsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py index 234fd4de09971..2920b224b86ae 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/operations/_action_groups_operations.py @@ -46,7 +46,7 @@ async def create_or_update( resource_group_name: str, action_group_name: str, action_group: "_models.ActionGroupResource", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Create a new action group or update an existing one. @@ -75,7 +75,7 @@ async def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -97,7 +97,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,7 +116,7 @@ async def get( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Get an action group. @@ -142,7 +142,7 @@ async def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -175,7 +175,7 @@ async def delete( self, resource_group_name: str, action_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete an action group. @@ -201,7 +201,7 @@ async def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -232,7 +232,7 @@ async def update( resource_group_name: str, action_group_name: str, action_group_patch: "_models.ActionGroupPatchBody", - **kwargs + **kwargs: Any ) -> "_models.ActionGroupResource": """Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. @@ -259,7 +259,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -283,7 +283,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -296,7 +296,7 @@ async def update( def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a subscription. @@ -322,7 +322,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -350,7 +350,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -364,7 +364,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ActionGroupList"]: """Get a list of all action groups in a resource group. @@ -393,7 +393,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -421,7 +421,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -437,7 +437,7 @@ async def enable_receiver( resource_group_name: str, action_group_name: str, enable_request: "_models.EnableRequest", - **kwargs + **kwargs: Any ) -> None: """Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. @@ -467,7 +467,7 @@ async def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -489,7 +489,7 @@ async def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py index 8b63784e2053a..c88038080b955 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/__init__.py @@ -14,12 +14,12 @@ from ._models_py3 import AutomationRunbookReceiver from ._models_py3 import AzureAppPushReceiver from ._models_py3 import AzureFunctionReceiver + from ._models_py3 import AzureResource from ._models_py3 import EmailReceiver from ._models_py3 import EnableRequest from ._models_py3 import ErrorResponse from ._models_py3 import ItsmReceiver from ._models_py3 import LogicAppReceiver - from ._models_py3 import Resource from ._models_py3 import SmsReceiver from ._models_py3 import VoiceReceiver from ._models_py3 import WebhookReceiver @@ -31,12 +31,12 @@ from ._models import AutomationRunbookReceiver # type: ignore from ._models import AzureAppPushReceiver # type: ignore from ._models import AzureFunctionReceiver # type: ignore + from ._models import AzureResource # type: ignore from ._models import EmailReceiver # type: ignore from ._models import EnableRequest # type: ignore from ._models import ErrorResponse # type: ignore from ._models import ItsmReceiver # type: ignore from ._models import LogicAppReceiver # type: ignore - from ._models import Resource # type: ignore from ._models import SmsReceiver # type: ignore from ._models import VoiceReceiver # type: ignore from ._models import WebhookReceiver # type: ignore @@ -53,12 +53,12 @@ 'AutomationRunbookReceiver', 'AzureAppPushReceiver', 'AzureFunctionReceiver', + 'AzureResource', 'EmailReceiver', 'EnableRequest', 'ErrorResponse', 'ItsmReceiver', 'LogicAppReceiver', - 'Resource', 'SmsReceiver', 'VoiceReceiver', 'WebhookReceiver', diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py index a1dbf1f2dd93e..a23a384c9d9c9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models.py @@ -57,7 +57,7 @@ def __init__( self.enabled = kwargs.get('enabled', True) -class Resource(msrest.serialization.Model): +class AzureResource(msrest.serialization.Model): """An azure resource object. Variables are only populated by the server, and will be ignored when sending a request. @@ -70,6 +70,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -80,6 +84,8 @@ class Resource(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, } @@ -87,6 +93,8 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -95,15 +103,17 @@ def __init__( self, **kwargs ): - super(Resource, self).__init__(**kwargs) + super(AzureResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.kind = None + self.identity = None self.location = kwargs['location'] self.tags = kwargs.get('tags', None) -class ActionGroupResource(Resource): +class ActionGroupResource(AzureResource): """An action group resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -116,6 +126,10 @@ class ActionGroupResource(Resource): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -135,20 +149,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2019_06_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2019_06_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2019_06_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2019_06_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2019_06_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2019_06_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2019_06_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2019_06_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2019_06_01.models.AzureFunctionReceiver] :param arm_role_receivers: The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. :type arm_role_receivers: list[~$(python-base-namespace).v2019_06_01.models.ArmRoleReceiver] @@ -158,6 +172,8 @@ class ActionGroupResource(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, 'group_short_name': {'max_length': 12, 'min_length': 0}, } @@ -166,6 +182,8 @@ class ActionGroupResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, @@ -211,14 +229,13 @@ class ArmRoleReceiver(msrest.serialization.Model): :type name: str :param role_id: Required. The arm role id. :type role_id: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'role_id': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -234,7 +251,7 @@ def __init__( super(ArmRoleReceiver, self).__init__(**kwargs) self.name = kwargs['name'] self.role_id = kwargs['role_id'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class AutomationRunbookReceiver(msrest.serialization.Model): @@ -255,7 +272,7 @@ class AutomationRunbookReceiver(msrest.serialization.Model): :type name: str :param service_uri: The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -264,7 +281,6 @@ class AutomationRunbookReceiver(msrest.serialization.Model): 'runbook_name': {'required': True}, 'webhook_resource_id': {'required': True}, 'is_global_runbook': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -288,7 +304,7 @@ def __init__( self.is_global_runbook = kwargs['is_global_runbook'] self.name = kwargs.get('name', None) self.service_uri = kwargs.get('service_uri', None) - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class AzureAppPushReceiver(msrest.serialization.Model): @@ -336,7 +352,7 @@ class AzureFunctionReceiver(msrest.serialization.Model): :type function_name: str :param http_trigger_url: Required. The http trigger url where http request sent to. :type http_trigger_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -345,7 +361,6 @@ class AzureFunctionReceiver(msrest.serialization.Model): 'function_app_resource_id': {'required': True}, 'function_name': {'required': True}, 'http_trigger_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -365,7 +380,7 @@ def __init__( self.function_app_resource_id = kwargs['function_app_resource_id'] self.function_name = kwargs['function_name'] self.http_trigger_url = kwargs['http_trigger_url'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class EmailReceiver(msrest.serialization.Model): @@ -380,7 +395,7 @@ class EmailReceiver(msrest.serialization.Model): :type name: str :param email_address: Required. The email address of this receiver. :type email_address: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool :ivar status: The receiver status of the e-mail. Possible values include: "NotSpecified", "Enabled", "Disabled". @@ -390,7 +405,6 @@ class EmailReceiver(msrest.serialization.Model): _validation = { 'name': {'required': True}, 'email_address': {'required': True}, - 'use_common_alert_schema': {'required': True}, 'status': {'readonly': True}, } @@ -408,7 +422,7 @@ def __init__( super(EmailReceiver, self).__init__(**kwargs) self.name = kwargs['name'] self.email_address = kwargs['email_address'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) self.status = None @@ -521,7 +535,7 @@ class LogicAppReceiver(msrest.serialization.Model): :type resource_id: str :param callback_url: Required. The callback url where http request sent to. :type callback_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -529,7 +543,6 @@ class LogicAppReceiver(msrest.serialization.Model): 'name': {'required': True}, 'resource_id': {'required': True}, 'callback_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -547,7 +560,7 @@ def __init__( self.name = kwargs['name'] self.resource_id = kwargs['resource_id'] self.callback_url = kwargs['callback_url'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) class SmsReceiver(msrest.serialization.Model): @@ -640,7 +653,7 @@ class WebhookReceiver(msrest.serialization.Model): :type name: str :param service_uri: Required. The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool :param use_aad_auth: Indicates whether or not use AAD authentication. :type use_aad_auth: bool @@ -655,7 +668,6 @@ class WebhookReceiver(msrest.serialization.Model): _validation = { 'name': {'required': True}, 'service_uri': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -675,7 +687,7 @@ def __init__( super(WebhookReceiver, self).__init__(**kwargs) self.name = kwargs['name'] self.service_uri = kwargs['service_uri'] - self.use_common_alert_schema = kwargs['use_common_alert_schema'] + self.use_common_alert_schema = kwargs.get('use_common_alert_schema', False) self.use_aad_auth = kwargs.get('use_aad_auth', False) self.object_id = kwargs.get('object_id', None) self.identifier_uri = kwargs.get('identifier_uri', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py index 7c37fa9228043..5d5c8528ce62f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_models_py3.py @@ -65,7 +65,7 @@ def __init__( self.enabled = enabled -class Resource(msrest.serialization.Model): +class AzureResource(msrest.serialization.Model): """An azure resource object. Variables are only populated by the server, and will be ignored when sending a request. @@ -78,6 +78,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -88,6 +92,8 @@ class Resource(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, } @@ -95,6 +101,8 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -106,15 +114,17 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): - super(Resource, self).__init__(**kwargs) + super(AzureResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.kind = None + self.identity = None self.location = location self.tags = tags -class ActionGroupResource(Resource): +class ActionGroupResource(AzureResource): """An action group resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -127,6 +137,10 @@ class ActionGroupResource(Resource): :vartype name: str :ivar type: Azure resource type. :vartype type: str + :ivar kind: Azure resource kind. + :vartype kind: str + :ivar identity: Azure resource identity. + :vartype identity: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -146,20 +160,20 @@ class ActionGroupResource(Resource): :type itsm_receivers: list[~$(python-base-namespace).v2019_06_01.models.ItsmReceiver] :param azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action group. - :type azure_app_push_receivers: list[~$(python-base- - namespace).v2019_06_01.models.AzureAppPushReceiver] + :type azure_app_push_receivers: + list[~$(python-base-namespace).v2019_06_01.models.AzureAppPushReceiver] :param automation_runbook_receivers: The list of AutomationRunbook receivers that are part of this action group. - :type automation_runbook_receivers: list[~$(python-base- - namespace).v2019_06_01.models.AutomationRunbookReceiver] + :type automation_runbook_receivers: + list[~$(python-base-namespace).v2019_06_01.models.AutomationRunbookReceiver] :param voice_receivers: The list of voice receivers that are part of this action group. :type voice_receivers: list[~$(python-base-namespace).v2019_06_01.models.VoiceReceiver] :param logic_app_receivers: The list of logic app receivers that are part of this action group. :type logic_app_receivers: list[~$(python-base-namespace).v2019_06_01.models.LogicAppReceiver] :param azure_function_receivers: The list of azure function receivers that are part of this action group. - :type azure_function_receivers: list[~$(python-base- - namespace).v2019_06_01.models.AzureFunctionReceiver] + :type azure_function_receivers: + list[~$(python-base-namespace).v2019_06_01.models.AzureFunctionReceiver] :param arm_role_receivers: The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. :type arm_role_receivers: list[~$(python-base-namespace).v2019_06_01.models.ArmRoleReceiver] @@ -169,6 +183,8 @@ class ActionGroupResource(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'identity': {'readonly': True}, 'location': {'required': True}, 'group_short_name': {'max_length': 12, 'min_length': 0}, } @@ -177,6 +193,8 @@ class ActionGroupResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'group_short_name': {'key': 'properties.groupShortName', 'type': 'str'}, @@ -237,14 +255,13 @@ class ArmRoleReceiver(msrest.serialization.Model): :type name: str :param role_id: Required. The arm role id. :type role_id: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ _validation = { 'name': {'required': True}, 'role_id': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -258,7 +275,7 @@ def __init__( *, name: str, role_id: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(ArmRoleReceiver, self).__init__(**kwargs) @@ -285,7 +302,7 @@ class AutomationRunbookReceiver(msrest.serialization.Model): :type name: str :param service_uri: The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -294,7 +311,6 @@ class AutomationRunbookReceiver(msrest.serialization.Model): 'runbook_name': {'required': True}, 'webhook_resource_id': {'required': True}, 'is_global_runbook': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -314,9 +330,9 @@ def __init__( runbook_name: str, webhook_resource_id: str, is_global_runbook: bool, - use_common_alert_schema: bool, name: Optional[str] = None, service_uri: Optional[str] = None, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(AutomationRunbookReceiver, self).__init__(**kwargs) @@ -377,7 +393,7 @@ class AzureFunctionReceiver(msrest.serialization.Model): :type function_name: str :param http_trigger_url: Required. The http trigger url where http request sent to. :type http_trigger_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -386,7 +402,6 @@ class AzureFunctionReceiver(msrest.serialization.Model): 'function_app_resource_id': {'required': True}, 'function_name': {'required': True}, 'http_trigger_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -404,7 +419,7 @@ def __init__( function_app_resource_id: str, function_name: str, http_trigger_url: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(AzureFunctionReceiver, self).__init__(**kwargs) @@ -427,7 +442,7 @@ class EmailReceiver(msrest.serialization.Model): :type name: str :param email_address: Required. The email address of this receiver. :type email_address: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool :ivar status: The receiver status of the e-mail. Possible values include: "NotSpecified", "Enabled", "Disabled". @@ -437,7 +452,6 @@ class EmailReceiver(msrest.serialization.Model): _validation = { 'name': {'required': True}, 'email_address': {'required': True}, - 'use_common_alert_schema': {'required': True}, 'status': {'readonly': True}, } @@ -453,7 +467,7 @@ def __init__( *, name: str, email_address: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(EmailReceiver, self).__init__(**kwargs) @@ -583,7 +597,7 @@ class LogicAppReceiver(msrest.serialization.Model): :type resource_id: str :param callback_url: Required. The callback url where http request sent to. :type callback_url: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool """ @@ -591,7 +605,6 @@ class LogicAppReceiver(msrest.serialization.Model): 'name': {'required': True}, 'resource_id': {'required': True}, 'callback_url': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -607,7 +620,7 @@ def __init__( name: str, resource_id: str, callback_url: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, **kwargs ): super(LogicAppReceiver, self).__init__(**kwargs) @@ -715,7 +728,7 @@ class WebhookReceiver(msrest.serialization.Model): :type name: str :param service_uri: Required. The URI where webhooks should be sent. :type service_uri: str - :param use_common_alert_schema: Required. Indicates whether to use common alert schema. + :param use_common_alert_schema: Indicates whether to use common alert schema. :type use_common_alert_schema: bool :param use_aad_auth: Indicates whether or not use AAD authentication. :type use_aad_auth: bool @@ -730,7 +743,6 @@ class WebhookReceiver(msrest.serialization.Model): _validation = { 'name': {'required': True}, 'service_uri': {'required': True}, - 'use_common_alert_schema': {'required': True}, } _attribute_map = { @@ -748,7 +760,7 @@ def __init__( *, name: str, service_uri: str, - use_common_alert_schema: bool, + use_common_alert_schema: Optional[bool] = False, use_aad_auth: Optional[bool] = False, object_id: Optional[str] = None, identifier_uri: Optional[str] = None, diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py index 5e5beb6f7e233..cc8b99ea162a8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/operations/_action_groups_operations.py @@ -80,7 +80,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -102,7 +102,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -148,7 +148,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -208,7 +208,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -267,7 +267,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), } @@ -291,7 +291,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActionGroupResource', pipeline_response) @@ -331,7 +331,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription_id.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -359,7 +359,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -403,7 +403,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -431,7 +431,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -478,7 +478,7 @@ def enable_receiver( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'actionGroupName': self._serialize.url("action_group_name", action_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -500,7 +500,7 @@ def enable_receiver( if response.status_code not in [200, 409]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py index 83a63e0eb1cad..3dad54793336f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json index 3c2b0e3f35258..fec9dc40f6cba 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,35 +23,79 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "private_link_scopes": "PrivateLinkScopesOperations", @@ -57,9 +103,5 @@ "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", "private_link_scoped_resources": "PrivateLinkScopedResourcesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py index 17ca2fc7e5c52..fed0b405d3090 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import PrivateLinkScopesOperations @@ -41,7 +42,7 @@ class MonitorManagementClient(object): :vartype private_link_scoped_resources: $(python-base-namespace).v2019_10_17.operations.PrivateLinkScopedResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -76,6 +77,24 @@ def __init__( self.private_link_scoped_resources = PrivateLinkScopedResourcesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py index 92d60a10ecc5d..4579dfddfc722 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py index 21dbf08efa5cc..1fce9050d8f0a 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -39,7 +40,7 @@ class MonitorManagementClient(object): :vartype private_link_scoped_resources: $(python-base-namespace).v2019_10_17.aio.operations.PrivateLinkScopedResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -73,6 +74,23 @@ def __init__( self.private_link_scoped_resources = PrivateLinkScopedResourcesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py index 6737376e31385..239eddf9047e8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_endpoint_connections_operations.py @@ -48,7 +48,7 @@ async def get( resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": """Gets a private endpoint connection. @@ -74,7 +74,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -111,7 +111,7 @@ async def _create_or_update_initial( scope_name: str, private_endpoint_connection_name: str, parameters: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { @@ -125,7 +125,7 @@ async def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -168,7 +168,7 @@ async def begin_create_or_update( scope_name: str, private_endpoint_connection_name: str, parameters: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection with a given name. @@ -182,8 +182,8 @@ async def begin_create_or_update( :type parameters: ~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -218,7 +218,7 @@ def get_long_running_output(pipeline_response): return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -243,7 +243,7 @@ async def _delete_initial( resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -255,7 +255,7 @@ async def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -287,7 +287,7 @@ async def begin_delete( resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection with a given name. @@ -299,8 +299,8 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -331,7 +331,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -355,7 +355,7 @@ def list_by_private_link_scope( self, resource_group_name: str, scope_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: """Gets all private endpoint connections on a private link scope. @@ -385,7 +385,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py index bed75a78ceaf4..7f2fb98207283 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_resources_operations.py @@ -45,7 +45,7 @@ def list_by_private_link_scope( self, resource_group_name: str, scope_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. @@ -75,7 +75,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } @@ -120,7 +120,7 @@ async def get( resource_group_name: str, scope_name: str, group_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResource": """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. @@ -146,7 +146,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'groupName': self._serialize.url("group_name", group_name, 'str'), diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py index a5b6373e2a95c..398fb3531b9ff 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scope_operation_status_operations.py @@ -44,7 +44,7 @@ async def get( self, async_operation_id: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.OperationStatus": """Get the status of an azure asynchronous operation associated with a private link scope operation. @@ -71,7 +71,7 @@ async def get( path_format_arguments = { 'asyncOperationId': self._serialize.url("async_operation_id", async_operation_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py index 54a032f85139a..577349ea983d5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scoped_resources_operations.py @@ -48,7 +48,7 @@ async def get( resource_group_name: str, scope_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.ScopedResource": """Gets a scoped resource in a private link scope. @@ -74,7 +74,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -111,7 +111,7 @@ async def _create_or_update_initial( scope_name: str, name: str, parameters: "_models.ScopedResource", - **kwargs + **kwargs: Any ) -> Optional["_models.ScopedResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ScopedResource"]] error_map = { @@ -125,7 +125,7 @@ async def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -171,7 +171,7 @@ async def begin_create_or_update( scope_name: str, name: str, parameters: "_models.ScopedResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ScopedResource"]: """Approve or reject a private endpoint connection with a given name. @@ -185,8 +185,8 @@ async def begin_create_or_update( :type parameters: ~$(python-base-namespace).v2019_10_17.models.ScopedResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ScopedResource or the result of cls(response) @@ -221,7 +221,7 @@ def get_long_running_output(pipeline_response): return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -246,7 +246,7 @@ async def _delete_initial( resource_group_name: str, scope_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -258,7 +258,7 @@ async def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -290,7 +290,7 @@ async def begin_delete( resource_group_name: str, scope_name: str, name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection with a given name. @@ -302,8 +302,8 @@ async def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -334,7 +334,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -358,7 +358,7 @@ def list_by_private_link_scope( self, resource_group_name: str, scope_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ScopedResourceListResult"]: """Gets all private endpoint connections on a private link scope. @@ -388,7 +388,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py index 64888edbabcb3..1c9d4b02e0260 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/operations/_private_link_scopes_operations.py @@ -45,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AzureMonitorPrivateLinkScopeListResult"]: """Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. @@ -71,7 +71,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -112,7 +112,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AzureMonitorPrivateLinkScopeListResult"]: """Gets a list of Azure Monitor PrivateLinkScopes within a resource group. @@ -141,7 +141,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -183,7 +183,7 @@ async def _delete_initial( self, resource_group_name: str, scope_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -196,7 +196,7 @@ async def _delete_initial( url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -225,7 +225,7 @@ async def begin_delete( self, resource_group_name: str, scope_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Azure Monitor PrivateLinkScope. @@ -235,8 +235,8 @@ async def begin_delete( :type scope_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -267,7 +267,7 @@ def get_long_running_output(pipeline_response): path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } @@ -289,7 +289,7 @@ async def get( self, resource_group_name: str, scope_name: str, - **kwargs + **kwargs: Any ) -> "_models.AzureMonitorPrivateLinkScope": """Returns a Azure Monitor PrivateLinkScope. @@ -314,7 +314,7 @@ async def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -348,7 +348,7 @@ async def create_or_update( resource_group_name: str, scope_name: str, azure_monitor_private_link_scope_payload: "_models.AzureMonitorPrivateLinkScope", - **kwargs + **kwargs: Any ) -> "_models.AzureMonitorPrivateLinkScope": """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. @@ -378,7 +378,7 @@ async def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -420,7 +420,7 @@ async def update_tags( resource_group_name: str, scope_name: str, private_link_scope_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.AzureMonitorPrivateLinkScope": """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. @@ -450,7 +450,7 @@ async def update_tags( url = self.update_tags.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models.py index 7372785e96dda..fbe1212940c53 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models.py @@ -77,8 +77,8 @@ class AzureMonitorPrivateLinkScope(PrivateLinkScopesResource): able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. :vartype provisioning_state: str :ivar private_endpoint_connections: List of private endpoint connections. - :vartype private_endpoint_connections: list[~$(python-base- - namespace).v2019_10_17.models.PrivateEndpointConnection] + :vartype private_endpoint_connections: + list[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection] """ _validation = { @@ -147,7 +147,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -204,8 +204,8 @@ class ErrorResponseCommon(ErrorResponse): :ivar details: The error details. :vartype details: list[~$(python-base-namespace).v2019_10_17.models.ErrorResponseCommon] :ivar additional_info: The error additional info. - :vartype additional_info: list[~$(python-base- - namespace).v2019_10_17.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~$(python-base-namespace).v2019_10_17.models.ErrorAdditionalInfo] """ _validation = { @@ -318,8 +318,8 @@ class PrivateEndpointConnection(ProxyResource): :type private_endpoint: ~$(python-base-namespace).v2019_10_17.models.PrivateEndpointProperty :param private_link_service_connection_state: Connection state of the private endpoint connection. - :type private_link_service_connection_state: ~$(python-base- - namespace).v2019_10_17.models.PrivateLinkServiceConnectionStateProperty + :type private_link_service_connection_state: + ~$(python-base-namespace).v2019_10_17.models.PrivateLinkServiceConnectionStateProperty :ivar provisioning_state: State of the private endpoint connection. :vartype provisioning_state: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models_py3.py index 1d69fcb6834d0..a26b257a23279 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/models/_models_py3.py @@ -83,8 +83,8 @@ class AzureMonitorPrivateLinkScope(PrivateLinkScopesResource): able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. :vartype provisioning_state: str :ivar private_endpoint_connections: List of private endpoint connections. - :vartype private_endpoint_connections: list[~$(python-base- - namespace).v2019_10_17.models.PrivateEndpointConnection] + :vartype private_endpoint_connections: + list[~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection] """ _validation = { @@ -159,7 +159,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -219,8 +219,8 @@ class ErrorResponseCommon(ErrorResponse): :ivar details: The error details. :vartype details: list[~$(python-base-namespace).v2019_10_17.models.ErrorResponseCommon] :ivar additional_info: The error additional info. - :vartype additional_info: list[~$(python-base- - namespace).v2019_10_17.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~$(python-base-namespace).v2019_10_17.models.ErrorAdditionalInfo] """ _validation = { @@ -343,8 +343,8 @@ class PrivateEndpointConnection(ProxyResource): :type private_endpoint: ~$(python-base-namespace).v2019_10_17.models.PrivateEndpointProperty :param private_link_service_connection_state: Connection state of the private endpoint connection. - :type private_link_service_connection_state: ~$(python-base- - namespace).v2019_10_17.models.PrivateLinkServiceConnectionStateProperty + :type private_link_service_connection_state: + ~$(python-base-namespace).v2019_10_17.models.PrivateLinkServiceConnectionStateProperty :ivar provisioning_state: State of the private endpoint connection. :vartype provisioning_state: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py index db80c9574e456..0b05c290c9f09 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_endpoint_connections_operations.py @@ -79,7 +79,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -131,7 +131,7 @@ def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -189,8 +189,8 @@ def begin_create_or_update( :type parameters: ~$(python-base-namespace).v2019_10_17.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -225,7 +225,7 @@ def get_long_running_output(pipeline_response): return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -263,7 +263,7 @@ def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -308,8 +308,8 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -340,7 +340,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), @@ -395,7 +395,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py index 6620eacc112b4..669f69362ef80 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_resources_operations.py @@ -80,7 +80,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } @@ -152,7 +152,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'groupName': self._serialize.url("group_name", group_name, 'str'), diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py index e1f637aaf3b52..e2af92cf65293 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scope_operation_status_operations.py @@ -76,7 +76,7 @@ def get( path_format_arguments = { 'asyncOperationId': self._serialize.url("async_operation_id", async_operation_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py index 7aa45cf03bd3e..1766c14357ae2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scoped_resources_operations.py @@ -79,7 +79,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -131,7 +131,7 @@ def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -192,8 +192,8 @@ def begin_create_or_update( :type parameters: ~$(python-base-namespace).v2019_10_17.models.ScopedResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either ScopedResource or the result of cls(response) @@ -228,7 +228,7 @@ def get_long_running_output(pipeline_response): return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -266,7 +266,7 @@ def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -311,8 +311,8 @@ def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -343,7 +343,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -398,7 +398,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_private_link_scope.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py index 147a41ec0f0e8..814a9efd71832 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/operations/_private_link_scopes_operations.py @@ -76,7 +76,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -147,7 +147,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -203,7 +203,7 @@ def _delete_initial( url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -243,8 +243,8 @@ def begin_delete( :type scope_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -275,7 +275,7 @@ def get_long_running_output(pipeline_response): path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } @@ -323,7 +323,7 @@ def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -388,7 +388,7 @@ def create_or_update( url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -461,7 +461,7 @@ def update_tags( url = self.update_tags.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py index 49e5764a1ad0d..17ffb143fc7e7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json index 9d1dbc34ccdba..2948f6d358e5d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", + "signature": "subscription_id: str,", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true @@ -42,21 +44,61 @@ }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "data_collection_rule_associations": "DataCollectionRuleAssociationsOperations", "data_collection_rules": "DataCollectionRulesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py index 26e7eb98aa3bb..4cdf02aa7cac0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import DataCollectionRuleAssociationsOperations @@ -60,6 +61,24 @@ def __init__( self.data_collection_rules = DataCollectionRulesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py index f2080febb084c..77e781a7e2199 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py index 723bd1e63fee5..25ca1c442b6d0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -57,6 +58,23 @@ def __init__( self.data_collection_rules = DataCollectionRulesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py index b1cf0eab42bdc..9cbf0246fd812 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rule_associations_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_resource( self, resource_uri: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"]: """Lists associations for the specified resource. @@ -102,7 +102,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -117,7 +117,7 @@ def list_by_rule( self, resource_group_name: str, data_collection_rule_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"]: """Lists associations for the specified data collection rule. @@ -151,8 +151,8 @@ def prepare_request(next_link=None): url = self.list_by_rule.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -180,7 +180,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -195,7 +195,7 @@ async def get( self, resource_uri: str, association_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataCollectionRuleAssociationProxyOnlyResource": """Returns the specified association. @@ -203,7 +203,7 @@ async def get( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param association_name: The name of the association. + :param association_name: The name of the association. The name is case insensitive. :type association_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) @@ -222,7 +222,7 @@ async def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), - 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'associationName': self._serialize.url("association_name", association_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -240,7 +240,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) @@ -256,7 +256,7 @@ async def create( resource_uri: str, association_name: str, body: Optional["_models.DataCollectionRuleAssociationProxyOnlyResource"] = None, - **kwargs + **kwargs: Any ) -> "_models.DataCollectionRuleAssociationProxyOnlyResource": """Creates or updates an association. @@ -264,7 +264,7 @@ async def create( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param association_name: The name of the association. + :param association_name: The name of the association. The name is case insensitive. :type association_name: str :param body: The payload. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource @@ -286,7 +286,7 @@ async def create( url = self.create.metadata['url'] # type: ignore path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), - 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'associationName': self._serialize.url("association_name", association_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -311,7 +311,7 @@ async def create( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -330,7 +330,7 @@ async def delete( self, resource_uri: str, association_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes an association. @@ -338,7 +338,7 @@ async def delete( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param association_name: The name of the association. + :param association_name: The name of the association. The name is case insensitive. :type association_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -357,7 +357,7 @@ async def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), - 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'associationName': self._serialize.url("association_name", association_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -375,7 +375,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py index eaa21916a40e9..29bce722e8890 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/operations/_data_collection_rules_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataCollectionRuleResourceListResult"]: """Lists all data collection rules in the specified resource group. @@ -75,7 +75,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -103,7 +103,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -116,7 +116,7 @@ async def get_next(next_link=None): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataCollectionRuleResourceListResult"]: """Lists all data collection rules in the specified subscription. @@ -172,7 +172,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -187,7 +187,7 @@ async def get( self, resource_group_name: str, data_collection_rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataCollectionRuleResource": """Returns the specified data collection rule. @@ -215,8 +215,8 @@ async def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -234,7 +234,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) @@ -250,7 +250,7 @@ async def create( resource_group_name: str, data_collection_rule_name: str, body: Optional["_models.DataCollectionRuleResource"] = None, - **kwargs + **kwargs: Any ) -> "_models.DataCollectionRuleResource": """Creates or updates a data collection rule. @@ -281,8 +281,8 @@ async def create( url = self.create.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -307,7 +307,7 @@ async def create( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -327,7 +327,7 @@ async def update( resource_group_name: str, data_collection_rule_name: str, body: Optional["_models.ResourceForUpdate"] = None, - **kwargs + **kwargs: Any ) -> "_models.DataCollectionRuleResource": """Updates part of a data collection rule. @@ -358,8 +358,8 @@ async def update( url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -384,7 +384,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) @@ -399,7 +399,7 @@ async def delete( self, resource_group_name: str, data_collection_rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a data collection rule. @@ -427,8 +427,8 @@ async def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -446,7 +446,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py index 419634ac11a70..9da80ac0fffc4 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/__init__.py @@ -23,12 +23,8 @@ from ._models_py3 import DestinationsSpec from ._models_py3 import DestinationsSpecAzureMonitorMetrics from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetails - from ._models_py3 import ErrorDetailsAutoGenerated + from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseError - from ._models_py3 import ErrorResponseAutoGenerated - from ._models_py3 import ErrorResponseError from ._models_py3 import ExtensionDataSource from ._models_py3 import LogAnalyticsDestination from ._models_py3 import PerfCounterDataSource @@ -52,12 +48,8 @@ from ._models import DestinationsSpec # type: ignore from ._models import DestinationsSpecAzureMonitorMetrics # type: ignore from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetails # type: ignore - from ._models import ErrorDetailsAutoGenerated # type: ignore + from ._models import ErrorDetail # type: ignore from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseError # type: ignore - from ._models import ErrorResponseAutoGenerated # type: ignore - from ._models import ErrorResponseError # type: ignore from ._models import ExtensionDataSource # type: ignore from ._models import LogAnalyticsDestination # type: ignore from ._models import PerfCounterDataSource # type: ignore @@ -68,14 +60,13 @@ from ._monitor_management_client_enums import ( KnownDataCollectionRuleAssociationProvisioningState, KnownDataCollectionRuleProvisioningState, + KnownDataCollectionRuleResourceKind, KnownDataFlowStreams, KnownExtensionDataSourceStreams, - KnownPerfCounterDataSourceScheduledTransferPeriod, KnownPerfCounterDataSourceStreams, KnownSyslogDataSourceFacilityNames, KnownSyslogDataSourceLogLevels, KnownSyslogDataSourceStreams, - KnownWindowsEventLogDataSourceScheduledTransferPeriod, KnownWindowsEventLogDataSourceStreams, ) @@ -96,12 +87,8 @@ 'DestinationsSpec', 'DestinationsSpecAzureMonitorMetrics', 'ErrorAdditionalInfo', - 'ErrorDetails', - 'ErrorDetailsAutoGenerated', + 'ErrorDetail', 'ErrorResponse', - 'ErrorResponseError', - 'ErrorResponseAutoGenerated', - 'ErrorResponseError', 'ExtensionDataSource', 'LogAnalyticsDestination', 'PerfCounterDataSource', @@ -110,13 +97,12 @@ 'WindowsEventLogDataSource', 'KnownDataCollectionRuleAssociationProvisioningState', 'KnownDataCollectionRuleProvisioningState', + 'KnownDataCollectionRuleResourceKind', 'KnownDataFlowStreams', 'KnownExtensionDataSourceStreams', - 'KnownPerfCounterDataSourceScheduledTransferPeriod', 'KnownPerfCounterDataSourceStreams', 'KnownSyslogDataSourceFacilityNames', 'KnownSyslogDataSourceLogLevels', 'KnownSyslogDataSourceStreams', - 'KnownWindowsEventLogDataSourceScheduledTransferPeriod', 'KnownWindowsEventLogDataSourceStreams', ] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py index 923fe2674a45b..e5edb02c607cc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models.py @@ -13,18 +13,12 @@ class AzureMonitorMetricsDestination(msrest.serialization.Model): """Azure Monitor Metrics destination. - All required parameters must be populated in order to send to Azure. - - :param name: Required. A friendly name for the destination. + :param name: A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } @@ -34,7 +28,7 @@ def __init__( **kwargs ): super(AzureMonitorMetricsDestination, self).__init__(**kwargs) - self.name = kwargs['name'] + self.name = kwargs.get('name', None) class DataCollectionRule(msrest.serialization.Model): @@ -42,35 +36,36 @@ class DataCollectionRule(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the data collection rule. :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str :param data_sources: The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec - :param destinations: Required. The specification of destinations. - :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec - :param data_flows: Required. The specification of data flows. + :type data_sources: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'destinations': {'required': True}, - 'data_flows': {'required': True}, + 'immutable_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, - 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, - 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } @@ -81,9 +76,10 @@ def __init__( ): super(DataCollectionRule, self).__init__(**kwargs) self.description = kwargs.get('description', None) + self.immutable_id = None self.data_sources = kwargs.get('data_sources', None) - self.destinations = kwargs['destinations'] - self.data_flows = kwargs['data_flows'] + self.destinations = kwargs.get('destinations', None) + self.data_flows = kwargs.get('data_flows', None) self.provisioning_state = None @@ -92,22 +88,18 @@ class DataCollectionRuleAssociation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the association. :type description: str - :param data_collection_rule_id: Required. The resource ID of the data collection rule that is - to be associated. + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. :type data_collection_rule_id: str :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'data_collection_rule_id': {'required': True}, 'provisioning_state': {'readonly': True}, } @@ -123,7 +115,7 @@ def __init__( ): super(DataCollectionRuleAssociation, self).__init__(**kwargs) self.description = kwargs.get('description', None) - self.data_collection_rule_id = kwargs['data_collection_rule_id'] + self.data_collection_rule_id = kwargs.get('data_collection_rule_id', None) self.provisioning_state = None @@ -132,8 +124,6 @@ class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model) Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified ID of the resource. :vartype id: str :ivar name: The name of the resource. @@ -144,13 +134,13 @@ class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model) :vartype etag: str :param description: Description of the association. :type description: str - :param data_collection_rule_id: Required. The resource ID of the data collection rule that is - to be associated. + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. :type data_collection_rule_id: str :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState """ _validation = { @@ -158,8 +148,6 @@ class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model) 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'description': {'max_length': 256, 'min_length': 0}, - 'data_collection_rule_id': {'required': True}, 'provisioning_state': {'readonly': True}, } @@ -183,7 +171,7 @@ def __init__( self.type = None self.etag = None self.description = kwargs.get('description', None) - self.data_collection_rule_id = kwargs['data_collection_rule_id'] + self.data_collection_rule_id = kwargs.get('data_collection_rule_id', None) self.provisioning_state = None @@ -193,8 +181,8 @@ class DataCollectionRuleAssociationProxyOnlyResourceListResult(msrest.serializat All required parameters must be populated in order to send to Azure. :param value: Required. A list of resources. - :type value: list[~$(python-base- - namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource] + :type value: + list[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource] :param next_link: The URL to use for getting the next set of results. :type next_link: str """ @@ -222,22 +210,18 @@ class DataCollectionRuleAssociationProxyOnlyResourceProperties(DataCollectionRul Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the association. :type description: str - :param data_collection_rule_id: Required. The resource ID of the data collection rule that is - to be associated. + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. :type data_collection_rule_id: str :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'data_collection_rule_id': {'required': True}, 'provisioning_state': {'readonly': True}, } @@ -258,16 +242,16 @@ class DataSourcesSpec(msrest.serialization.Model): """Specification of data sources that will be collected. :param performance_counters: The list of performance counter data source configurations. - :type performance_counters: list[~$(python-base- - namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :type performance_counters: + list[~$(python-base-namespace).v2019_11_01_preview.models.PerfCounterDataSource] :param windows_event_logs: The list of Windows Event Log data source configurations. - :type windows_event_logs: list[~$(python-base- - namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :type windows_event_logs: + list[~$(python-base-namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] :param syslog: The list of Syslog data source configurations. :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] :param extensions: The list of Azure VM extension data source configurations. - :type extensions: list[~$(python-base- - namespace).v2019_11_01_preview.models.ExtensionDataSource] + :type extensions: + list[~$(python-base-namespace).v2019_11_01_preview.models.ExtensionDataSource] """ _attribute_map = { @@ -293,16 +277,16 @@ class DataCollectionRuleDataSources(DataSourcesSpec): This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. :param performance_counters: The list of performance counter data source configurations. - :type performance_counters: list[~$(python-base- - namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :type performance_counters: + list[~$(python-base-namespace).v2019_11_01_preview.models.PerfCounterDataSource] :param windows_event_logs: The list of Windows Event Log data source configurations. - :type windows_event_logs: list[~$(python-base- - namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :type windows_event_logs: + list[~$(python-base-namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] :param syslog: The list of Syslog data source configurations. :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] :param extensions: The list of Azure VM extension data source configurations. - :type extensions: list[~$(python-base- - namespace).v2019_11_01_preview.models.ExtensionDataSource] + :type extensions: + list[~$(python-base-namespace).v2019_11_01_preview.models.ExtensionDataSource] """ _attribute_map = { @@ -323,16 +307,16 @@ class DestinationsSpec(msrest.serialization.Model): """Specification of destinations that can be used in data flows. :param log_analytics: List of Log Analytics destinations. - :type log_analytics: list[~$(python-base- - namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :type log_analytics: + list[~$(python-base-namespace).v2019_11_01_preview.models.LogAnalyticsDestination] :param azure_monitor_metrics: Azure Monitor Metrics destination. - :type azure_monitor_metrics: ~$(python-base- - namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + :type azure_monitor_metrics: + ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpecAzureMonitorMetrics """ _attribute_map = { 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, - 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, } def __init__( @@ -348,16 +332,16 @@ class DataCollectionRuleDestinations(DestinationsSpec): """The specification of destinations. :param log_analytics: List of Log Analytics destinations. - :type log_analytics: list[~$(python-base- - namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :type log_analytics: + list[~$(python-base-namespace).v2019_11_01_preview.models.LogAnalyticsDestination] :param azure_monitor_metrics: Azure Monitor Metrics destination. - :type azure_monitor_metrics: ~$(python-base- - namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + :type azure_monitor_metrics: + ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpecAzureMonitorMetrics """ _attribute_map = { 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, - 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, } def __init__( @@ -378,6 +362,9 @@ class DataCollectionRuleResource(msrest.serialization.Model): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param kind: The kind of the resource. Possible values include: "Linux", "Windows". + :type kind: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleResourceKind :ivar id: Fully qualified ID of the resource. :vartype id: str :ivar name: The name of the resource. @@ -388,18 +375,22 @@ class DataCollectionRuleResource(msrest.serialization.Model): :vartype etag: str :param description: Description of the data collection rule. :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str :param data_sources: The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec - :param destinations: Required. The specification of destinations. - :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec - :param data_flows: Required. The specification of data flows. + :type data_sources: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState """ _validation = { @@ -408,22 +399,22 @@ class DataCollectionRuleResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'description': {'max_length': 256, 'min_length': 0}, - 'destinations': {'required': True}, - 'data_flows': {'required': True}, + 'immutable_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, - 'data_sources': {'key': 'properties.dataSources', 'type': 'DataSourcesSpec'}, - 'destinations': {'key': 'properties.destinations', 'type': 'DestinationsSpec'}, + 'immutable_id': {'key': 'properties.immutableId', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'properties.destinations', 'type': 'DataCollectionRuleDestinations'}, 'data_flows': {'key': 'properties.dataFlows', 'type': '[DataFlow]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -435,14 +426,16 @@ def __init__( super(DataCollectionRuleResource, self).__init__(**kwargs) self.location = kwargs['location'] self.tags = kwargs.get('tags', None) + self.kind = kwargs.get('kind', None) self.id = None self.name = None self.type = None self.etag = None self.description = kwargs.get('description', None) + self.immutable_id = None self.data_sources = kwargs.get('data_sources', None) - self.destinations = kwargs['destinations'] - self.data_flows = kwargs['data_flows'] + self.destinations = kwargs.get('destinations', None) + self.data_flows = kwargs.get('data_flows', None) self.provisioning_state = None @@ -452,8 +445,8 @@ class DataCollectionRuleResourceListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param value: Required. A list of resources. - :type value: list[~$(python-base- - namespace).v2019_11_01_preview.models.DataCollectionRuleResource] + :type value: + list[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource] :param next_link: The URL to use for getting the next set of results. :type next_link: str """ @@ -481,35 +474,36 @@ class DataCollectionRuleResourceProperties(DataCollectionRule): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the data collection rule. :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str :param data_sources: The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec - :param destinations: Required. The specification of destinations. - :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec - :param data_flows: Required. The specification of data flows. + :type data_sources: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'destinations': {'required': True}, - 'data_flows': {'required': True}, + 'immutable_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, - 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, - 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } @@ -524,20 +518,13 @@ def __init__( class DataFlow(msrest.serialization.Model): """Definition of which streams are sent to which destinations. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams for this data flow. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataFlowStreams] - :param destinations: Required. List of destinations for this data flow. + :param streams: List of streams for this data flow. + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataFlowStreams] + :param destinations: List of destinations for this data flow. :type destinations: list[str] """ - _validation = { - 'streams': {'required': True}, - 'destinations': {'required': True}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, 'destinations': {'key': 'destinations', 'type': '[str]'}, @@ -548,25 +535,19 @@ def __init__( **kwargs ): super(DataFlow, self).__init__(**kwargs) - self.streams = kwargs['streams'] - self.destinations = kwargs['destinations'] + self.streams = kwargs.get('streams', None) + self.destinations = kwargs.get('destinations', None) class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): """Azure Monitor Metrics destination. - All required parameters must be populated in order to send to Azure. - - :param name: Required. A friendly name for the destination. + :param name: A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } @@ -579,14 +560,14 @@ def __init__( class ErrorAdditionalInfo(msrest.serialization.Model): - """Additional information for common error response. + """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -608,71 +589,22 @@ def __init__( self.info = None -class ErrorDetails(msrest.serialization.Model): - """Common error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code which can be used to programmatically identify the class of error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetails, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorDetailsAutoGenerated(msrest.serialization.Model): - """Common error details. +class ErrorDetail(msrest.serialization.Model): + """The error detail. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error code which can be used to programmatically identify the class of error. + :ivar code: The error code. :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. + :ivar message: The error message. :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). + :ivar target: The error target. :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -687,7 +619,7 @@ class ErrorDetailsAutoGenerated(msrest.serialization.Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } @@ -695,7 +627,7 @@ def __init__( self, **kwargs ): - super(ErrorDetailsAutoGenerated, self).__init__(**kwargs) + super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None self.target = None @@ -704,20 +636,14 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """Common error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error details. - :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails + :param error: The error object. + :type error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetail """ - _validation = { - 'error': {'readonly': True}, - } - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetails'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( @@ -725,117 +651,7 @@ def __init__( **kwargs ): super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class ErrorResponseError(ErrorDetailsAutoGenerated): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code which can be used to programmatically identify the class of error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseError, self).__init__(**kwargs) - - -class ErrorResponseAutoGenerated(msrest.serialization.Model): - """Common error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error details. - :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetailsAutoGenerated'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseAutoGenerated, self).__init__(**kwargs) - self.error = None - - -class ErrorResponseError(ErrorDetails): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code which can be used to programmatically identify the class of error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class ExtensionDataSource(msrest.serialization.Model): @@ -844,32 +660,33 @@ class ExtensionDataSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownExtensionDataSourceStreams] + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownExtensionDataSourceStreams] :param extension_name: Required. The name of the VM extension. :type extension_name: str :param extension_settings: The extension settings. The format is specific for particular extension. - :type extension_settings: object - :param name: Required. A friendly name for the data source. + :type extension_settings: any + :param input_data_sources: The list of data sources this extension needs data from. + :type input_data_sources: list[str] + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ _validation = { - 'streams': {'required': True}, - 'extension_name': {'required': True, 'max_length': 64, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + 'extension_name': {'required': True}, } _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, 'extension_name': {'key': 'extensionName', 'type': 'str'}, 'extension_settings': {'key': 'extensionSettings', 'type': 'object'}, + 'input_data_sources': {'key': 'inputDataSources', 'type': '[str]'}, 'name': {'key': 'name', 'type': 'str'}, } @@ -878,32 +695,35 @@ def __init__( **kwargs ): super(ExtensionDataSource, self).__init__(**kwargs) - self.streams = kwargs['streams'] + self.streams = kwargs.get('streams', None) self.extension_name = kwargs['extension_name'] self.extension_settings = kwargs.get('extension_settings', None) - self.name = kwargs['name'] + self.input_data_sources = kwargs.get('input_data_sources', None) + self.name = kwargs.get('name', None) class LogAnalyticsDestination(msrest.serialization.Model): """Log Analytics destination. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param workspace_resource_id: Required. The resource ID of the Log Analytics workspace. + :param workspace_resource_id: The resource ID of the Log Analytics workspace. :type workspace_resource_id: str - :param name: Required. A friendly name for the destination. + :ivar workspace_id: The Customer ID of the Log Analytics workspace. + :vartype workspace_id: str + :param name: A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the data collection rule. :type name: str """ _validation = { - 'workspace_resource_id': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + 'workspace_id': {'readonly': True}, } _attribute_map = { 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, } @@ -912,51 +732,36 @@ def __init__( **kwargs ): super(LogAnalyticsDestination, self).__init__(**kwargs) - self.workspace_resource_id = kwargs['workspace_resource_id'] - self.name = kwargs['name'] + self.workspace_resource_id = kwargs.get('workspace_resource_id', None) + self.workspace_id = None + self.name = kwargs.get('name', None) class PerfCounterDataSource(msrest.serialization.Model): """Definition of which performance counters will be collected and how they will be collected by this data collection rule. Collected from both Windows and Linux machines where the counter is present. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceStreams] - :param scheduled_transfer_period: Required. The interval between data uploads (scheduled - transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", - "PT30M", "PT60M". - :type scheduled_transfer_period: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceScheduledTransferPeriod - :param sampling_frequency_in_seconds: Required. The number of seconds between consecutive - counter measurements (samples). + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceStreams] + :param sampling_frequency_in_seconds: The number of seconds between consecutive counter + measurements (samples). :type sampling_frequency_in_seconds: int - :param counter_specifiers: Required. A list of specifier names of the performance counters you - want to collect. + :param counter_specifiers: A list of specifier names of the performance counters you want to + collect. Use a wildcard (*) to collect a counter for all instances. To get a list of performance counters on Windows, run the command 'typeperf'. :type counter_specifiers: list[str] - :param name: Required. A friendly name for the data source. + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'streams': {'required': True}, - 'scheduled_transfer_period': {'required': True}, - 'sampling_frequency_in_seconds': {'required': True, 'maximum': 30, 'minimum': 1}, - 'counter_specifiers': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, - 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, 'sampling_frequency_in_seconds': {'key': 'samplingFrequencyInSeconds', 'type': 'int'}, 'counter_specifiers': {'key': 'counterSpecifiers', 'type': '[str]'}, 'name': {'key': 'name', 'type': 'str'}, @@ -967,11 +772,10 @@ def __init__( **kwargs ): super(PerfCounterDataSource, self).__init__(**kwargs) - self.streams = kwargs['streams'] - self.scheduled_transfer_period = kwargs['scheduled_transfer_period'] - self.sampling_frequency_in_seconds = kwargs['sampling_frequency_in_seconds'] - self.counter_specifiers = kwargs['counter_specifiers'] - self.name = kwargs['name'] + self.streams = kwargs.get('streams', None) + self.sampling_frequency_in_seconds = kwargs.get('sampling_frequency_in_seconds', None) + self.counter_specifiers = kwargs.get('counter_specifiers', None) + self.name = kwargs.get('name', None) class ResourceForUpdate(msrest.serialization.Model): @@ -997,31 +801,23 @@ class SyslogDataSource(msrest.serialization.Model): """Definition of which syslog data will be collected and how it will be collected. Only collected from Linux machines. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownSyslogDataSourceStreams] - :param facility_names: Required. The list of facility names. - :type facility_names: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownSyslogDataSourceFacilityNames] + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownSyslogDataSourceStreams] + :param facility_names: The list of facility names. + :type facility_names: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownSyslogDataSourceFacilityNames] :param log_levels: The log levels to collect. - :type log_levels: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownSyslogDataSourceLogLevels] - :param name: Required. A friendly name for the data source. + :type log_levels: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownSyslogDataSourceLogLevels] + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'streams': {'required': True}, - 'facility_names': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, 'facility_names': {'key': 'facilityNames', 'type': '[str]'}, @@ -1034,46 +830,31 @@ def __init__( **kwargs ): super(SyslogDataSource, self).__init__(**kwargs) - self.streams = kwargs['streams'] - self.facility_names = kwargs['facility_names'] + self.streams = kwargs.get('streams', None) + self.facility_names = kwargs.get('facility_names', None) self.log_levels = kwargs.get('log_levels', None) - self.name = kwargs['name'] + self.name = kwargs.get('name', None) class WindowsEventLogDataSource(msrest.serialization.Model): """Definition of which Windows Event Log events will be collected and how they will be collected. Only collected from Windows machines. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceStreams] - :param scheduled_transfer_period: Required. The interval between data uploads (scheduled - transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", - "PT30M", "PT60M". - :type scheduled_transfer_period: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceScheduledTransferPeriod - :param x_path_queries: Required. A list of Windows Event Log queries in XPATH format. + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceStreams] + :param x_path_queries: A list of Windows Event Log queries in XPATH format. :type x_path_queries: list[str] - :param name: Required. A friendly name for the data source. + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'streams': {'required': True}, - 'scheduled_transfer_period': {'required': True}, - 'x_path_queries': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, - 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, 'x_path_queries': {'key': 'xPathQueries', 'type': '[str]'}, 'name': {'key': 'name', 'type': 'str'}, } @@ -1083,7 +864,6 @@ def __init__( **kwargs ): super(WindowsEventLogDataSource, self).__init__(**kwargs) - self.streams = kwargs['streams'] - self.scheduled_transfer_period = kwargs['scheduled_transfer_period'] - self.x_path_queries = kwargs['x_path_queries'] - self.name = kwargs['name'] + self.streams = kwargs.get('streams', None) + self.x_path_queries = kwargs.get('x_path_queries', None) + self.name = kwargs.get('name', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py index e3fcfe85a32a7..44aff14895f6d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_models_py3.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -17,18 +17,12 @@ class AzureMonitorMetricsDestination(msrest.serialization.Model): """Azure Monitor Metrics destination. - All required parameters must be populated in order to send to Azure. - - :param name: Required. A friendly name for the destination. + :param name: A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } @@ -36,7 +30,7 @@ class AzureMonitorMetricsDestination(msrest.serialization.Model): def __init__( self, *, - name: str, + name: Optional[str] = None, **kwargs ): super(AzureMonitorMetricsDestination, self).__init__(**kwargs) @@ -48,35 +42,36 @@ class DataCollectionRule(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the data collection rule. :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str :param data_sources: The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec - :param destinations: Required. The specification of destinations. - :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec - :param data_flows: Required. The specification of data flows. + :type data_sources: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'destinations': {'required': True}, - 'data_flows': {'required': True}, + 'immutable_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, - 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, - 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } @@ -84,14 +79,15 @@ class DataCollectionRule(msrest.serialization.Model): def __init__( self, *, - destinations: "DestinationsSpec", - data_flows: List["DataFlow"], description: Optional[str] = None, - data_sources: Optional["DataSourcesSpec"] = None, + data_sources: Optional["DataCollectionRuleDataSources"] = None, + destinations: Optional["DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["DataFlow"]] = None, **kwargs ): super(DataCollectionRule, self).__init__(**kwargs) self.description = description + self.immutable_id = None self.data_sources = data_sources self.destinations = destinations self.data_flows = data_flows @@ -103,22 +99,18 @@ class DataCollectionRuleAssociation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the association. :type description: str - :param data_collection_rule_id: Required. The resource ID of the data collection rule that is - to be associated. + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. :type data_collection_rule_id: str :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'data_collection_rule_id': {'required': True}, 'provisioning_state': {'readonly': True}, } @@ -131,8 +123,8 @@ class DataCollectionRuleAssociation(msrest.serialization.Model): def __init__( self, *, - data_collection_rule_id: str, description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, **kwargs ): super(DataCollectionRuleAssociation, self).__init__(**kwargs) @@ -146,8 +138,6 @@ class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model) Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified ID of the resource. :vartype id: str :ivar name: The name of the resource. @@ -158,13 +148,13 @@ class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model) :vartype etag: str :param description: Description of the association. :type description: str - :param data_collection_rule_id: Required. The resource ID of the data collection rule that is - to be associated. + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. :type data_collection_rule_id: str :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState """ _validation = { @@ -172,8 +162,6 @@ class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model) 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'description': {'max_length': 256, 'min_length': 0}, - 'data_collection_rule_id': {'required': True}, 'provisioning_state': {'readonly': True}, } @@ -190,8 +178,8 @@ class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model) def __init__( self, *, - data_collection_rule_id: str, description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, **kwargs ): super(DataCollectionRuleAssociationProxyOnlyResource, self).__init__(**kwargs) @@ -210,8 +198,8 @@ class DataCollectionRuleAssociationProxyOnlyResourceListResult(msrest.serializat All required parameters must be populated in order to send to Azure. :param value: Required. A list of resources. - :type value: list[~$(python-base- - namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource] + :type value: + list[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource] :param next_link: The URL to use for getting the next set of results. :type next_link: str """ @@ -242,22 +230,18 @@ class DataCollectionRuleAssociationProxyOnlyResourceProperties(DataCollectionRul Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the association. :type description: str - :param data_collection_rule_id: Required. The resource ID of the data collection rule that is - to be associated. + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. :type data_collection_rule_id: str :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleAssociationProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'data_collection_rule_id': {'required': True}, 'provisioning_state': {'readonly': True}, } @@ -270,8 +254,8 @@ class DataCollectionRuleAssociationProxyOnlyResourceProperties(DataCollectionRul def __init__( self, *, - data_collection_rule_id: str, description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, **kwargs ): super(DataCollectionRuleAssociationProxyOnlyResourceProperties, self).__init__(description=description, data_collection_rule_id=data_collection_rule_id, **kwargs) @@ -281,16 +265,16 @@ class DataSourcesSpec(msrest.serialization.Model): """Specification of data sources that will be collected. :param performance_counters: The list of performance counter data source configurations. - :type performance_counters: list[~$(python-base- - namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :type performance_counters: + list[~$(python-base-namespace).v2019_11_01_preview.models.PerfCounterDataSource] :param windows_event_logs: The list of Windows Event Log data source configurations. - :type windows_event_logs: list[~$(python-base- - namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :type windows_event_logs: + list[~$(python-base-namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] :param syslog: The list of Syslog data source configurations. :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] :param extensions: The list of Azure VM extension data source configurations. - :type extensions: list[~$(python-base- - namespace).v2019_11_01_preview.models.ExtensionDataSource] + :type extensions: + list[~$(python-base-namespace).v2019_11_01_preview.models.ExtensionDataSource] """ _attribute_map = { @@ -321,16 +305,16 @@ class DataCollectionRuleDataSources(DataSourcesSpec): This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. :param performance_counters: The list of performance counter data source configurations. - :type performance_counters: list[~$(python-base- - namespace).v2019_11_01_preview.models.PerfCounterDataSource] + :type performance_counters: + list[~$(python-base-namespace).v2019_11_01_preview.models.PerfCounterDataSource] :param windows_event_logs: The list of Windows Event Log data source configurations. - :type windows_event_logs: list[~$(python-base- - namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] + :type windows_event_logs: + list[~$(python-base-namespace).v2019_11_01_preview.models.WindowsEventLogDataSource] :param syslog: The list of Syslog data source configurations. :type syslog: list[~$(python-base-namespace).v2019_11_01_preview.models.SyslogDataSource] :param extensions: The list of Azure VM extension data source configurations. - :type extensions: list[~$(python-base- - namespace).v2019_11_01_preview.models.ExtensionDataSource] + :type extensions: + list[~$(python-base-namespace).v2019_11_01_preview.models.ExtensionDataSource] """ _attribute_map = { @@ -356,23 +340,23 @@ class DestinationsSpec(msrest.serialization.Model): """Specification of destinations that can be used in data flows. :param log_analytics: List of Log Analytics destinations. - :type log_analytics: list[~$(python-base- - namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :type log_analytics: + list[~$(python-base-namespace).v2019_11_01_preview.models.LogAnalyticsDestination] :param azure_monitor_metrics: Azure Monitor Metrics destination. - :type azure_monitor_metrics: ~$(python-base- - namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + :type azure_monitor_metrics: + ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpecAzureMonitorMetrics """ _attribute_map = { 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, - 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, } def __init__( self, *, log_analytics: Optional[List["LogAnalyticsDestination"]] = None, - azure_monitor_metrics: Optional["AzureMonitorMetricsDestination"] = None, + azure_monitor_metrics: Optional["DestinationsSpecAzureMonitorMetrics"] = None, **kwargs ): super(DestinationsSpec, self).__init__(**kwargs) @@ -384,23 +368,23 @@ class DataCollectionRuleDestinations(DestinationsSpec): """The specification of destinations. :param log_analytics: List of Log Analytics destinations. - :type log_analytics: list[~$(python-base- - namespace).v2019_11_01_preview.models.LogAnalyticsDestination] + :type log_analytics: + list[~$(python-base-namespace).v2019_11_01_preview.models.LogAnalyticsDestination] :param azure_monitor_metrics: Azure Monitor Metrics destination. - :type azure_monitor_metrics: ~$(python-base- - namespace).v2019_11_01_preview.models.AzureMonitorMetricsDestination + :type azure_monitor_metrics: + ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpecAzureMonitorMetrics """ _attribute_map = { 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, - 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'AzureMonitorMetricsDestination'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, } def __init__( self, *, log_analytics: Optional[List["LogAnalyticsDestination"]] = None, - azure_monitor_metrics: Optional["AzureMonitorMetricsDestination"] = None, + azure_monitor_metrics: Optional["DestinationsSpecAzureMonitorMetrics"] = None, **kwargs ): super(DataCollectionRuleDestinations, self).__init__(log_analytics=log_analytics, azure_monitor_metrics=azure_monitor_metrics, **kwargs) @@ -417,6 +401,9 @@ class DataCollectionRuleResource(msrest.serialization.Model): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :param kind: The kind of the resource. Possible values include: "Linux", "Windows". + :type kind: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleResourceKind :ivar id: Fully qualified ID of the resource. :vartype id: str :ivar name: The name of the resource. @@ -427,18 +414,22 @@ class DataCollectionRuleResource(msrest.serialization.Model): :vartype etag: str :param description: Description of the data collection rule. :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str :param data_sources: The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec - :param destinations: Required. The specification of destinations. - :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec - :param data_flows: Required. The specification of data flows. + :type data_sources: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState """ _validation = { @@ -447,22 +438,22 @@ class DataCollectionRuleResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, - 'description': {'max_length': 256, 'min_length': 0}, - 'destinations': {'required': True}, - 'data_flows': {'required': True}, + 'immutable_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, - 'data_sources': {'key': 'properties.dataSources', 'type': 'DataSourcesSpec'}, - 'destinations': {'key': 'properties.destinations', 'type': 'DestinationsSpec'}, + 'immutable_id': {'key': 'properties.immutableId', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'properties.destinations', 'type': 'DataCollectionRuleDestinations'}, 'data_flows': {'key': 'properties.dataFlows', 'type': '[DataFlow]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -471,21 +462,24 @@ def __init__( self, *, location: str, - destinations: "DestinationsSpec", - data_flows: List["DataFlow"], tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "KnownDataCollectionRuleResourceKind"]] = None, description: Optional[str] = None, - data_sources: Optional["DataSourcesSpec"] = None, + data_sources: Optional["DataCollectionRuleDataSources"] = None, + destinations: Optional["DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["DataFlow"]] = None, **kwargs ): super(DataCollectionRuleResource, self).__init__(**kwargs) self.location = location self.tags = tags + self.kind = kind self.id = None self.name = None self.type = None self.etag = None self.description = description + self.immutable_id = None self.data_sources = data_sources self.destinations = destinations self.data_flows = data_flows @@ -498,8 +492,8 @@ class DataCollectionRuleResourceListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param value: Required. A list of resources. - :type value: list[~$(python-base- - namespace).v2019_11_01_preview.models.DataCollectionRuleResource] + :type value: + list[~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleResource] :param next_link: The URL to use for getting the next set of results. :type next_link: str """ @@ -530,35 +524,36 @@ class DataCollectionRuleResourceProperties(DataCollectionRule): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param description: Description of the data collection rule. :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str :param data_sources: The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - :type data_sources: ~$(python-base-namespace).v2019_11_01_preview.models.DataSourcesSpec - :param destinations: Required. The specification of destinations. - :type destinations: ~$(python-base-namespace).v2019_11_01_preview.models.DestinationsSpec - :param data_flows: Required. The specification of data flows. + :type data_sources: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: + ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. :type data_flows: list[~$(python-base-namespace).v2019_11_01_preview.models.DataFlow] :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState + :vartype provisioning_state: str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataCollectionRuleProvisioningState """ _validation = { - 'description': {'max_length': 256, 'min_length': 0}, - 'destinations': {'required': True}, - 'data_flows': {'required': True}, + 'immutable_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, - 'data_sources': {'key': 'dataSources', 'type': 'DataSourcesSpec'}, - 'destinations': {'key': 'destinations', 'type': 'DestinationsSpec'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } @@ -566,10 +561,10 @@ class DataCollectionRuleResourceProperties(DataCollectionRule): def __init__( self, *, - destinations: "DestinationsSpec", - data_flows: List["DataFlow"], description: Optional[str] = None, - data_sources: Optional["DataSourcesSpec"] = None, + data_sources: Optional["DataCollectionRuleDataSources"] = None, + destinations: Optional["DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["DataFlow"]] = None, **kwargs ): super(DataCollectionRuleResourceProperties, self).__init__(description=description, data_sources=data_sources, destinations=destinations, data_flows=data_flows, **kwargs) @@ -578,20 +573,13 @@ def __init__( class DataFlow(msrest.serialization.Model): """Definition of which streams are sent to which destinations. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams for this data flow. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownDataFlowStreams] - :param destinations: Required. List of destinations for this data flow. + :param streams: List of streams for this data flow. + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownDataFlowStreams] + :param destinations: List of destinations for this data flow. :type destinations: list[str] """ - _validation = { - 'streams': {'required': True}, - 'destinations': {'required': True}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, 'destinations': {'key': 'destinations', 'type': '[str]'}, @@ -600,8 +588,8 @@ class DataFlow(msrest.serialization.Model): def __init__( self, *, - streams: List[Union[str, "KnownDataFlowStreams"]], - destinations: List[str], + streams: Optional[List[Union[str, "KnownDataFlowStreams"]]] = None, + destinations: Optional[List[str]] = None, **kwargs ): super(DataFlow, self).__init__(**kwargs) @@ -612,18 +600,12 @@ def __init__( class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): """Azure Monitor Metrics destination. - All required parameters must be populated in order to send to Azure. - - :param name: Required. A friendly name for the destination. + :param name: A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, } @@ -631,21 +613,21 @@ class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): def __init__( self, *, - name: str, + name: Optional[str] = None, **kwargs ): super(DestinationsSpecAzureMonitorMetrics, self).__init__(name=name, **kwargs) class ErrorAdditionalInfo(msrest.serialization.Model): - """Additional information for common error response. + """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -667,23 +649,22 @@ def __init__( self.info = None -class ErrorDetails(msrest.serialization.Model): - """Common error details. +class ErrorDetail(msrest.serialization.Model): + """The error detail. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error code which can be used to programmatically identify the class of error. + :ivar code: The error code. :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. + :ivar message: The error message. :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). + :ivar target: The error target. :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -698,7 +679,7 @@ class ErrorDetails(msrest.serialization.Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } @@ -706,55 +687,7 @@ def __init__( self, **kwargs ): - super(ErrorDetails, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorDetailsAutoGenerated(msrest.serialization.Model): - """Common error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code which can be used to programmatically identify the class of error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetailsAutoGenerated, self).__init__(**kwargs) + super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None self.target = None @@ -763,138 +696,24 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """Common error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error details. - :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails + :param error: The error object. + :type error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetail """ - _validation = { - 'error': {'readonly': True}, - } - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetails'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, + *, + error: Optional["ErrorDetail"] = None, **kwargs ): super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class ErrorResponseError(ErrorDetailsAutoGenerated): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code which can be used to programmatically identify the class of error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseError, self).__init__(**kwargs) - - -class ErrorResponseAutoGenerated(msrest.serialization.Model): - """Common error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error details. - :vartype error: ~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetailsAutoGenerated'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseAutoGenerated, self).__init__(**kwargs) - self.error = None - - -class ErrorResponseError(ErrorDetails): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code which can be used to programmatically identify the class of error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] - :ivar additional_info: Additional error information. - :vartype additional_info: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseError, self).__init__(**kwargs) + self.error = error class ExtensionDataSource(msrest.serialization.Model): @@ -903,83 +722,89 @@ class ExtensionDataSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownExtensionDataSourceStreams] + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownExtensionDataSourceStreams] :param extension_name: Required. The name of the VM extension. :type extension_name: str :param extension_settings: The extension settings. The format is specific for particular extension. - :type extension_settings: object - :param name: Required. A friendly name for the data source. + :type extension_settings: any + :param input_data_sources: The list of data sources this extension needs data from. + :type input_data_sources: list[str] + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ _validation = { - 'streams': {'required': True}, - 'extension_name': {'required': True, 'max_length': 64, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + 'extension_name': {'required': True}, } _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, 'extension_name': {'key': 'extensionName', 'type': 'str'}, 'extension_settings': {'key': 'extensionSettings', 'type': 'object'}, + 'input_data_sources': {'key': 'inputDataSources', 'type': '[str]'}, 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, *, - streams: List[Union[str, "KnownExtensionDataSourceStreams"]], extension_name: str, - name: str, - extension_settings: Optional[object] = None, + streams: Optional[List[Union[str, "KnownExtensionDataSourceStreams"]]] = None, + extension_settings: Optional[Any] = None, + input_data_sources: Optional[List[str]] = None, + name: Optional[str] = None, **kwargs ): super(ExtensionDataSource, self).__init__(**kwargs) self.streams = streams self.extension_name = extension_name self.extension_settings = extension_settings + self.input_data_sources = input_data_sources self.name = name class LogAnalyticsDestination(msrest.serialization.Model): """Log Analytics destination. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param workspace_resource_id: Required. The resource ID of the Log Analytics workspace. + :param workspace_resource_id: The resource ID of the Log Analytics workspace. :type workspace_resource_id: str - :param name: Required. A friendly name for the destination. + :ivar workspace_id: The Customer ID of the Log Analytics workspace. + :vartype workspace_id: str + :param name: A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the data collection rule. :type name: str """ _validation = { - 'workspace_resource_id': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, + 'workspace_id': {'readonly': True}, } _attribute_map = { 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, *, - workspace_resource_id: str, - name: str, + workspace_resource_id: Optional[str] = None, + name: Optional[str] = None, **kwargs ): super(LogAnalyticsDestination, self).__init__(**kwargs) self.workspace_resource_id = workspace_resource_id + self.workspace_id = None self.name = name @@ -987,43 +812,27 @@ class PerfCounterDataSource(msrest.serialization.Model): """Definition of which performance counters will be collected and how they will be collected by this data collection rule. Collected from both Windows and Linux machines where the counter is present. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceStreams] - :param scheduled_transfer_period: Required. The interval between data uploads (scheduled - transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", - "PT30M", "PT60M". - :type scheduled_transfer_period: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceScheduledTransferPeriod - :param sampling_frequency_in_seconds: Required. The number of seconds between consecutive - counter measurements (samples). + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownPerfCounterDataSourceStreams] + :param sampling_frequency_in_seconds: The number of seconds between consecutive counter + measurements (samples). :type sampling_frequency_in_seconds: int - :param counter_specifiers: Required. A list of specifier names of the performance counters you - want to collect. + :param counter_specifiers: A list of specifier names of the performance counters you want to + collect. Use a wildcard (*) to collect a counter for all instances. To get a list of performance counters on Windows, run the command 'typeperf'. :type counter_specifiers: list[str] - :param name: Required. A friendly name for the data source. + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'streams': {'required': True}, - 'scheduled_transfer_period': {'required': True}, - 'sampling_frequency_in_seconds': {'required': True, 'maximum': 30, 'minimum': 1}, - 'counter_specifiers': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, - 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, 'sampling_frequency_in_seconds': {'key': 'samplingFrequencyInSeconds', 'type': 'int'}, 'counter_specifiers': {'key': 'counterSpecifiers', 'type': '[str]'}, 'name': {'key': 'name', 'type': 'str'}, @@ -1032,16 +841,14 @@ class PerfCounterDataSource(msrest.serialization.Model): def __init__( self, *, - streams: List[Union[str, "KnownPerfCounterDataSourceStreams"]], - scheduled_transfer_period: Union[str, "KnownPerfCounterDataSourceScheduledTransferPeriod"], - sampling_frequency_in_seconds: int, - counter_specifiers: List[str], - name: str, + streams: Optional[List[Union[str, "KnownPerfCounterDataSourceStreams"]]] = None, + sampling_frequency_in_seconds: Optional[int] = None, + counter_specifiers: Optional[List[str]] = None, + name: Optional[str] = None, **kwargs ): super(PerfCounterDataSource, self).__init__(**kwargs) self.streams = streams - self.scheduled_transfer_period = scheduled_transfer_period self.sampling_frequency_in_seconds = sampling_frequency_in_seconds self.counter_specifiers = counter_specifiers self.name = name @@ -1072,31 +879,23 @@ class SyslogDataSource(msrest.serialization.Model): """Definition of which syslog data will be collected and how it will be collected. Only collected from Linux machines. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownSyslogDataSourceStreams] - :param facility_names: Required. The list of facility names. - :type facility_names: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownSyslogDataSourceFacilityNames] + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownSyslogDataSourceStreams] + :param facility_names: The list of facility names. + :type facility_names: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownSyslogDataSourceFacilityNames] :param log_levels: The log levels to collect. - :type log_levels: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownSyslogDataSourceLogLevels] - :param name: Required. A friendly name for the data source. + :type log_levels: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownSyslogDataSourceLogLevels] + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'streams': {'required': True}, - 'facility_names': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, 'facility_names': {'key': 'facilityNames', 'type': '[str]'}, @@ -1107,10 +906,10 @@ class SyslogDataSource(msrest.serialization.Model): def __init__( self, *, - streams: List[Union[str, "KnownSyslogDataSourceStreams"]], - facility_names: List[Union[str, "KnownSyslogDataSourceFacilityNames"]], - name: str, + streams: Optional[List[Union[str, "KnownSyslogDataSourceStreams"]]] = None, + facility_names: Optional[List[Union[str, "KnownSyslogDataSourceFacilityNames"]]] = None, log_levels: Optional[List[Union[str, "KnownSyslogDataSourceLogLevels"]]] = None, + name: Optional[str] = None, **kwargs ): super(SyslogDataSource, self).__init__(**kwargs) @@ -1124,36 +923,21 @@ class WindowsEventLogDataSource(msrest.serialization.Model): """Definition of which Windows Event Log events will be collected and how they will be collected. Only collected from Windows machines. - All required parameters must be populated in order to send to Azure. - - :param streams: Required. List of streams that this data source will be sent to. + :param streams: List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - :type streams: list[str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceStreams] - :param scheduled_transfer_period: Required. The interval between data uploads (scheduled - transfers), rounded up to the nearest minute. Possible values include: "PT1M", "PT5M", "PT15M", - "PT30M", "PT60M". - :type scheduled_transfer_period: str or ~$(python-base- - namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceScheduledTransferPeriod - :param x_path_queries: Required. A list of Windows Event Log queries in XPATH format. + :type streams: list[str or + ~$(python-base-namespace).v2019_11_01_preview.models.KnownWindowsEventLogDataSourceStreams] + :param x_path_queries: A list of Windows Event Log queries in XPATH format. :type x_path_queries: list[str] - :param name: Required. A friendly name for the data source. + :param name: A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the data collection rule. :type name: str """ - _validation = { - 'streams': {'required': True}, - 'scheduled_transfer_period': {'required': True}, - 'x_path_queries': {'required': True}, - 'name': {'required': True, 'max_length': 32, 'min_length': 0, 'pattern': r'^[-\w\._\(\)]+$'}, - } - _attribute_map = { 'streams': {'key': 'streams', 'type': '[str]'}, - 'scheduled_transfer_period': {'key': 'scheduledTransferPeriod', 'type': 'str'}, 'x_path_queries': {'key': 'xPathQueries', 'type': '[str]'}, 'name': {'key': 'name', 'type': 'str'}, } @@ -1161,14 +945,12 @@ class WindowsEventLogDataSource(msrest.serialization.Model): def __init__( self, *, - streams: List[Union[str, "KnownWindowsEventLogDataSourceStreams"]], - scheduled_transfer_period: Union[str, "KnownWindowsEventLogDataSourceScheduledTransferPeriod"], - x_path_queries: List[str], - name: str, + streams: Optional[List[Union[str, "KnownWindowsEventLogDataSourceStreams"]]] = None, + x_path_queries: Optional[List[str]] = None, + name: Optional[str] = None, **kwargs ): super(WindowsEventLogDataSource, self).__init__(**kwargs) self.streams = streams - self.scheduled_transfer_period = scheduled_transfer_period self.x_path_queries = x_path_queries self.name = name diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_management_client_enums.py index 2308243d3ed4e..251ddeea0a23b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_management_client_enums.py @@ -46,62 +46,29 @@ class KnownDataCollectionRuleProvisioningState(with_metaclass(_CaseInsensitiveEn SUCCEEDED = "Succeeded" FAILED = "Failed" +class KnownDataCollectionRuleResourceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The kind of the resource. + """ + + LINUX = "Linux" + WINDOWS = "Windows" + class KnownDataFlowStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - MICROSOFT_ANTI_MALWARE_STATUS = "Microsoft-AntiMalwareStatus" - MICROSOFT_AUDITD = "Microsoft-Auditd" - MICROSOFT_CISCOASA = "Microsoft-CISCOASA" - MICROSOFT_COMMON_SECURITY_LOG = "Microsoft-CommonSecurityLog" - MICROSOFT_COMPUTER_GROUP = "Microsoft-ComputerGroup" MICROSOFT_EVENT = "Microsoft-Event" - MICROSOFT_FIREWALL_LOG = "Microsoft-FirewallLog" - MICROSOFT_HEALTH_STATE_CHANGE = "Microsoft-HealthStateChange" - MICROSOFT_HEARTBEAT = "Microsoft-Heartbeat" MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" - MICROSOFT_OPERATION_LOG = "Microsoft-OperationLog" MICROSOFT_PERF = "Microsoft-Perf" - MICROSOFT_PROCESS_INVESTIGATOR = "Microsoft-ProcessInvestigator" - MICROSOFT_PROTECTION_STATUS = "Microsoft-ProtectionStatus" - MICROSOFT_ROME_DETECTION_EVENT = "Microsoft-RomeDetectionEvent" - MICROSOFT_SECURITY_BASELINE = "Microsoft-SecurityBaseline" - MICROSOFT_SECURITY_BASELINE_SUMMARY = "Microsoft-SecurityBaselineSummary" - MICROSOFT_SECURITY_EVENT = "Microsoft-SecurityEvent" MICROSOFT_SYSLOG = "Microsoft-Syslog" MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" class KnownExtensionDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - MICROSOFT_ANTI_MALWARE_STATUS = "Microsoft-AntiMalwareStatus" - MICROSOFT_AUDITD = "Microsoft-Auditd" - MICROSOFT_CISCOASA = "Microsoft-CISCOASA" - MICROSOFT_COMMON_SECURITY_LOG = "Microsoft-CommonSecurityLog" - MICROSOFT_COMPUTER_GROUP = "Microsoft-ComputerGroup" MICROSOFT_EVENT = "Microsoft-Event" - MICROSOFT_FIREWALL_LOG = "Microsoft-FirewallLog" - MICROSOFT_HEALTH_STATE_CHANGE = "Microsoft-HealthStateChange" - MICROSOFT_HEARTBEAT = "Microsoft-Heartbeat" MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" - MICROSOFT_OPERATION_LOG = "Microsoft-OperationLog" MICROSOFT_PERF = "Microsoft-Perf" - MICROSOFT_PROCESS_INVESTIGATOR = "Microsoft-ProcessInvestigator" - MICROSOFT_PROTECTION_STATUS = "Microsoft-ProtectionStatus" - MICROSOFT_ROME_DETECTION_EVENT = "Microsoft-RomeDetectionEvent" - MICROSOFT_SECURITY_BASELINE = "Microsoft-SecurityBaseline" - MICROSOFT_SECURITY_BASELINE_SUMMARY = "Microsoft-SecurityBaselineSummary" - MICROSOFT_SECURITY_EVENT = "Microsoft-SecurityEvent" MICROSOFT_SYSLOG = "Microsoft-Syslog" MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" -class KnownPerfCounterDataSourceScheduledTransferPeriod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The interval between data uploads (scheduled transfers), rounded up to the nearest minute. - """ - - PT1_M = "PT1M" - PT5_M = "PT5M" - PT15_M = "PT15M" - PT30_M = "PT30M" - PT60_M = "PT60M" - class KnownPerfCounterDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_PERF = "Microsoft-Perf" @@ -120,7 +87,7 @@ class KnownSyslogDataSourceFacilityNames(with_metaclass(_CaseInsensitiveEnumMeta NEWS = "news" SYSLOG = "syslog" USER = "user" - UUCP = "UUCP" + UUCP = "uucp" LOCAL0 = "local0" LOCAL1 = "local1" LOCAL2 = "local2" @@ -129,6 +96,7 @@ class KnownSyslogDataSourceFacilityNames(with_metaclass(_CaseInsensitiveEnumMeta LOCAL5 = "local5" LOCAL6 = "local6" LOCAL7 = "local7" + ASTERISK = "*" class KnownSyslogDataSourceLogLevels(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): @@ -140,21 +108,12 @@ class KnownSyslogDataSourceLogLevels(with_metaclass(_CaseInsensitiveEnumMeta, st CRITICAL = "Critical" ALERT = "Alert" EMERGENCY = "Emergency" + ASTERISK = "*" class KnownSyslogDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_SYSLOG = "Microsoft-Syslog" -class KnownWindowsEventLogDataSourceScheduledTransferPeriod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The interval between data uploads (scheduled transfers), rounded up to the nearest minute. - """ - - PT1_M = "PT1M" - PT5_M = "PT5M" - PT15_M = "PT15M" - PT30_M = "PT30M" - PT60_M = "PT60M" - class KnownWindowsEventLogDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py index 7217c7daf6436..f7feadebaa83d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rule_associations_operations.py @@ -107,7 +107,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -157,8 +157,8 @@ def prepare_request(next_link=None): url = self.list_by_rule.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -186,7 +186,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -210,7 +210,7 @@ def get( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param association_name: The name of the association. + :param association_name: The name of the association. The name is case insensitive. :type association_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) @@ -229,7 +229,7 @@ def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), - 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'associationName': self._serialize.url("association_name", association_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -247,7 +247,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) @@ -272,7 +272,7 @@ def create( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param association_name: The name of the association. + :param association_name: The name of the association. The name is case insensitive. :type association_name: str :param body: The payload. :type body: ~$(python-base-namespace).v2019_11_01_preview.models.DataCollectionRuleAssociationProxyOnlyResource @@ -294,7 +294,7 @@ def create( url = self.create.metadata['url'] # type: ignore path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), - 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'associationName': self._serialize.url("association_name", association_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -319,7 +319,7 @@ def create( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -347,7 +347,7 @@ def delete( :param resource_uri: The identifier of the resource. :type resource_uri: str - :param association_name: The name of the association. + :param association_name: The name of the association. The name is case insensitive. :type association_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -366,7 +366,7 @@ def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), - 'associationName': self._serialize.url("association_name", association_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'associationName': self._serialize.url("association_name", association_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -384,7 +384,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py index 9f555f1455d12..c7a2fca7f84dd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/operations/_data_collection_rules_operations.py @@ -80,7 +80,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -108,7 +108,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -178,7 +178,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -222,8 +222,8 @@ def get( url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -241,7 +241,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) @@ -289,8 +289,8 @@ def create( url = self.create.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -315,7 +315,7 @@ def create( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -367,8 +367,8 @@ def update( url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -393,7 +393,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) @@ -437,8 +437,8 @@ def delete( url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -456,7 +456,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py index 576b2cc745890..0c4c839c67519 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json index b5d267fb35a74..724484160644d 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -22,7 +24,7 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -30,20 +32,60 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "management_group_diagnostic_settings": "ManagementGroupDiagnosticSettingsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py index c3d1b9f772ef4..35801d7fac263 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ManagementGroupDiagnosticSettingsOperations @@ -52,6 +53,21 @@ def __init__( self.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py index 014f28055b135..91dce6198f597 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py index 2f7456674d928..1b9308541bdfa 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -49,6 +50,20 @@ def __init__( self.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py index 8ee8b141d0128..2ff71bcf89fb9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py @@ -45,7 +45,7 @@ async def get( self, management_group_id: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.ManagementGroupDiagnosticSettingsResource": """Gets the active management group diagnostic settings for the specified resource. @@ -88,7 +88,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -104,7 +104,7 @@ async def create_or_update( management_group_id: str, name: str, parameters: "_models.ManagementGroupDiagnosticSettingsResource", - **kwargs + **kwargs: Any ) -> "_models.ManagementGroupDiagnosticSettingsResource": """Creates or updates management group diagnostic settings for the specified resource. @@ -154,7 +154,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -169,7 +169,7 @@ async def delete( self, management_group_id: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes existing management group diagnostic settings for the specified resource. @@ -212,7 +212,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -223,7 +223,7 @@ async def delete( def list( self, management_group_id: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ManagementGroupDiagnosticSettingsResourceCollection"]: """Gets the active management group diagnostic settings list for the specified management group. @@ -279,7 +279,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py index f0ecc19cab410..5715644ceb01e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py @@ -97,12 +97,11 @@ class ManagementGroupDiagnosticSettingsResource(ManagementGroupProxyOnlyResource will be selected. :type event_hub_name: str :param logs: The list of logs settings. - :type logs: list[~$(python-base- - namespace).v2020_01_01_preview.models.ManagementGroupLogSettings] + :type logs: + list[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupLogSettings] :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -142,8 +141,8 @@ class ManagementGroupDiagnosticSettingsResourceCollection(msrest.serialization.M """Represents a collection of management group diagnostic settings resources. :param value: The collection of management group diagnostic settings resources. - :type value: list[~$(python-base- - namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource] """ _attribute_map = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py index 47525123592b7..64fb6dadc29aa 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py @@ -104,12 +104,11 @@ class ManagementGroupDiagnosticSettingsResource(ManagementGroupProxyOnlyResource will be selected. :type event_hub_name: str :param logs: The list of logs settings. - :type logs: list[~$(python-base- - namespace).v2020_01_01_preview.models.ManagementGroupLogSettings] + :type logs: + list[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupLogSettings] :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- - integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. :type workspace_id: str """ @@ -157,8 +156,8 @@ class ManagementGroupDiagnosticSettingsResourceCollection(msrest.serialization.M """Represents a collection of management group diagnostic settings resources. :param value: The collection of management group diagnostic settings resources. - :type value: list[~$(python-base- - namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource] + :type value: + list[~$(python-base-namespace).v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource] """ _attribute_map = { diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py index 9f9bdc045e1b8..d15bed8025606 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py @@ -93,7 +93,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -160,7 +160,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) @@ -219,7 +219,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -287,7 +287,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py index ccbeb512b0c20..d824795100926 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MonitorManagementClient'] try: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py index 78473575fb289..1f601e6a83062 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -28,7 +29,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json index 7892eefabedfc..a556e8b454f65 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -21,41 +23,81 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", - "description": "The Azure subscription Id.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, "constant": { }, - "call": "credential, subscription_id" + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "scheduled_query_rules": "ScheduledQueryRulesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py index 57f192b65071c..f16bbdb9ca83c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MonitorManagementClientConfiguration from .operations import ScheduledQueryRulesOperations @@ -29,7 +30,7 @@ class MonitorManagementClient(object): :vartype scheduled_query_rules: $(python-base-namespace).v2020_05_01_preview.operations.ScheduledQueryRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -55,6 +56,24 @@ def __init__( self.scheduled_query_rules = ScheduledQueryRulesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py index 91c9d16538c30..b4b6605c0d04e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MonitorManagementClientConfiguration(Configuration): """Configuration for MonitorManagementClient. @@ -26,7 +27,7 @@ class MonitorManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py index 8ec830e0b2525..bac9461982547 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -27,7 +28,7 @@ class MonitorManagementClient(object): :vartype scheduled_query_rules: $(python-base-namespace).v2020_05_01_preview.aio.operations.ScheduledQueryRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL """ @@ -52,6 +53,23 @@ def __init__( self.scheduled_query_rules = ScheduledQueryRulesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py index 25daa2f351ddc..77eccbaf2c5d1 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ScheduledQueryRuleResourceCollection"]: """Retrieve a scheduled query rule definitions in a subscription. @@ -69,7 +69,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -97,7 +97,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -111,7 +111,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ScheduledQueryRuleResourceCollection"]: """Retrieve scheduled query rule definitions in a resource group. @@ -139,7 +139,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -168,7 +168,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -183,7 +183,7 @@ async def get( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.ScheduledQueryRuleResource": """Retrieve an scheduled query rule definition. @@ -207,7 +207,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -227,7 +227,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) @@ -243,7 +243,7 @@ async def create_or_update( resource_group_name: str, rule_name: str, parameters: "_models.ScheduledQueryRuleResource", - **kwargs + **kwargs: Any ) -> "_models.ScheduledQueryRuleResource": """Creates or updates a scheduled query rule. @@ -270,7 +270,7 @@ async def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -294,7 +294,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -314,7 +314,7 @@ async def update( resource_group_name: str, rule_name: str, parameters: "_models.ScheduledQueryRuleResourcePatch", - **kwargs + **kwargs: Any ) -> "_models.ScheduledQueryRuleResource": """Update a scheduled query rule. @@ -341,7 +341,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -365,7 +365,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) @@ -380,7 +380,7 @@ async def delete( self, resource_group_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a scheduled query rule. @@ -404,7 +404,7 @@ async def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -424,7 +424,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py index 65721a94a4ca4..bc0dc2510e615 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models.py @@ -42,8 +42,8 @@ class Condition(msrest.serialization.Model): :type query: str :param time_aggregation: Required. Aggregation type. Possible values include: "Count", "Average", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base- - namespace).v2020_05_01_preview.models.TimeAggregation + :type time_aggregation: str or + ~$(python-base-namespace).v2020_05_01_preview.models.TimeAggregation :param metric_measure_column: The column containing the metric measure number. :type metric_measure_column: str :param resource_id_column: The column containing the resource id. The content of the column @@ -58,8 +58,8 @@ class Condition(msrest.serialization.Model): :type threshold: float :param failing_periods: The minimum number of violations required within the selected lookback time window required to raise an alert. - :type failing_periods: ~$(python-base- - namespace).v2020_05_01_preview.models.ConditionFailingPeriods + :type failing_periods: + ~$(python-base-namespace).v2020_05_01_preview.models.ConditionFailingPeriods """ _validation = { @@ -164,7 +164,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -219,8 +219,8 @@ class ErrorResponse(msrest.serialization.Model): :ivar details: The error details. :vartype details: list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: list[~$(python-base- - namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -371,8 +371,24 @@ class ScheduledQueryRuleResource(TrackedResource): :type tags: dict[str, str] :param location: Required. The geo-location where the resource lives. :type location: str + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :vartype kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str + :param display_name: The display name of the alert rule. + :type display_name: str :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Possible values include: 0, 1, 2, 3, 4. :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity @@ -387,6 +403,9 @@ class ScheduledQueryRuleResource(TrackedResource): :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). + :type override_query_time_range: ~datetime.timedelta :param target_resource_types: List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual @@ -406,6 +425,10 @@ class ScheduledQueryRuleResource(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'kind': {'readonly': True}, + 'etag': {'readonly': True}, + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, } _attribute_map = { @@ -414,12 +437,18 @@ class ScheduledQueryRuleResource(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'float'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, @@ -431,12 +460,18 @@ def __init__( **kwargs ): super(ScheduledQueryRuleResource, self).__init__(**kwargs) + self.kind = None + self.etag = None + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) self.severity = kwargs.get('severity', None) self.enabled = kwargs.get('enabled', None) self.scopes = kwargs.get('scopes', None) self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) + self.override_query_time_range = kwargs.get('override_query_time_range', None) self.target_resource_types = kwargs.get('target_resource_types', None) self.criteria = kwargs.get('criteria', None) self.mute_actions_duration = kwargs.get('mute_actions_duration', None) @@ -447,8 +482,8 @@ class ScheduledQueryRuleResourceCollection(msrest.serialization.Model): """Represents a collection of scheduled query rule resources. :param value: The values for the scheduled query rule resources. - :type value: list[~$(python-base- - namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource] + :type value: + list[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource] """ _attribute_map = { @@ -466,10 +501,18 @@ def __init__( class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): """The scheduled query rule resource for patch operations. + Variables are only populated by the server, and will be ignored when sending a request. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str + :param display_name: The display name of the alert rule. + :type display_name: str :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Possible values include: 0, 1, 2, 3, 4. :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity @@ -484,6 +527,9 @@ class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). + :type override_query_time_range: ~datetime.timedelta :param target_resource_types: List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual @@ -498,14 +544,23 @@ class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): :type actions: list[~$(python-base-namespace).v2020_05_01_preview.models.Action] """ + _validation = { + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, + } + _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'float'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, @@ -518,12 +573,16 @@ def __init__( ): super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) self.severity = kwargs.get('severity', None) self.enabled = kwargs.get('enabled', None) self.scopes = kwargs.get('scopes', None) self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) + self.override_query_time_range = kwargs.get('override_query_time_range', None) self.target_resource_types = kwargs.get('target_resource_types', None) self.criteria = kwargs.get('criteria', None) self.mute_actions_duration = kwargs.get('mute_actions_duration', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py index b50679d0ac279..1525426b24eaf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_models_py3.py @@ -50,8 +50,8 @@ class Condition(msrest.serialization.Model): :type query: str :param time_aggregation: Required. Aggregation type. Possible values include: "Count", "Average", "Minimum", "Maximum", "Total". - :type time_aggregation: str or ~$(python-base- - namespace).v2020_05_01_preview.models.TimeAggregation + :type time_aggregation: str or + ~$(python-base-namespace).v2020_05_01_preview.models.TimeAggregation :param metric_measure_column: The column containing the metric measure number. :type metric_measure_column: str :param resource_id_column: The column containing the resource id. The content of the column @@ -66,8 +66,8 @@ class Condition(msrest.serialization.Model): :type threshold: float :param failing_periods: The minimum number of violations required within the selected lookback time window required to raise an alert. - :type failing_periods: ~$(python-base- - namespace).v2020_05_01_preview.models.ConditionFailingPeriods + :type failing_periods: + ~$(python-base-namespace).v2020_05_01_preview.models.ConditionFailingPeriods """ _validation = { @@ -188,7 +188,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -245,8 +245,8 @@ class ErrorResponse(msrest.serialization.Model): :ivar details: The error details. :vartype details: list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: list[~$(python-base- - namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~$(python-base-namespace).v2020_05_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -402,8 +402,24 @@ class ScheduledQueryRuleResource(TrackedResource): :type tags: dict[str, str] :param location: Required. The geo-location where the resource lives. :type location: str + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :vartype kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str + :param display_name: The display name of the alert rule. + :type display_name: str :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Possible values include: 0, 1, 2, 3, 4. :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity @@ -418,6 +434,9 @@ class ScheduledQueryRuleResource(TrackedResource): :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). + :type override_query_time_range: ~datetime.timedelta :param target_resource_types: List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual @@ -437,6 +456,10 @@ class ScheduledQueryRuleResource(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'kind': {'readonly': True}, + 'etag': {'readonly': True}, + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, } _attribute_map = { @@ -445,12 +468,18 @@ class ScheduledQueryRuleResource(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'float'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, @@ -463,11 +492,13 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, + display_name: Optional[str] = None, severity: Optional[Union[float, "AlertSeverity"]] = None, enabled: Optional[bool] = None, scopes: Optional[List[str]] = None, evaluation_frequency: Optional[datetime.timedelta] = None, window_size: Optional[datetime.timedelta] = None, + override_query_time_range: Optional[datetime.timedelta] = None, target_resource_types: Optional[List[str]] = None, criteria: Optional["ScheduledQueryRuleCriteria"] = None, mute_actions_duration: Optional[datetime.timedelta] = None, @@ -475,12 +506,18 @@ def __init__( **kwargs ): super(ScheduledQueryRuleResource, self).__init__(tags=tags, location=location, **kwargs) + self.kind = None + self.etag = None + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = description + self.display_name = display_name self.severity = severity self.enabled = enabled self.scopes = scopes self.evaluation_frequency = evaluation_frequency self.window_size = window_size + self.override_query_time_range = override_query_time_range self.target_resource_types = target_resource_types self.criteria = criteria self.mute_actions_duration = mute_actions_duration @@ -491,8 +528,8 @@ class ScheduledQueryRuleResourceCollection(msrest.serialization.Model): """Represents a collection of scheduled query rule resources. :param value: The values for the scheduled query rule resources. - :type value: list[~$(python-base- - namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource] + :type value: + list[~$(python-base-namespace).v2020_05_01_preview.models.ScheduledQueryRuleResource] """ _attribute_map = { @@ -512,10 +549,18 @@ def __init__( class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): """The scheduled query rule resource for patch operations. + Variables are only populated by the server, and will be ignored when sending a request. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool :param description: The description of the scheduled query rule. :type description: str + :param display_name: The display name of the alert rule. + :type display_name: str :param severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Possible values include: 0, 1, 2, 3, 4. :type severity: str or ~$(python-base-namespace).v2020_05_01_preview.models.AlertSeverity @@ -530,6 +575,9 @@ class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): :param window_size: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). :type window_size: ~datetime.timedelta + :param override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). + :type override_query_time_range: ~datetime.timedelta :param target_resource_types: List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual @@ -544,14 +592,23 @@ class ScheduledQueryRuleResourcePatch(msrest.serialization.Model): :type actions: list[~$(python-base-namespace).v2020_05_01_preview.models.Action] """ + _validation = { + 'created_with_api_version': {'readonly': True}, + 'is_legacy_log_analytics_rule': {'readonly': True}, + } + _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, + 'created_with_api_version': {'key': 'properties.createdWithApiVersion', 'type': 'str'}, + 'is_legacy_log_analytics_rule': {'key': 'properties.isLegacyLogAnalyticsRule', 'type': 'bool'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'severity': {'key': 'properties.severity', 'type': 'float'}, 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, + 'override_query_time_range': {'key': 'properties.overrideQueryTimeRange', 'type': 'duration'}, 'target_resource_types': {'key': 'properties.targetResourceTypes', 'type': '[str]'}, 'criteria': {'key': 'properties.criteria', 'type': 'ScheduledQueryRuleCriteria'}, 'mute_actions_duration': {'key': 'properties.muteActionsDuration', 'type': 'duration'}, @@ -563,11 +620,13 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, + display_name: Optional[str] = None, severity: Optional[Union[float, "AlertSeverity"]] = None, enabled: Optional[bool] = None, scopes: Optional[List[str]] = None, evaluation_frequency: Optional[datetime.timedelta] = None, window_size: Optional[datetime.timedelta] = None, + override_query_time_range: Optional[datetime.timedelta] = None, target_resource_types: Optional[List[str]] = None, criteria: Optional["ScheduledQueryRuleCriteria"] = None, mute_actions_duration: Optional[datetime.timedelta] = None, @@ -576,12 +635,16 @@ def __init__( ): super(ScheduledQueryRuleResourcePatch, self).__init__(**kwargs) self.tags = tags + self.created_with_api_version = None + self.is_legacy_log_analytics_rule = None self.description = description + self.display_name = display_name self.severity = severity self.enabled = enabled self.scopes = scopes self.evaluation_frequency = evaluation_frequency self.window_size = window_size + self.override_query_time_range = override_query_time_range self.target_resource_types = target_resource_types self.criteria = criteria self.mute_actions_duration = mute_actions_duration diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py index 6879360b4e773..155ebb7421760 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/operations/_scheduled_query_rules_operations.py @@ -74,7 +74,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -102,7 +102,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -145,7 +145,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -174,7 +174,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -214,7 +214,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -234,7 +234,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) @@ -278,7 +278,7 @@ def create_or_update( # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -302,7 +302,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -350,7 +350,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -374,7 +374,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScheduledQueryRuleResource', pipeline_response) @@ -414,7 +414,7 @@ def delete( # Construct URL url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } @@ -434,7 +434,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorContract, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/__init__.py new file mode 100644 index 0000000000000..d824795100926 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['MonitorManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_configuration.py new file mode 100644 index 0000000000000..28d48e6791d02 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_metadata.json new file mode 100644 index 0000000000000..29a3b208a9663 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "2020-10-01", + "total_api_version_list": ["2020-10-01"], + "client": { + "name": "MonitorManagementClient", + "filename": "_monitor_management_client", + "description": "Monitor Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "activity_log_alerts": "ActivityLogAlertsOperations" + } +} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_monitor_management_client.py new file mode 100644 index 0000000000000..b1daa9d88de56 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_monitor_management_client.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActivityLogAlertsOperations +from . import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar activity_log_alerts: ActivityLogAlertsOperations operations + :vartype activity_log_alerts: $(python-base-namespace).v2020_10_01.operations.ActivityLogAlertsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.activity_log_alerts = ActivityLogAlertsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MonitorManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/__init__.py new file mode 100644 index 0000000000000..96ce9b45c05b5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_configuration.py new file mode 100644 index 0000000000000..968ee446dd680 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_monitor_management_client.py new file mode 100644 index 0000000000000..ec3d4d50df64f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/_monitor_management_client.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ActivityLogAlertsOperations +from .. import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar activity_log_alerts: ActivityLogAlertsOperations operations + :vartype activity_log_alerts: $(python-base-namespace).v2020_10_01.aio.operations.ActivityLogAlertsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.activity_log_alerts = ActivityLogAlertsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MonitorManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/__init__.py new file mode 100644 index 0000000000000..93b3b50f2d763 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._activity_log_alerts_operations import ActivityLogAlertsOperations + +__all__ = [ + 'ActivityLogAlertsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/_activity_log_alerts_operations.py new file mode 100644 index 0000000000000..ecb6e1f12579d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/aio/operations/_activity_log_alerts_operations.py @@ -0,0 +1,435 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActivityLogAlertsOperations: + """ActivityLogAlertsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2020_10_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + activity_log_alert_name: str, + activity_log_alert_rule: "_models.ActivityLogAlertResource", + **kwargs: Any + ) -> "_models.ActivityLogAlertResource": + """Create a new Activity Log Alert rule or update an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :param activity_log_alert_rule: The Activity Log Alert rule to create or use for the update. + :type activity_log_alert_rule: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActivityLogAlertResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(activity_log_alert_rule, 'ActivityLogAlertResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + activity_log_alert_name: str, + **kwargs: Any + ) -> "_models.ActivityLogAlertResource": + """Get an Activity Log Alert rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActivityLogAlertResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + activity_log_alert_name: str, + **kwargs: Any + ) -> None: + """Delete an Activity Log Alert rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + activity_log_alert_name: str, + activity_log_alert_rule_patch: "_models.AlertRulePatchObject", + **kwargs: Any + ) -> "_models.ActivityLogAlertResource": + """Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update + the Alert rule tags, and to enable or disable the Alert rule. To update other fields use + CreateOrUpdate operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :param activity_log_alert_rule_patch: Parameters supplied to the operation. + :type activity_log_alert_rule_patch: ~$(python-base-namespace).v2020_10_01.models.AlertRulePatchObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActivityLogAlertResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(activity_log_alert_rule_patch, 'AlertRulePatchObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + def list_by_subscription_id( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AlertRuleList"]: + """Get a list of all Activity Log Alert rules in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AlertRuleList"]: + """Get a list of all Activity Log Alert rules in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/__init__.py new file mode 100644 index 0000000000000..e937f3d3fe5af --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/__init__.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActionGroup + from ._models_py3 import ActionList + from ._models_py3 import ActivityLogAlertResource + from ._models_py3 import AlertRuleAllOfCondition + from ._models_py3 import AlertRuleAnyOfOrLeafCondition + from ._models_py3 import AlertRuleLeafCondition + from ._models_py3 import AlertRuleList + from ._models_py3 import AlertRulePatchObject + from ._models_py3 import AzureResource + from ._models_py3 import ErrorResponse +except (SyntaxError, ImportError): + from ._models import ActionGroup # type: ignore + from ._models import ActionList # type: ignore + from ._models import ActivityLogAlertResource # type: ignore + from ._models import AlertRuleAllOfCondition # type: ignore + from ._models import AlertRuleAnyOfOrLeafCondition # type: ignore + from ._models import AlertRuleLeafCondition # type: ignore + from ._models import AlertRuleList # type: ignore + from ._models import AlertRulePatchObject # type: ignore + from ._models import AzureResource # type: ignore + from ._models import ErrorResponse # type: ignore + +__all__ = [ + 'ActionGroup', + 'ActionList', + 'ActivityLogAlertResource', + 'AlertRuleAllOfCondition', + 'AlertRuleAnyOfOrLeafCondition', + 'AlertRuleLeafCondition', + 'AlertRuleList', + 'AlertRulePatchObject', + 'AzureResource', + 'ErrorResponse', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/_models.py new file mode 100644 index 0000000000000..419f5583f36f5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/_models.py @@ -0,0 +1,344 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ActionGroup(msrest.serialization.Model): + """A pointer to an Azure Action Group. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: Required. The resource ID of the Action Group. This cannot be null or + empty. + :type action_group_id: str + :param webhook_properties: the dictionary of custom properties to include with the post + operation. These data are appended to the webhook payload. + :type webhook_properties: dict[str, str] + """ + + _validation = { + 'action_group_id': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionGroup, self).__init__(**kwargs) + self.action_group_id = kwargs['action_group_id'] + self.webhook_properties = kwargs.get('webhook_properties', None) + + +class ActionList(msrest.serialization.Model): + """A list of Activity Log Alert rule actions. + + :param action_groups: The list of the Action Groups. + :type action_groups: list[~$(python-base-namespace).v2020_10_01.models.ActionGroup] + """ + + _attribute_map = { + 'action_groups': {'key': 'actionGroups', 'type': '[ActionGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionList, self).__init__(**kwargs) + self.action_groups = kwargs.get('action_groups', None) + + +class AzureResource(msrest.serialization.Model): + """An Azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource Id. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: The location of the resource. Since Azure Activity Log Alerts is a global + service, the location of the rules should always be 'global'. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', "global") + self.tags = kwargs.get('tags', None) + + +class ActivityLogAlertResource(AzureResource): + """An Activity Log Alert rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource Id. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: The location of the resource. Since Azure Activity Log Alerts is a global + service, the location of the rules should always be 'global'. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param scopes: A list of resource IDs that will be used as prefixes. The alert will only apply + to Activity Log events with resource IDs that fall under one of these prefixes. This list must + include at least one item. + :type scopes: list[str] + :param condition: The condition that will cause this alert to activate. + :type condition: ~$(python-base-namespace).v2020_10_01.models.AlertRuleAllOfCondition + :param actions: The actions that will activate when the condition is met. + :type actions: ~$(python-base-namespace).v2020_10_01.models.ActionList + :param enabled: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log + Alert rule is not enabled, then none of its actions will be activated. + :type enabled: bool + :param description: A description of this Activity Log Alert rule. + :type description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'condition': {'key': 'properties.condition', 'type': 'AlertRuleAllOfCondition'}, + 'actions': {'key': 'properties.actions', 'type': 'ActionList'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActivityLogAlertResource, self).__init__(**kwargs) + self.scopes = kwargs.get('scopes', None) + self.condition = kwargs.get('condition', None) + self.actions = kwargs.get('actions', None) + self.enabled = kwargs.get('enabled', True) + self.description = kwargs.get('description', None) + + +class AlertRuleAllOfCondition(msrest.serialization.Model): + """An Activity Log Alert rule condition that is met when all its member conditions are met. + + All required parameters must be populated in order to send to Azure. + + :param all_of: Required. The list of Activity Log Alert rule conditions. + :type all_of: list[~$(python-base-namespace).v2020_10_01.models.AlertRuleAnyOfOrLeafCondition] + """ + + _validation = { + 'all_of': {'required': True}, + } + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[AlertRuleAnyOfOrLeafCondition]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleAllOfCondition, self).__init__(**kwargs) + self.all_of = kwargs['all_of'] + + +class AlertRuleLeafCondition(msrest.serialization.Model): + """An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. +This condition must contain 'field' and either 'equals' or 'containsAny'. + + :param field: The name of the Activity Log event's field that this condition will examine. + The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', + 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties'. + :type field: str + :param equals: The value of the event's field will be compared to this value (case-insensitive) + to determine if the condition is met. + :type equals: str + :param contains_any: The value of the event's field will be compared to the values in this + array (case-insensitive) to determine if the condition is met. + :type contains_any: list[str] + """ + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + 'contains_any': {'key': 'containsAny', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleLeafCondition, self).__init__(**kwargs) + self.field = kwargs.get('field', None) + self.equals = kwargs.get('equals', None) + self.contains_any = kwargs.get('contains_any', None) + + +class AlertRuleAnyOfOrLeafCondition(AlertRuleLeafCondition): + """An Activity Log Alert rule condition that is met when all its member conditions are met. +Each condition can be of one of the following types: +**Important**\ : Each type has its unique subset of properties. Properties from different types CANNOT exist in one condition. + + +* **Leaf Condition -** must contain 'field' and either 'equals' or 'containsAny'. + *Please note, 'anyOf' should **not** be set in a Leaf Condition.* + + * **AnyOf Condition -** must contain **only** 'anyOf' (which is an array of Leaf Conditions). + *Please note, 'field', 'equals' and 'containsAny' should **not** be set in an AnyOf Condition.*. + + :param field: The name of the Activity Log event's field that this condition will examine. + The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', + 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties'. + :type field: str + :param equals: The value of the event's field will be compared to this value (case-insensitive) + to determine if the condition is met. + :type equals: str + :param contains_any: The value of the event's field will be compared to the values in this + array (case-insensitive) to determine if the condition is met. + :type contains_any: list[str] + :param any_of: An Activity Log Alert rule condition that is met when at least one of its member + leaf conditions are met. + :type any_of: list[~$(python-base-namespace).v2020_10_01.models.AlertRuleLeafCondition] + """ + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + 'contains_any': {'key': 'containsAny', 'type': '[str]'}, + 'any_of': {'key': 'anyOf', 'type': '[AlertRuleLeafCondition]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleAnyOfOrLeafCondition, self).__init__(**kwargs) + self.any_of = kwargs.get('any_of', None) + + +class AlertRuleList(msrest.serialization.Model): + """A list of Activity Log Alert rules. + + :param value: The list of Activity Log Alert rules. + :type value: list[~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource] + :param next_link: Provides the link to retrieve the next set of elements. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActivityLogAlertResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AlertRulePatchObject(msrest.serialization.Model): + """An Activity Log Alert rule object for the body of patch operations. + + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param enabled: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log + Alert rule is not enabled, then none of its actions will be activated. + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRulePatchObject, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', True) + + +class ErrorResponse(msrest.serialization.Model): + """The error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/_models_py3.py new file mode 100644 index 0000000000000..f6a14450917fb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/models/_models_py3.py @@ -0,0 +1,379 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ActionGroup(msrest.serialization.Model): + """A pointer to an Azure Action Group. + + All required parameters must be populated in order to send to Azure. + + :param action_group_id: Required. The resource ID of the Action Group. This cannot be null or + empty. + :type action_group_id: str + :param webhook_properties: the dictionary of custom properties to include with the post + operation. These data are appended to the webhook payload. + :type webhook_properties: dict[str, str] + """ + + _validation = { + 'action_group_id': {'required': True}, + } + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__( + self, + *, + action_group_id: str, + webhook_properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ActionGroup, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.webhook_properties = webhook_properties + + +class ActionList(msrest.serialization.Model): + """A list of Activity Log Alert rule actions. + + :param action_groups: The list of the Action Groups. + :type action_groups: list[~$(python-base-namespace).v2020_10_01.models.ActionGroup] + """ + + _attribute_map = { + 'action_groups': {'key': 'actionGroups', 'type': '[ActionGroup]'}, + } + + def __init__( + self, + *, + action_groups: Optional[List["ActionGroup"]] = None, + **kwargs + ): + super(ActionList, self).__init__(**kwargs) + self.action_groups = action_groups + + +class AzureResource(msrest.serialization.Model): + """An Azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource Id. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: The location of the resource. Since Azure Activity Log Alerts is a global + service, the location of the rules should always be 'global'. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = "global", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(AzureResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ActivityLogAlertResource(AzureResource): + """An Activity Log Alert rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource Id. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: The location of the resource. Since Azure Activity Log Alerts is a global + service, the location of the rules should always be 'global'. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param scopes: A list of resource IDs that will be used as prefixes. The alert will only apply + to Activity Log events with resource IDs that fall under one of these prefixes. This list must + include at least one item. + :type scopes: list[str] + :param condition: The condition that will cause this alert to activate. + :type condition: ~$(python-base-namespace).v2020_10_01.models.AlertRuleAllOfCondition + :param actions: The actions that will activate when the condition is met. + :type actions: ~$(python-base-namespace).v2020_10_01.models.ActionList + :param enabled: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log + Alert rule is not enabled, then none of its actions will be activated. + :type enabled: bool + :param description: A description of this Activity Log Alert rule. + :type description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'condition': {'key': 'properties.condition', 'type': 'AlertRuleAllOfCondition'}, + 'actions': {'key': 'properties.actions', 'type': 'ActionList'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = "global", + tags: Optional[Dict[str, str]] = None, + scopes: Optional[List[str]] = None, + condition: Optional["AlertRuleAllOfCondition"] = None, + actions: Optional["ActionList"] = None, + enabled: Optional[bool] = True, + description: Optional[str] = None, + **kwargs + ): + super(ActivityLogAlertResource, self).__init__(location=location, tags=tags, **kwargs) + self.scopes = scopes + self.condition = condition + self.actions = actions + self.enabled = enabled + self.description = description + + +class AlertRuleAllOfCondition(msrest.serialization.Model): + """An Activity Log Alert rule condition that is met when all its member conditions are met. + + All required parameters must be populated in order to send to Azure. + + :param all_of: Required. The list of Activity Log Alert rule conditions. + :type all_of: list[~$(python-base-namespace).v2020_10_01.models.AlertRuleAnyOfOrLeafCondition] + """ + + _validation = { + 'all_of': {'required': True}, + } + + _attribute_map = { + 'all_of': {'key': 'allOf', 'type': '[AlertRuleAnyOfOrLeafCondition]'}, + } + + def __init__( + self, + *, + all_of: List["AlertRuleAnyOfOrLeafCondition"], + **kwargs + ): + super(AlertRuleAllOfCondition, self).__init__(**kwargs) + self.all_of = all_of + + +class AlertRuleLeafCondition(msrest.serialization.Model): + """An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. +This condition must contain 'field' and either 'equals' or 'containsAny'. + + :param field: The name of the Activity Log event's field that this condition will examine. + The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', + 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties'. + :type field: str + :param equals: The value of the event's field will be compared to this value (case-insensitive) + to determine if the condition is met. + :type equals: str + :param contains_any: The value of the event's field will be compared to the values in this + array (case-insensitive) to determine if the condition is met. + :type contains_any: list[str] + """ + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + 'contains_any': {'key': 'containsAny', 'type': '[str]'}, + } + + def __init__( + self, + *, + field: Optional[str] = None, + equals: Optional[str] = None, + contains_any: Optional[List[str]] = None, + **kwargs + ): + super(AlertRuleLeafCondition, self).__init__(**kwargs) + self.field = field + self.equals = equals + self.contains_any = contains_any + + +class AlertRuleAnyOfOrLeafCondition(AlertRuleLeafCondition): + """An Activity Log Alert rule condition that is met when all its member conditions are met. +Each condition can be of one of the following types: +**Important**\ : Each type has its unique subset of properties. Properties from different types CANNOT exist in one condition. + + +* **Leaf Condition -** must contain 'field' and either 'equals' or 'containsAny'. + *Please note, 'anyOf' should **not** be set in a Leaf Condition.* + + * **AnyOf Condition -** must contain **only** 'anyOf' (which is an array of Leaf Conditions). + *Please note, 'field', 'equals' and 'containsAny' should **not** be set in an AnyOf Condition.*. + + :param field: The name of the Activity Log event's field that this condition will examine. + The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', + 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + 'resourceType', or anything beginning with 'properties'. + :type field: str + :param equals: The value of the event's field will be compared to this value (case-insensitive) + to determine if the condition is met. + :type equals: str + :param contains_any: The value of the event's field will be compared to the values in this + array (case-insensitive) to determine if the condition is met. + :type contains_any: list[str] + :param any_of: An Activity Log Alert rule condition that is met when at least one of its member + leaf conditions are met. + :type any_of: list[~$(python-base-namespace).v2020_10_01.models.AlertRuleLeafCondition] + """ + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'equals': {'key': 'equals', 'type': 'str'}, + 'contains_any': {'key': 'containsAny', 'type': '[str]'}, + 'any_of': {'key': 'anyOf', 'type': '[AlertRuleLeafCondition]'}, + } + + def __init__( + self, + *, + field: Optional[str] = None, + equals: Optional[str] = None, + contains_any: Optional[List[str]] = None, + any_of: Optional[List["AlertRuleLeafCondition"]] = None, + **kwargs + ): + super(AlertRuleAnyOfOrLeafCondition, self).__init__(field=field, equals=equals, contains_any=contains_any, **kwargs) + self.any_of = any_of + + +class AlertRuleList(msrest.serialization.Model): + """A list of Activity Log Alert rules. + + :param value: The list of Activity Log Alert rules. + :type value: list[~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource] + :param next_link: Provides the link to retrieve the next set of elements. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ActivityLogAlertResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ActivityLogAlertResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AlertRuleList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AlertRulePatchObject(msrest.serialization.Model): + """An Activity Log Alert rule object for the body of patch operations. + + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param enabled: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log + Alert rule is not enabled, then none of its actions will be activated. + :type enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + enabled: Optional[bool] = True, + **kwargs + ): + super(AlertRulePatchObject, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled + + +class ErrorResponse(msrest.serialization.Model): + """The error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/__init__.py new file mode 100644 index 0000000000000..93b3b50f2d763 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._activity_log_alerts_operations import ActivityLogAlertsOperations + +__all__ = [ + 'ActivityLogAlertsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/_activity_log_alerts_operations.py new file mode 100644 index 0000000000000..19e1ae46f59c2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/_activity_log_alerts_operations.py @@ -0,0 +1,445 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ActivityLogAlertsOperations(object): + """ActivityLogAlertsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2020_10_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + activity_log_alert_name, # type: str + activity_log_alert_rule, # type: "_models.ActivityLogAlertResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ActivityLogAlertResource" + """Create a new Activity Log Alert rule or update an existing one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :param activity_log_alert_rule: The Activity Log Alert rule to create or use for the update. + :type activity_log_alert_rule: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActivityLogAlertResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(activity_log_alert_rule, 'ActivityLogAlertResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + activity_log_alert_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ActivityLogAlertResource" + """Get an Activity Log Alert rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActivityLogAlertResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + activity_log_alert_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an Activity Log Alert rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + activity_log_alert_name, # type: str + activity_log_alert_rule_patch, # type: "_models.AlertRulePatchObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.ActivityLogAlertResource" + """Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update + the Alert rule tags, and to enable or disable the Alert rule. To update other fields use + CreateOrUpdate operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param activity_log_alert_name: The name of the Activity Log Alert rule. + :type activity_log_alert_name: str + :param activity_log_alert_rule_patch: Parameters supplied to the operation. + :type activity_log_alert_rule_patch: ~$(python-base-namespace).v2020_10_01.models.AlertRulePatchObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActivityLogAlertResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2020_10_01.models.ActivityLogAlertResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActivityLogAlertResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'activityLogAlertName': self._serialize.url("activity_log_alert_name", activity_log_alert_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(activity_log_alert_rule_patch, 'AlertRulePatchObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActivityLogAlertResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'} # type: ignore + + def list_by_subscription_id( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AlertRuleList"] + """Get a list of all Activity Log Alert rules in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription_id.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AlertRuleList"] + """Get a list of all Activity Log Alert rules in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertRuleList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2020_10_01.models.AlertRuleList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/py.typed b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/__init__.py new file mode 100644 index 0000000000000..d824795100926 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['MonitorManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py new file mode 100644 index 0000000000000..6c2b6a6fe818e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_metadata.json new file mode 100644 index 0000000000000..257eaf0e018bb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_metadata.json @@ -0,0 +1,105 @@ +{ + "chosen_version": "2021-04-01", + "total_api_version_list": ["2021-04-01"], + "client": { + "name": "MonitorManagementClient", + "filename": "_monitor_management_client", + "description": "Monitor Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "data_collection_endpoints": "DataCollectionEndpointsOperations", + "data_collection_rule_associations": "DataCollectionRuleAssociationsOperations", + "data_collection_rules": "DataCollectionRulesOperations" + } +} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_monitor_management_client.py new file mode 100644 index 0000000000000..c28a4128d4c60 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_monitor_management_client.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import MonitorManagementClientConfiguration +from .operations import DataCollectionEndpointsOperations +from .operations import DataCollectionRuleAssociationsOperations +from .operations import DataCollectionRulesOperations +from . import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar data_collection_endpoints: DataCollectionEndpointsOperations operations + :vartype data_collection_endpoints: $(python-base-namespace).v2021_04_01.operations.DataCollectionEndpointsOperations + :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations + :vartype data_collection_rule_associations: $(python-base-namespace).v2021_04_01.operations.DataCollectionRuleAssociationsOperations + :ivar data_collection_rules: DataCollectionRulesOperations operations + :vartype data_collection_rules: $(python-base-namespace).v2021_04_01.operations.DataCollectionRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.data_collection_endpoints = DataCollectionEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_collection_rule_associations = DataCollectionRuleAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_collection_rules = DataCollectionRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MonitorManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/__init__.py new file mode 100644 index 0000000000000..96ce9b45c05b5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_configuration.py new file mode 100644 index 0000000000000..cb6cdeab6de82 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_monitor_management_client.py new file mode 100644 index 0000000000000..a18ea946eba9f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/_monitor_management_client.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MonitorManagementClientConfiguration +from .operations import DataCollectionEndpointsOperations +from .operations import DataCollectionRuleAssociationsOperations +from .operations import DataCollectionRulesOperations +from .. import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar data_collection_endpoints: DataCollectionEndpointsOperations operations + :vartype data_collection_endpoints: $(python-base-namespace).v2021_04_01.aio.operations.DataCollectionEndpointsOperations + :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations + :vartype data_collection_rule_associations: $(python-base-namespace).v2021_04_01.aio.operations.DataCollectionRuleAssociationsOperations + :ivar data_collection_rules: DataCollectionRulesOperations operations + :vartype data_collection_rules: $(python-base-namespace).v2021_04_01.aio.operations.DataCollectionRulesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.data_collection_endpoints = DataCollectionEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_collection_rule_associations = DataCollectionRuleAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_collection_rules = DataCollectionRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MonitorManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/__init__.py new file mode 100644 index 0000000000000..86676ba926236 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_collection_endpoints_operations import DataCollectionEndpointsOperations +from ._data_collection_rule_associations_operations import DataCollectionRuleAssociationsOperations +from ._data_collection_rules_operations import DataCollectionRulesOperations + +__all__ = [ + 'DataCollectionEndpointsOperations', + 'DataCollectionRuleAssociationsOperations', + 'DataCollectionRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_endpoints_operations.py new file mode 100644 index 0000000000000..40fd39f48a974 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_endpoints_operations.py @@ -0,0 +1,455 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionEndpointsOperations: + """DataCollectionEndpointsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DataCollectionEndpointResourceListResult"]: + """Lists all data collection endpoints in the specified resource group. + + Lists all data collection endpoints in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionEndpointResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionEndpointResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DataCollectionEndpointResourceListResult"]: + """Lists all data collection endpoints in the specified subscription. + + Lists all data collection endpoints in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionEndpointResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionEndpointResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + + async def get( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + **kwargs: Any + ) -> "_models.DataCollectionEndpointResource": + """Returns the specified data collection endpoint. + + Returns the specified data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionEndpointResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional["_models.DataCollectionEndpointResource"] = None, + **kwargs: Any + ) -> "_models.DataCollectionEndpointResource": + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionEndpointResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionEndpointResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional["_models.ResourceForUpdate"] = None, + **kwargs: Any + ) -> "_models.DataCollectionEndpointResource": + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionEndpointResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'ResourceForUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + **kwargs: Any + ) -> None: + """Deletes a data collection endpoint. + + Deletes a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rule_associations_operations.py new file mode 100644 index 0000000000000..8cf71334c09ee --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rule_associations_operations.py @@ -0,0 +1,384 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRuleAssociationsOperations: + """DataCollectionRuleAssociationsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource( + self, + resource_uri: str, + **kwargs: Any + ) -> AsyncIterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"]: + """Lists associations for the specified resource. + + Lists associations for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + + def list_by_rule( + self, + resource_group_name: str, + data_collection_rule_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"]: + """Lists associations for the specified data collection rule. + + Lists associations for the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + + async def get( + self, + resource_uri: str, + association_name: str, + **kwargs: Any + ) -> "_models.DataCollectionRuleAssociationProxyOnlyResource": + """Returns the specified association. + + Returns the specified association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + async def create( + self, + resource_uri: str, + association_name: str, + body: Optional["_models.DataCollectionRuleAssociationProxyOnlyResource"] = None, + **kwargs: Any + ) -> "_models.DataCollectionRuleAssociationProxyOnlyResource": + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. + :type association_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleAssociationProxyOnlyResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + async def delete( + self, + resource_uri: str, + association_name: str, + **kwargs: Any + ) -> None: + """Deletes an association. + + Deletes an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rules_operations.py new file mode 100644 index 0000000000000..9affad029e760 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/aio/operations/_data_collection_rules_operations.py @@ -0,0 +1,455 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRulesOperations: + """DataCollectionRulesOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DataCollectionRuleResourceListResult"]: + """Lists all data collection rules in the specified resource group. + + Lists all data collection rules in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DataCollectionRuleResourceListResult"]: + """Lists all data collection rules in the specified subscription. + + Lists all data collection rules in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + async def get( + self, + resource_group_name: str, + data_collection_rule_name: str, + **kwargs: Any + ) -> "_models.DataCollectionRuleResource": + """Returns the specified data collection rule. + + Returns the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional["_models.DataCollectionRuleResource"] = None, + **kwargs: Any + ) -> "_models.DataCollectionRuleResource": + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional["_models.ResourceForUpdate"] = None, + **kwargs: Any + ) -> "_models.DataCollectionRuleResource": + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'ResourceForUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + data_collection_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a data collection rule. + + Deletes a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/__init__.py new file mode 100644 index 0000000000000..7a45f54ae7257 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/__init__.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureMonitorMetricsDestination + from ._models_py3 import ConfigurationAccessEndpointSpec + from ._models_py3 import DataCollectionEndpoint + from ._models_py3 import DataCollectionEndpointConfigurationAccess + from ._models_py3 import DataCollectionEndpointLogsIngestion + from ._models_py3 import DataCollectionEndpointNetworkAcls + from ._models_py3 import DataCollectionEndpointResource + from ._models_py3 import DataCollectionEndpointResourceListResult + from ._models_py3 import DataCollectionEndpointResourceProperties + from ._models_py3 import DataCollectionEndpointResourceSystemData + from ._models_py3 import DataCollectionRule + from ._models_py3 import DataCollectionRuleAssociation + from ._models_py3 import DataCollectionRuleAssociationProxyOnlyResource + from ._models_py3 import DataCollectionRuleAssociationProxyOnlyResourceListResult + from ._models_py3 import DataCollectionRuleAssociationProxyOnlyResourceProperties + from ._models_py3 import DataCollectionRuleAssociationProxyOnlyResourceSystemData + from ._models_py3 import DataCollectionRuleDataSources + from ._models_py3 import DataCollectionRuleDestinations + from ._models_py3 import DataCollectionRuleResource + from ._models_py3 import DataCollectionRuleResourceListResult + from ._models_py3 import DataCollectionRuleResourceProperties + from ._models_py3 import DataCollectionRuleResourceSystemData + from ._models_py3 import DataFlow + from ._models_py3 import DataSourcesSpec + from ._models_py3 import DestinationsSpec + from ._models_py3 import DestinationsSpecAzureMonitorMetrics + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponseCommonV2 + from ._models_py3 import ExtensionDataSource + from ._models_py3 import LogAnalyticsDestination + from ._models_py3 import LogsIngestionEndpointSpec + from ._models_py3 import NetworkRuleSet + from ._models_py3 import PerfCounterDataSource + from ._models_py3 import ResourceForUpdate + from ._models_py3 import SyslogDataSource + from ._models_py3 import SystemData + from ._models_py3 import WindowsEventLogDataSource +except (SyntaxError, ImportError): + from ._models import AzureMonitorMetricsDestination # type: ignore + from ._models import ConfigurationAccessEndpointSpec # type: ignore + from ._models import DataCollectionEndpoint # type: ignore + from ._models import DataCollectionEndpointConfigurationAccess # type: ignore + from ._models import DataCollectionEndpointLogsIngestion # type: ignore + from ._models import DataCollectionEndpointNetworkAcls # type: ignore + from ._models import DataCollectionEndpointResource # type: ignore + from ._models import DataCollectionEndpointResourceListResult # type: ignore + from ._models import DataCollectionEndpointResourceProperties # type: ignore + from ._models import DataCollectionEndpointResourceSystemData # type: ignore + from ._models import DataCollectionRule # type: ignore + from ._models import DataCollectionRuleAssociation # type: ignore + from ._models import DataCollectionRuleAssociationProxyOnlyResource # type: ignore + from ._models import DataCollectionRuleAssociationProxyOnlyResourceListResult # type: ignore + from ._models import DataCollectionRuleAssociationProxyOnlyResourceProperties # type: ignore + from ._models import DataCollectionRuleAssociationProxyOnlyResourceSystemData # type: ignore + from ._models import DataCollectionRuleDataSources # type: ignore + from ._models import DataCollectionRuleDestinations # type: ignore + from ._models import DataCollectionRuleResource # type: ignore + from ._models import DataCollectionRuleResourceListResult # type: ignore + from ._models import DataCollectionRuleResourceProperties # type: ignore + from ._models import DataCollectionRuleResourceSystemData # type: ignore + from ._models import DataFlow # type: ignore + from ._models import DataSourcesSpec # type: ignore + from ._models import DestinationsSpec # type: ignore + from ._models import DestinationsSpecAzureMonitorMetrics # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponseCommonV2 # type: ignore + from ._models import ExtensionDataSource # type: ignore + from ._models import LogAnalyticsDestination # type: ignore + from ._models import LogsIngestionEndpointSpec # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import PerfCounterDataSource # type: ignore + from ._models import ResourceForUpdate # type: ignore + from ._models import SyslogDataSource # type: ignore + from ._models import SystemData # type: ignore + from ._models import WindowsEventLogDataSource # type: ignore + +from ._monitor_management_client_enums import ( + CreatedByType, + KnownDataCollectionEndpointProvisioningState, + KnownDataCollectionEndpointResourceKind, + KnownDataCollectionRuleAssociationProvisioningState, + KnownDataCollectionRuleProvisioningState, + KnownDataCollectionRuleResourceKind, + KnownDataFlowStreams, + KnownExtensionDataSourceStreams, + KnownPerfCounterDataSourceStreams, + KnownPublicNetworkAccessOptions, + KnownSyslogDataSourceFacilityNames, + KnownSyslogDataSourceLogLevels, + KnownSyslogDataSourceStreams, + KnownWindowsEventLogDataSourceStreams, +) + +__all__ = [ + 'AzureMonitorMetricsDestination', + 'ConfigurationAccessEndpointSpec', + 'DataCollectionEndpoint', + 'DataCollectionEndpointConfigurationAccess', + 'DataCollectionEndpointLogsIngestion', + 'DataCollectionEndpointNetworkAcls', + 'DataCollectionEndpointResource', + 'DataCollectionEndpointResourceListResult', + 'DataCollectionEndpointResourceProperties', + 'DataCollectionEndpointResourceSystemData', + 'DataCollectionRule', + 'DataCollectionRuleAssociation', + 'DataCollectionRuleAssociationProxyOnlyResource', + 'DataCollectionRuleAssociationProxyOnlyResourceListResult', + 'DataCollectionRuleAssociationProxyOnlyResourceProperties', + 'DataCollectionRuleAssociationProxyOnlyResourceSystemData', + 'DataCollectionRuleDataSources', + 'DataCollectionRuleDestinations', + 'DataCollectionRuleResource', + 'DataCollectionRuleResourceListResult', + 'DataCollectionRuleResourceProperties', + 'DataCollectionRuleResourceSystemData', + 'DataFlow', + 'DataSourcesSpec', + 'DestinationsSpec', + 'DestinationsSpecAzureMonitorMetrics', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponseCommonV2', + 'ExtensionDataSource', + 'LogAnalyticsDestination', + 'LogsIngestionEndpointSpec', + 'NetworkRuleSet', + 'PerfCounterDataSource', + 'ResourceForUpdate', + 'SyslogDataSource', + 'SystemData', + 'WindowsEventLogDataSource', + 'CreatedByType', + 'KnownDataCollectionEndpointProvisioningState', + 'KnownDataCollectionEndpointResourceKind', + 'KnownDataCollectionRuleAssociationProvisioningState', + 'KnownDataCollectionRuleProvisioningState', + 'KnownDataCollectionRuleResourceKind', + 'KnownDataFlowStreams', + 'KnownExtensionDataSourceStreams', + 'KnownPerfCounterDataSourceStreams', + 'KnownPublicNetworkAccessOptions', + 'KnownSyslogDataSourceFacilityNames', + 'KnownSyslogDataSourceLogLevels', + 'KnownSyslogDataSourceStreams', + 'KnownWindowsEventLogDataSourceStreams', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_models.py new file mode 100644 index 0000000000000..ebdaea5727624 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_models.py @@ -0,0 +1,1386 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AzureMonitorMetricsDestination(msrest.serialization.Model): + """Azure Monitor Metrics destination. + + :param name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureMonitorMetricsDestination, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class ConfigurationAccessEndpointSpec(msrest.serialization.Model): + """Definition of the endpoint used for accessing configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationAccessEndpointSpec, self).__init__(**kwargs) + self.endpoint = None + + +class DataCollectionEndpoint(msrest.serialization.Model): + """Definition of data collection endpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection endpoint. + :type description: str + :param immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :type immutable_id: str + :param configuration_access: The endpoint used by agents to access their configuration. + :type configuration_access: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointConfigurationAccess + :param logs_ingestion: The endpoint used by clients to ingest logs. + :type logs_ingestion: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointLogsIngestion + :param network_acls: Network access control rules for the endpoints. + :type network_acls: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'configuration_access': {'key': 'configurationAccess', 'type': 'DataCollectionEndpointConfigurationAccess'}, + 'logs_ingestion': {'key': 'logsIngestion', 'type': 'DataCollectionEndpointLogsIngestion'}, + 'network_acls': {'key': 'networkAcls', 'type': 'DataCollectionEndpointNetworkAcls'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpoint, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.immutable_id = kwargs.get('immutable_id', None) + self.configuration_access = kwargs.get('configuration_access', None) + self.logs_ingestion = kwargs.get('logs_ingestion', None) + self.network_acls = kwargs.get('network_acls', None) + self.provisioning_state = None + + +class DataCollectionEndpointConfigurationAccess(ConfigurationAccessEndpointSpec): + """The endpoint used by agents to access their configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointConfigurationAccess, self).__init__(**kwargs) + + +class LogsIngestionEndpointSpec(msrest.serialization.Model): + """Definition of the endpoint used for ingesting logs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogsIngestionEndpointSpec, self).__init__(**kwargs) + self.endpoint = None + + +class DataCollectionEndpointLogsIngestion(LogsIngestionEndpointSpec): + """The endpoint used by clients to ingest logs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointLogsIngestion, self).__init__(**kwargs) + + +class NetworkRuleSet(msrest.serialization.Model): + """Definition of the network rules. + + :param public_network_access: The configuration to set whether network access from public + internet to the endpoints are allowed. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~$(python-base-namespace).v2021_04_01.models.KnownPublicNetworkAccessOptions + """ + + _attribute_map = { + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.public_network_access = kwargs.get('public_network_access', None) + + +class DataCollectionEndpointNetworkAcls(NetworkRuleSet): + """Network access control rules for the endpoints. + + :param public_network_access: The configuration to set whether network access from public + internet to the endpoints are allowed. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~$(python-base-namespace).v2021_04_01.models.KnownPublicNetworkAccessOptions + """ + + _attribute_map = { + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointNetworkAcls, self).__init__(**kwargs) + + +class DataCollectionEndpointResource(msrest.serialization.Model): + """Definition of ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param kind: The kind of the resource. Possible values include: "Linux", "Windows". + :type kind: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointResourceKind + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceSystemData + :param description: Description of the data collection endpoint. + :type description: str + :param immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :type immutable_id: str + :param configuration_access: The endpoint used by agents to access their configuration. + :type configuration_access: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointConfigurationAccess + :param logs_ingestion: The endpoint used by clients to ingest logs. + :type logs_ingestion: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointLogsIngestion + :param network_acls: Network access control rules for the endpoints. + :type network_acls: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointProvisioningState + """ + + _validation = { + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'DataCollectionEndpointResourceSystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'immutable_id': {'key': 'properties.immutableId', 'type': 'str'}, + 'configuration_access': {'key': 'properties.configurationAccess', 'type': 'DataCollectionEndpointConfigurationAccess'}, + 'logs_ingestion': {'key': 'properties.logsIngestion', 'type': 'DataCollectionEndpointLogsIngestion'}, + 'network_acls': {'key': 'properties.networkAcls', 'type': 'DataCollectionEndpointNetworkAcls'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointResource, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.kind = kwargs.get('kind', None) + self.id = None + self.name = None + self.type = None + self.etag = None + self.system_data = None + self.description = kwargs.get('description', None) + self.immutable_id = kwargs.get('immutable_id', None) + self.configuration_access = kwargs.get('configuration_access', None) + self.logs_ingestion = kwargs.get('logs_ingestion', None) + self.network_acls = kwargs.get('network_acls', None) + self.provisioning_state = None + + +class DataCollectionEndpointResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionEndpointResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointResourceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class DataCollectionEndpointResourceProperties(DataCollectionEndpoint): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection endpoint. + :type description: str + :param immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :type immutable_id: str + :param configuration_access: The endpoint used by agents to access their configuration. + :type configuration_access: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointConfigurationAccess + :param logs_ingestion: The endpoint used by clients to ingest logs. + :type logs_ingestion: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointLogsIngestion + :param network_acls: Network access control rules for the endpoints. + :type network_acls: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'configuration_access': {'key': 'configurationAccess', 'type': 'DataCollectionEndpointConfigurationAccess'}, + 'logs_ingestion': {'key': 'logsIngestion', 'type': 'DataCollectionEndpointLogsIngestion'}, + 'network_acls': {'key': 'networkAcls', 'type': 'DataCollectionEndpointNetworkAcls'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointResourceProperties, self).__init__(**kwargs) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class DataCollectionEndpointResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointResourceSystemData, self).__init__(**kwargs) + + +class DataCollectionRule(msrest.serialization.Model): + """Definition of what monitoring data to collect and where that data should be sent. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection rule. + :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2021_04_01.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'immutable_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRule, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.immutable_id = None + self.data_sources = kwargs.get('data_sources', None) + self.destinations = kwargs.get('destinations', None) + self.data_flows = kwargs.get('data_flows', None) + self.provisioning_state = None + + +class DataCollectionRuleAssociation(msrest.serialization.Model): + """Definition of association of a data collection rule with a monitored Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :type data_collection_rule_id: str + :param data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :type data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'data_collection_endpoint_id': {'key': 'dataCollectionEndpointId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociation, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.data_collection_rule_id = kwargs.get('data_collection_rule_id', None) + self.data_collection_endpoint_id = kwargs.get('data_collection_endpoint_id', None) + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model): + """Definition of generic ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceSystemData + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :type data_collection_rule_id: str + :param data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :type data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'DataCollectionRuleAssociationProxyOnlyResourceSystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'properties.dataCollectionRuleId', 'type': 'str'}, + 'data_collection_endpoint_id': {'key': 'properties.dataCollectionEndpointId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = None + self.system_data = None + self.description = kwargs.get('description', None) + self.data_collection_rule_id = kwargs.get('data_collection_rule_id', None) + self.data_collection_endpoint_id = kwargs.get('data_collection_endpoint_id', None) + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: + list[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleAssociationProxyOnlyResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class DataCollectionRuleAssociationProxyOnlyResourceProperties(DataCollectionRuleAssociation): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :type data_collection_rule_id: str + :param data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :type data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'data_collection_endpoint_id': {'key': 'dataCollectionEndpointId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceProperties, self).__init__(**kwargs) + + +class DataCollectionRuleAssociationProxyOnlyResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceSystemData, self).__init__(**kwargs) + + +class DataSourcesSpec(msrest.serialization.Model): + """Specification of data sources that will be collected. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: + list[~$(python-base-namespace).v2021_04_01.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: + list[~$(python-base-namespace).v2021_04_01.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2021_04_01.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base-namespace).v2021_04_01.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataSourcesSpec, self).__init__(**kwargs) + self.performance_counters = kwargs.get('performance_counters', None) + self.windows_event_logs = kwargs.get('windows_event_logs', None) + self.syslog = kwargs.get('syslog', None) + self.extensions = kwargs.get('extensions', None) + + +class DataCollectionRuleDataSources(DataSourcesSpec): + """The specification of data sources. +This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: + list[~$(python-base-namespace).v2021_04_01.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: + list[~$(python-base-namespace).v2021_04_01.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2021_04_01.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base-namespace).v2021_04_01.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleDataSources, self).__init__(**kwargs) + + +class DestinationsSpec(msrest.serialization.Model): + """Specification of destinations that can be used in data flows. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base-namespace).v2021_04_01.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: + ~$(python-base-namespace).v2021_04_01.models.DestinationsSpecAzureMonitorMetrics + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, + } + + def __init__( + self, + **kwargs + ): + super(DestinationsSpec, self).__init__(**kwargs) + self.log_analytics = kwargs.get('log_analytics', None) + self.azure_monitor_metrics = kwargs.get('azure_monitor_metrics', None) + + +class DataCollectionRuleDestinations(DestinationsSpec): + """The specification of destinations. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base-namespace).v2021_04_01.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: + ~$(python-base-namespace).v2021_04_01.models.DestinationsSpecAzureMonitorMetrics + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleDestinations, self).__init__(**kwargs) + + +class DataCollectionRuleResource(msrest.serialization.Model): + """Definition of ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param kind: The kind of the resource. Possible values include: "Linux", "Windows". + :type kind: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleResourceKind + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceSystemData + :param description: Description of the data collection rule. + :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2021_04_01.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'immutable_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'DataCollectionRuleResourceSystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'immutable_id': {'key': 'properties.immutableId', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'properties.destinations', 'type': 'DataCollectionRuleDestinations'}, + 'data_flows': {'key': 'properties.dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleResource, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.kind = kwargs.get('kind', None) + self.id = None + self.name = None + self.type = None + self.etag = None + self.system_data = None + self.description = kwargs.get('description', None) + self.immutable_id = None + self.data_sources = kwargs.get('data_sources', None) + self.destinations = kwargs.get('destinations', None) + self.data_flows = kwargs.get('data_flows', None) + self.provisioning_state = None + + +class DataCollectionRuleResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleResourceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class DataCollectionRuleResourceProperties(DataCollectionRule): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection rule. + :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2021_04_01.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'immutable_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleResourceProperties, self).__init__(**kwargs) + + +class DataCollectionRuleResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionRuleResourceSystemData, self).__init__(**kwargs) + + +class DataFlow(msrest.serialization.Model): + """Definition of which streams are sent to which destinations. + + :param streams: List of streams for this data flow. + :type streams: list[str or ~$(python-base-namespace).v2021_04_01.models.KnownDataFlowStreams] + :param destinations: List of destinations for this data flow. + :type destinations: list[str] + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'destinations': {'key': 'destinations', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataFlow, self).__init__(**kwargs) + self.streams = kwargs.get('streams', None) + self.destinations = kwargs.get('destinations', None) + + +class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): + """Azure Monitor Metrics destination. + + :param name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DestinationsSpecAzureMonitorMetrics, self).__init__(**kwargs) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2021_04_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2021_04_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponseCommonV2(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~$(python-base-namespace).v2021_04_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseCommonV2, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ExtensionDataSource(msrest.serialization.Model): + """Definition of which data will be collected from a separate VM extension that integrates with the Azure Monitor Agent. +Collected from either Windows and Linux machines, depending on which extension is defined. + + All required parameters must be populated in order to send to Azure. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownExtensionDataSourceStreams] + :param extension_name: Required. The name of the VM extension. + :type extension_name: str + :param extension_settings: The extension settings. The format is specific for particular + extension. + :type extension_settings: any + :param input_data_sources: The list of data sources this extension needs data from. + :type input_data_sources: list[str] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'extension_name': {'required': True}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'extension_name': {'key': 'extensionName', 'type': 'str'}, + 'extension_settings': {'key': 'extensionSettings', 'type': 'object'}, + 'input_data_sources': {'key': 'inputDataSources', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtensionDataSource, self).__init__(**kwargs) + self.streams = kwargs.get('streams', None) + self.extension_name = kwargs['extension_name'] + self.extension_settings = kwargs.get('extension_settings', None) + self.input_data_sources = kwargs.get('input_data_sources', None) + self.name = kwargs.get('name', None) + + +class LogAnalyticsDestination(msrest.serialization.Model): + """Log Analytics destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param workspace_resource_id: The resource ID of the Log Analytics workspace. + :type workspace_resource_id: str + :ivar workspace_id: The Customer ID of the Log Analytics workspace. + :vartype workspace_id: str + :param name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'workspace_id': {'readonly': True}, + } + + _attribute_map = { + 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogAnalyticsDestination, self).__init__(**kwargs) + self.workspace_resource_id = kwargs.get('workspace_resource_id', None) + self.workspace_id = None + self.name = kwargs.get('name', None) + + +class PerfCounterDataSource(msrest.serialization.Model): + """Definition of which performance counters will be collected and how they will be collected by this data collection rule. +Collected from both Windows and Linux machines where the counter is present. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownPerfCounterDataSourceStreams] + :param sampling_frequency_in_seconds: The number of seconds between consecutive counter + measurements (samples). + :type sampling_frequency_in_seconds: int + :param counter_specifiers: A list of specifier names of the performance counters you want to + collect. + Use a wildcard (*) to collect a counter for all instances. + To get a list of performance counters on Windows, run the command 'typeperf'. + :type counter_specifiers: list[str] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'sampling_frequency_in_seconds': {'key': 'samplingFrequencyInSeconds', 'type': 'int'}, + 'counter_specifiers': {'key': 'counterSpecifiers', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PerfCounterDataSource, self).__init__(**kwargs) + self.streams = kwargs.get('streams', None) + self.sampling_frequency_in_seconds = kwargs.get('sampling_frequency_in_seconds', None) + self.counter_specifiers = kwargs.get('counter_specifiers', None) + self.name = kwargs.get('name', None) + + +class ResourceForUpdate(msrest.serialization.Model): + """Definition of ARM tracked top level resource properties for update operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceForUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class SyslogDataSource(msrest.serialization.Model): + """Definition of which syslog data will be collected and how it will be collected. +Only collected from Linux machines. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownSyslogDataSourceStreams] + :param facility_names: The list of facility names. + :type facility_names: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownSyslogDataSourceFacilityNames] + :param log_levels: The log levels to collect. + :type log_levels: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownSyslogDataSourceLogLevels] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'facility_names': {'key': 'facilityNames', 'type': '[str]'}, + 'log_levels': {'key': 'logLevels', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SyslogDataSource, self).__init__(**kwargs) + self.streams = kwargs.get('streams', None) + self.facility_names = kwargs.get('facility_names', None) + self.log_levels = kwargs.get('log_levels', None) + self.name = kwargs.get('name', None) + + +class WindowsEventLogDataSource(msrest.serialization.Model): + """Definition of which Windows Event Log events will be collected and how they will be collected. +Only collected from Windows machines. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownWindowsEventLogDataSourceStreams] + :param x_path_queries: A list of Windows Event Log queries in XPATH format. + :type x_path_queries: list[str] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'x_path_queries': {'key': 'xPathQueries', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WindowsEventLogDataSource, self).__init__(**kwargs) + self.streams = kwargs.get('streams', None) + self.x_path_queries = kwargs.get('x_path_queries', None) + self.name = kwargs.get('name', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_models_py3.py new file mode 100644 index 0000000000000..b0edf7f37ce69 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_models_py3.py @@ -0,0 +1,1533 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._monitor_management_client_enums import * + + +class AzureMonitorMetricsDestination(msrest.serialization.Model): + """Azure Monitor Metrics destination. + + :param name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + super(AzureMonitorMetricsDestination, self).__init__(**kwargs) + self.name = name + + +class ConfigurationAccessEndpointSpec(msrest.serialization.Model): + """Definition of the endpoint used for accessing configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConfigurationAccessEndpointSpec, self).__init__(**kwargs) + self.endpoint = None + + +class DataCollectionEndpoint(msrest.serialization.Model): + """Definition of data collection endpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection endpoint. + :type description: str + :param immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :type immutable_id: str + :param configuration_access: The endpoint used by agents to access their configuration. + :type configuration_access: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointConfigurationAccess + :param logs_ingestion: The endpoint used by clients to ingest logs. + :type logs_ingestion: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointLogsIngestion + :param network_acls: Network access control rules for the endpoints. + :type network_acls: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'configuration_access': {'key': 'configurationAccess', 'type': 'DataCollectionEndpointConfigurationAccess'}, + 'logs_ingestion': {'key': 'logsIngestion', 'type': 'DataCollectionEndpointLogsIngestion'}, + 'network_acls': {'key': 'networkAcls', 'type': 'DataCollectionEndpointNetworkAcls'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + immutable_id: Optional[str] = None, + configuration_access: Optional["DataCollectionEndpointConfigurationAccess"] = None, + logs_ingestion: Optional["DataCollectionEndpointLogsIngestion"] = None, + network_acls: Optional["DataCollectionEndpointNetworkAcls"] = None, + **kwargs + ): + super(DataCollectionEndpoint, self).__init__(**kwargs) + self.description = description + self.immutable_id = immutable_id + self.configuration_access = configuration_access + self.logs_ingestion = logs_ingestion + self.network_acls = network_acls + self.provisioning_state = None + + +class DataCollectionEndpointConfigurationAccess(ConfigurationAccessEndpointSpec): + """The endpoint used by agents to access their configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointConfigurationAccess, self).__init__(**kwargs) + + +class LogsIngestionEndpointSpec(msrest.serialization.Model): + """Definition of the endpoint used for ingesting logs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogsIngestionEndpointSpec, self).__init__(**kwargs) + self.endpoint = None + + +class DataCollectionEndpointLogsIngestion(LogsIngestionEndpointSpec): + """The endpoint used by clients to ingest logs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataCollectionEndpointLogsIngestion, self).__init__(**kwargs) + + +class NetworkRuleSet(msrest.serialization.Model): + """Definition of the network rules. + + :param public_network_access: The configuration to set whether network access from public + internet to the endpoints are allowed. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~$(python-base-namespace).v2021_04_01.models.KnownPublicNetworkAccessOptions + """ + + _attribute_map = { + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + public_network_access: Optional[Union[str, "KnownPublicNetworkAccessOptions"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.public_network_access = public_network_access + + +class DataCollectionEndpointNetworkAcls(NetworkRuleSet): + """Network access control rules for the endpoints. + + :param public_network_access: The configuration to set whether network access from public + internet to the endpoints are allowed. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~$(python-base-namespace).v2021_04_01.models.KnownPublicNetworkAccessOptions + """ + + _attribute_map = { + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + public_network_access: Optional[Union[str, "KnownPublicNetworkAccessOptions"]] = None, + **kwargs + ): + super(DataCollectionEndpointNetworkAcls, self).__init__(public_network_access=public_network_access, **kwargs) + + +class DataCollectionEndpointResource(msrest.serialization.Model): + """Definition of ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param kind: The kind of the resource. Possible values include: "Linux", "Windows". + :type kind: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointResourceKind + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceSystemData + :param description: Description of the data collection endpoint. + :type description: str + :param immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :type immutable_id: str + :param configuration_access: The endpoint used by agents to access their configuration. + :type configuration_access: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointConfigurationAccess + :param logs_ingestion: The endpoint used by clients to ingest logs. + :type logs_ingestion: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointLogsIngestion + :param network_acls: Network access control rules for the endpoints. + :type network_acls: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointProvisioningState + """ + + _validation = { + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'DataCollectionEndpointResourceSystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'immutable_id': {'key': 'properties.immutableId', 'type': 'str'}, + 'configuration_access': {'key': 'properties.configurationAccess', 'type': 'DataCollectionEndpointConfigurationAccess'}, + 'logs_ingestion': {'key': 'properties.logsIngestion', 'type': 'DataCollectionEndpointLogsIngestion'}, + 'network_acls': {'key': 'properties.networkAcls', 'type': 'DataCollectionEndpointNetworkAcls'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "KnownDataCollectionEndpointResourceKind"]] = None, + description: Optional[str] = None, + immutable_id: Optional[str] = None, + configuration_access: Optional["DataCollectionEndpointConfigurationAccess"] = None, + logs_ingestion: Optional["DataCollectionEndpointLogsIngestion"] = None, + network_acls: Optional["DataCollectionEndpointNetworkAcls"] = None, + **kwargs + ): + super(DataCollectionEndpointResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.kind = kind + self.id = None + self.name = None + self.type = None + self.etag = None + self.system_data = None + self.description = description + self.immutable_id = immutable_id + self.configuration_access = configuration_access + self.logs_ingestion = logs_ingestion + self.network_acls = network_acls + self.provisioning_state = None + + +class DataCollectionEndpointResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionEndpointResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DataCollectionEndpointResource"], + next_link: Optional[str] = None, + **kwargs + ): + super(DataCollectionEndpointResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionEndpointResourceProperties(DataCollectionEndpoint): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection endpoint. + :type description: str + :param immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :type immutable_id: str + :param configuration_access: The endpoint used by agents to access their configuration. + :type configuration_access: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointConfigurationAccess + :param logs_ingestion: The endpoint used by clients to ingest logs. + :type logs_ingestion: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointLogsIngestion + :param network_acls: Network access control rules for the endpoints. + :type network_acls: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionEndpointProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'configuration_access': {'key': 'configurationAccess', 'type': 'DataCollectionEndpointConfigurationAccess'}, + 'logs_ingestion': {'key': 'logsIngestion', 'type': 'DataCollectionEndpointLogsIngestion'}, + 'network_acls': {'key': 'networkAcls', 'type': 'DataCollectionEndpointNetworkAcls'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + immutable_id: Optional[str] = None, + configuration_access: Optional["DataCollectionEndpointConfigurationAccess"] = None, + logs_ingestion: Optional["DataCollectionEndpointLogsIngestion"] = None, + network_acls: Optional["DataCollectionEndpointNetworkAcls"] = None, + **kwargs + ): + super(DataCollectionEndpointResourceProperties, self).__init__(description=description, immutable_id=immutable_id, configuration_access=configuration_access, logs_ingestion=logs_ingestion, network_acls=network_acls, **kwargs) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "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_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class DataCollectionEndpointResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "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_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(DataCollectionEndpointResourceSystemData, self).__init__(created_by=created_by, created_by_type=created_by_type, created_at=created_at, last_modified_by=last_modified_by, last_modified_by_type=last_modified_by_type, last_modified_at=last_modified_at, **kwargs) + + +class DataCollectionRule(msrest.serialization.Model): + """Definition of what monitoring data to collect and where that data should be sent. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection rule. + :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2021_04_01.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'immutable_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_sources: Optional["DataCollectionRuleDataSources"] = None, + destinations: Optional["DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["DataFlow"]] = None, + **kwargs + ): + super(DataCollectionRule, self).__init__(**kwargs) + self.description = description + self.immutable_id = None + self.data_sources = data_sources + self.destinations = destinations + self.data_flows = data_flows + self.provisioning_state = None + + +class DataCollectionRuleAssociation(msrest.serialization.Model): + """Definition of association of a data collection rule with a monitored Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :type data_collection_rule_id: str + :param data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :type data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'data_collection_endpoint_id': {'key': 'dataCollectionEndpointId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, + data_collection_endpoint_id: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociation, self).__init__(**kwargs) + self.description = description + self.data_collection_rule_id = data_collection_rule_id + self.data_collection_endpoint_id = data_collection_endpoint_id + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResource(msrest.serialization.Model): + """Definition of generic ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceSystemData + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :type data_collection_rule_id: str + :param data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :type data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'DataCollectionRuleAssociationProxyOnlyResourceSystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'properties.dataCollectionRuleId', 'type': 'str'}, + 'data_collection_endpoint_id': {'key': 'properties.dataCollectionEndpointId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, + data_collection_endpoint_id: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = None + self.system_data = None + self.description = description + self.data_collection_rule_id = data_collection_rule_id + self.data_collection_endpoint_id = data_collection_endpoint_id + self.provisioning_state = None + + +class DataCollectionRuleAssociationProxyOnlyResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: + list[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleAssociationProxyOnlyResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DataCollectionRuleAssociationProxyOnlyResource"], + next_link: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionRuleAssociationProxyOnlyResourceProperties(DataCollectionRuleAssociation): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the association. + :type description: str + :param data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :type data_collection_rule_id: str + :param data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :type data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleAssociationProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'data_collection_rule_id': {'key': 'dataCollectionRuleId', 'type': 'str'}, + 'data_collection_endpoint_id': {'key': 'dataCollectionEndpointId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, + data_collection_endpoint_id: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceProperties, self).__init__(description=description, data_collection_rule_id=data_collection_rule_id, data_collection_endpoint_id=data_collection_endpoint_id, **kwargs) + + +class DataCollectionRuleAssociationProxyOnlyResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "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_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(DataCollectionRuleAssociationProxyOnlyResourceSystemData, self).__init__(created_by=created_by, created_by_type=created_by_type, created_at=created_at, last_modified_by=last_modified_by, last_modified_by_type=last_modified_by_type, last_modified_at=last_modified_at, **kwargs) + + +class DataSourcesSpec(msrest.serialization.Model): + """Specification of data sources that will be collected. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: + list[~$(python-base-namespace).v2021_04_01.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: + list[~$(python-base-namespace).v2021_04_01.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2021_04_01.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base-namespace).v2021_04_01.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + *, + performance_counters: Optional[List["PerfCounterDataSource"]] = None, + windows_event_logs: Optional[List["WindowsEventLogDataSource"]] = None, + syslog: Optional[List["SyslogDataSource"]] = None, + extensions: Optional[List["ExtensionDataSource"]] = None, + **kwargs + ): + super(DataSourcesSpec, self).__init__(**kwargs) + self.performance_counters = performance_counters + self.windows_event_logs = windows_event_logs + self.syslog = syslog + self.extensions = extensions + + +class DataCollectionRuleDataSources(DataSourcesSpec): + """The specification of data sources. +This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + + :param performance_counters: The list of performance counter data source configurations. + :type performance_counters: + list[~$(python-base-namespace).v2021_04_01.models.PerfCounterDataSource] + :param windows_event_logs: The list of Windows Event Log data source configurations. + :type windows_event_logs: + list[~$(python-base-namespace).v2021_04_01.models.WindowsEventLogDataSource] + :param syslog: The list of Syslog data source configurations. + :type syslog: list[~$(python-base-namespace).v2021_04_01.models.SyslogDataSource] + :param extensions: The list of Azure VM extension data source configurations. + :type extensions: list[~$(python-base-namespace).v2021_04_01.models.ExtensionDataSource] + """ + + _attribute_map = { + 'performance_counters': {'key': 'performanceCounters', 'type': '[PerfCounterDataSource]'}, + 'windows_event_logs': {'key': 'windowsEventLogs', 'type': '[WindowsEventLogDataSource]'}, + 'syslog': {'key': 'syslog', 'type': '[SyslogDataSource]'}, + 'extensions': {'key': 'extensions', 'type': '[ExtensionDataSource]'}, + } + + def __init__( + self, + *, + performance_counters: Optional[List["PerfCounterDataSource"]] = None, + windows_event_logs: Optional[List["WindowsEventLogDataSource"]] = None, + syslog: Optional[List["SyslogDataSource"]] = None, + extensions: Optional[List["ExtensionDataSource"]] = None, + **kwargs + ): + super(DataCollectionRuleDataSources, self).__init__(performance_counters=performance_counters, windows_event_logs=windows_event_logs, syslog=syslog, extensions=extensions, **kwargs) + + +class DestinationsSpec(msrest.serialization.Model): + """Specification of destinations that can be used in data flows. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base-namespace).v2021_04_01.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: + ~$(python-base-namespace).v2021_04_01.models.DestinationsSpecAzureMonitorMetrics + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, + } + + def __init__( + self, + *, + log_analytics: Optional[List["LogAnalyticsDestination"]] = None, + azure_monitor_metrics: Optional["DestinationsSpecAzureMonitorMetrics"] = None, + **kwargs + ): + super(DestinationsSpec, self).__init__(**kwargs) + self.log_analytics = log_analytics + self.azure_monitor_metrics = azure_monitor_metrics + + +class DataCollectionRuleDestinations(DestinationsSpec): + """The specification of destinations. + + :param log_analytics: List of Log Analytics destinations. + :type log_analytics: list[~$(python-base-namespace).v2021_04_01.models.LogAnalyticsDestination] + :param azure_monitor_metrics: Azure Monitor Metrics destination. + :type azure_monitor_metrics: + ~$(python-base-namespace).v2021_04_01.models.DestinationsSpecAzureMonitorMetrics + """ + + _attribute_map = { + 'log_analytics': {'key': 'logAnalytics', 'type': '[LogAnalyticsDestination]'}, + 'azure_monitor_metrics': {'key': 'azureMonitorMetrics', 'type': 'DestinationsSpecAzureMonitorMetrics'}, + } + + def __init__( + self, + *, + log_analytics: Optional[List["LogAnalyticsDestination"]] = None, + azure_monitor_metrics: Optional["DestinationsSpecAzureMonitorMetrics"] = None, + **kwargs + ): + super(DataCollectionRuleDestinations, self).__init__(log_analytics=log_analytics, azure_monitor_metrics=azure_monitor_metrics, **kwargs) + + +class DataCollectionRuleResource(msrest.serialization.Model): + """Definition of ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param kind: The kind of the resource. Possible values include: "Linux", "Windows". + :type kind: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleResourceKind + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: + ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceSystemData + :param description: Description of the data collection rule. + :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2021_04_01.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'location': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'immutable_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'DataCollectionRuleResourceSystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'immutable_id': {'key': 'properties.immutableId', 'type': 'str'}, + 'data_sources': {'key': 'properties.dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'properties.destinations', 'type': 'DataCollectionRuleDestinations'}, + 'data_flows': {'key': 'properties.dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "KnownDataCollectionRuleResourceKind"]] = None, + description: Optional[str] = None, + data_sources: Optional["DataCollectionRuleDataSources"] = None, + destinations: Optional["DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["DataFlow"]] = None, + **kwargs + ): + super(DataCollectionRuleResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.kind = kind + self.id = None + self.name = None + self.type = None + self.etag = None + self.system_data = None + self.description = description + self.immutable_id = None + self.data_sources = data_sources + self.destinations = destinations + self.data_flows = data_flows + self.provisioning_state = None + + +class DataCollectionRuleResourceListResult(msrest.serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A list of resources. + :type value: list[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataCollectionRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DataCollectionRuleResource"], + next_link: Optional[str] = None, + **kwargs + ): + super(DataCollectionRuleResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionRuleResourceProperties(DataCollectionRule): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param description: Description of the data collection rule. + :type description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :param data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :type data_sources: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDataSources + :param destinations: The specification of destinations. + :type destinations: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleDestinations + :param data_flows: The specification of data flows. + :type data_flows: list[~$(python-base-namespace).v2021_04_01.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~$(python-base-namespace).v2021_04_01.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + 'immutable_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataCollectionRuleDataSources'}, + 'destinations': {'key': 'destinations', 'type': 'DataCollectionRuleDestinations'}, + 'data_flows': {'key': 'dataFlows', 'type': '[DataFlow]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_sources: Optional["DataCollectionRuleDataSources"] = None, + destinations: Optional["DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["DataFlow"]] = None, + **kwargs + ): + super(DataCollectionRuleResourceProperties, self).__init__(description=description, data_sources=data_sources, destinations=destinations, data_flows=data_flows, **kwargs) + + +class DataCollectionRuleResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~$(python-base-namespace).v2021_04_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "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_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(DataCollectionRuleResourceSystemData, self).__init__(created_by=created_by, created_by_type=created_by_type, created_at=created_at, last_modified_by=last_modified_by, last_modified_by_type=last_modified_by_type, last_modified_at=last_modified_at, **kwargs) + + +class DataFlow(msrest.serialization.Model): + """Definition of which streams are sent to which destinations. + + :param streams: List of streams for this data flow. + :type streams: list[str or ~$(python-base-namespace).v2021_04_01.models.KnownDataFlowStreams] + :param destinations: List of destinations for this data flow. + :type destinations: list[str] + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'destinations': {'key': 'destinations', 'type': '[str]'}, + } + + def __init__( + self, + *, + streams: Optional[List[Union[str, "KnownDataFlowStreams"]]] = None, + destinations: Optional[List[str]] = None, + **kwargs + ): + super(DataFlow, self).__init__(**kwargs) + self.streams = streams + self.destinations = destinations + + +class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): + """Azure Monitor Metrics destination. + + :param name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + super(DestinationsSpecAzureMonitorMetrics, self).__init__(name=name, **kwargs) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~$(python-base-namespace).v2021_04_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~$(python-base-namespace).v2021_04_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponseCommonV2(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~$(python-base-namespace).v2021_04_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponseCommonV2, self).__init__(**kwargs) + self.error = error + + +class ExtensionDataSource(msrest.serialization.Model): + """Definition of which data will be collected from a separate VM extension that integrates with the Azure Monitor Agent. +Collected from either Windows and Linux machines, depending on which extension is defined. + + All required parameters must be populated in order to send to Azure. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownExtensionDataSourceStreams] + :param extension_name: Required. The name of the VM extension. + :type extension_name: str + :param extension_settings: The extension settings. The format is specific for particular + extension. + :type extension_settings: any + :param input_data_sources: The list of data sources this extension needs data from. + :type input_data_sources: list[str] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'extension_name': {'required': True}, + } + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'extension_name': {'key': 'extensionName', 'type': 'str'}, + 'extension_settings': {'key': 'extensionSettings', 'type': 'object'}, + 'input_data_sources': {'key': 'inputDataSources', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + extension_name: str, + streams: Optional[List[Union[str, "KnownExtensionDataSourceStreams"]]] = None, + extension_settings: Optional[Any] = None, + input_data_sources: Optional[List[str]] = None, + name: Optional[str] = None, + **kwargs + ): + super(ExtensionDataSource, self).__init__(**kwargs) + self.streams = streams + self.extension_name = extension_name + self.extension_settings = extension_settings + self.input_data_sources = input_data_sources + self.name = name + + +class LogAnalyticsDestination(msrest.serialization.Model): + """Log Analytics destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param workspace_resource_id: The resource ID of the Log Analytics workspace. + :type workspace_resource_id: str + :ivar workspace_id: The Customer ID of the Log Analytics workspace. + :vartype workspace_id: str + :param name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :type name: str + """ + + _validation = { + 'workspace_id': {'readonly': True}, + } + + _attribute_map = { + 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + workspace_resource_id: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + super(LogAnalyticsDestination, self).__init__(**kwargs) + self.workspace_resource_id = workspace_resource_id + self.workspace_id = None + self.name = name + + +class PerfCounterDataSource(msrest.serialization.Model): + """Definition of which performance counters will be collected and how they will be collected by this data collection rule. +Collected from both Windows and Linux machines where the counter is present. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownPerfCounterDataSourceStreams] + :param sampling_frequency_in_seconds: The number of seconds between consecutive counter + measurements (samples). + :type sampling_frequency_in_seconds: int + :param counter_specifiers: A list of specifier names of the performance counters you want to + collect. + Use a wildcard (*) to collect a counter for all instances. + To get a list of performance counters on Windows, run the command 'typeperf'. + :type counter_specifiers: list[str] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'sampling_frequency_in_seconds': {'key': 'samplingFrequencyInSeconds', 'type': 'int'}, + 'counter_specifiers': {'key': 'counterSpecifiers', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + streams: Optional[List[Union[str, "KnownPerfCounterDataSourceStreams"]]] = None, + sampling_frequency_in_seconds: Optional[int] = None, + counter_specifiers: Optional[List[str]] = None, + name: Optional[str] = None, + **kwargs + ): + super(PerfCounterDataSource, self).__init__(**kwargs) + self.streams = streams + self.sampling_frequency_in_seconds = sampling_frequency_in_seconds + self.counter_specifiers = counter_specifiers + self.name = name + + +class ResourceForUpdate(msrest.serialization.Model): + """Definition of ARM tracked top level resource properties for update operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceForUpdate, self).__init__(**kwargs) + self.tags = tags + + +class SyslogDataSource(msrest.serialization.Model): + """Definition of which syslog data will be collected and how it will be collected. +Only collected from Linux machines. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownSyslogDataSourceStreams] + :param facility_names: The list of facility names. + :type facility_names: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownSyslogDataSourceFacilityNames] + :param log_levels: The log levels to collect. + :type log_levels: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownSyslogDataSourceLogLevels] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'facility_names': {'key': 'facilityNames', 'type': '[str]'}, + 'log_levels': {'key': 'logLevels', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + streams: Optional[List[Union[str, "KnownSyslogDataSourceStreams"]]] = None, + facility_names: Optional[List[Union[str, "KnownSyslogDataSourceFacilityNames"]]] = None, + log_levels: Optional[List[Union[str, "KnownSyslogDataSourceLogLevels"]]] = None, + name: Optional[str] = None, + **kwargs + ): + super(SyslogDataSource, self).__init__(**kwargs) + self.streams = streams + self.facility_names = facility_names + self.log_levels = log_levels + self.name = name + + +class WindowsEventLogDataSource(msrest.serialization.Model): + """Definition of which Windows Event Log events will be collected and how they will be collected. +Only collected from Windows machines. + + :param streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :type streams: list[str or + ~$(python-base-namespace).v2021_04_01.models.KnownWindowsEventLogDataSourceStreams] + :param x_path_queries: A list of Windows Event Log queries in XPATH format. + :type x_path_queries: list[str] + :param name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :type name: str + """ + + _attribute_map = { + 'streams': {'key': 'streams', 'type': '[str]'}, + 'x_path_queries': {'key': 'xPathQueries', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + streams: Optional[List[Union[str, "KnownWindowsEventLogDataSourceStreams"]]] = None, + x_path_queries: Optional[List[str]] = None, + name: Optional[str] = None, + **kwargs + ): + super(WindowsEventLogDataSource, self).__init__(**kwargs) + self.streams = streams + self.x_path_queries = x_path_queries + self.name = name diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_monitor_management_client_enums.py new file mode 100644 index 0000000000000..9617f5f9e1e38 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/models/_monitor_management_client_enums.py @@ -0,0 +1,154 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class KnownDataCollectionEndpointProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource provisioning state. This property is READ-ONLY. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class KnownDataCollectionEndpointResourceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The kind of the resource. + """ + + LINUX = "Linux" + WINDOWS = "Windows" + +class KnownDataCollectionRuleAssociationProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource provisioning state. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class KnownDataCollectionRuleProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource provisioning state. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class KnownDataCollectionRuleResourceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The kind of the resource. + """ + + LINUX = "Linux" + WINDOWS = "Windows" + +class KnownDataFlowStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_EVENT = "Microsoft-Event" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_SYSLOG = "Microsoft-Syslog" + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + +class KnownExtensionDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_EVENT = "Microsoft-Event" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_SYSLOG = "Microsoft-Syslog" + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + +class KnownPerfCounterDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + +class KnownPublicNetworkAccessOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The configuration to set whether network access from public internet to the endpoints are + allowed. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class KnownSyslogDataSourceFacilityNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + AUTH = "auth" + AUTHPRIV = "authpriv" + CRON = "cron" + DAEMON = "daemon" + KERN = "kern" + LPR = "lpr" + MAIL = "mail" + MARK = "mark" + NEWS = "news" + SYSLOG = "syslog" + USER = "user" + UUCP = "uucp" + LOCAL0 = "local0" + LOCAL1 = "local1" + LOCAL2 = "local2" + LOCAL3 = "local3" + LOCAL4 = "local4" + LOCAL5 = "local5" + LOCAL6 = "local6" + LOCAL7 = "local7" + ASTERISK = "*" + +class KnownSyslogDataSourceLogLevels(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DEBUG = "Debug" + INFO = "Info" + NOTICE = "Notice" + WARNING = "Warning" + ERROR = "Error" + CRITICAL = "Critical" + ALERT = "Alert" + EMERGENCY = "Emergency" + ASTERISK = "*" + +class KnownSyslogDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_SYSLOG = "Microsoft-Syslog" + +class KnownWindowsEventLogDataSourceStreams(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + MICROSOFT_EVENT = "Microsoft-Event" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/__init__.py new file mode 100644 index 0000000000000..86676ba926236 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_collection_endpoints_operations import DataCollectionEndpointsOperations +from ._data_collection_rule_associations_operations import DataCollectionRuleAssociationsOperations +from ._data_collection_rules_operations import DataCollectionRulesOperations + +__all__ = [ + 'DataCollectionEndpointsOperations', + 'DataCollectionRuleAssociationsOperations', + 'DataCollectionRulesOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_endpoints_operations.py new file mode 100644 index 0000000000000..623b4484c48f0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_endpoints_operations.py @@ -0,0 +1,465 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionEndpointsOperations(object): + """DataCollectionEndpointsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionEndpointResourceListResult"] + """Lists all data collection endpoints in the specified resource group. + + Lists all data collection endpoints in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionEndpointResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionEndpointResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionEndpointResourceListResult"] + """Lists all data collection endpoints in the specified subscription. + + Lists all data collection endpoints in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionEndpointResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionEndpointResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints'} # type: ignore + + def get( + self, + resource_group_name, # type: str + data_collection_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionEndpointResource" + """Returns the specified data collection endpoint. + + Returns the specified data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionEndpointResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + + def create( + self, + resource_group_name, # type: str + data_collection_endpoint_name, # type: str + body=None, # type: Optional["_models.DataCollectionEndpointResource"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionEndpointResource" + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionEndpointResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionEndpointResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + data_collection_endpoint_name, # type: str + body=None, # type: Optional["_models.ResourceForUpdate"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionEndpointResource" + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionEndpointResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionEndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionEndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'ResourceForUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionEndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + data_collection_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a data collection endpoint. + + Deletes a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. + :type data_collection_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionEndpointName': self._serialize.url("data_collection_endpoint_name", data_collection_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rule_associations_operations.py new file mode 100644 index 0000000000000..9f6b43e857d19 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rule_associations_operations.py @@ -0,0 +1,393 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRuleAssociationsOperations(object): + """DataCollectionRuleAssociationsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource( + self, + resource_uri, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + """Lists associations for the specified resource. + + Lists associations for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations'} # type: ignore + + def list_by_rule( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + """Lists associations for the specified data collection rule. + + Lists associations for the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations'} # type: ignore + + def get( + self, + resource_uri, # type: str + association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleAssociationProxyOnlyResource" + """Returns the specified association. + + Returns the specified association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + def create( + self, + resource_uri, # type: str + association_name, # type: str + body=None, # type: Optional["_models.DataCollectionRuleAssociationProxyOnlyResource"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleAssociationProxyOnlyResource" + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. + :type association_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleAssociationProxyOnlyResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleAssociationProxyOnlyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleAssociationProxyOnlyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleAssociationProxyOnlyResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleAssociationProxyOnlyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore + + def delete( + self, + resource_uri, # type: str + association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an association. + + Deletes an association. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. + :type association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True, min_length=1), + 'associationName': self._serialize.url("association_name", association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rules_operations.py new file mode 100644 index 0000000000000..287d2a2318343 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/operations/_data_collection_rules_operations.py @@ -0,0 +1,465 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataCollectionRulesOperations(object): + """DataCollectionRulesOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_04_01.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleResourceListResult"] + """Lists all data collection rules in the specified resource group. + + Lists all data collection rules in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataCollectionRuleResourceListResult"] + """Lists all data collection rules in the specified subscription. + + Lists all data collection rules in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataCollectionRuleResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataCollectionRuleResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules'} # type: ignore + + def get( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleResource" + """Returns the specified data collection rule. + + Returns the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + def create( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + body=None, # type: Optional["_models.DataCollectionRuleResource"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleResource" + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DataCollectionRuleResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + body=None, # type: Optional["_models.ResourceForUpdate"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DataCollectionRuleResource" + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :param body: The payload. + :type body: ~$(python-base-namespace).v2021_04_01.models.ResourceForUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataCollectionRuleResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_04_01.models.DataCollectionRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataCollectionRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'ResourceForUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataCollectionRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + data_collection_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a data collection rule. + + Deletes a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. + :type data_collection_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'dataCollectionRuleName': self._serialize.url("data_collection_rule_name", data_collection_rule_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/py.typed b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/__init__.py new file mode 100644 index 0000000000000..d824795100926 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_management_client import MonitorManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['MonitorManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_configuration.py new file mode 100644 index 0000000000000..8c42b54730121 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_metadata.json b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_metadata.json new file mode 100644 index 0000000000000..96baf546834bd --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_metadata.json @@ -0,0 +1,106 @@ +{ + "chosen_version": "2021-05-01-preview", + "total_api_version_list": ["2021-05-01-preview"], + "client": { + "name": "MonitorManagementClient", + "filename": "_monitor_management_client", + "description": "Monitor Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MonitorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "diagnostic_settings": "DiagnosticSettingsOperations", + "diagnostic_settings_category": "DiagnosticSettingsCategoryOperations", + "management_group_diagnostic_settings": "ManagementGroupDiagnosticSettingsOperations", + "subscription_diagnostic_settings": "SubscriptionDiagnosticSettingsOperations" + } +} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_monitor_management_client.py new file mode 100644 index 0000000000000..20a9d07545b6d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_monitor_management_client.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import MonitorManagementClientConfiguration +from .operations import DiagnosticSettingsOperations +from .operations import DiagnosticSettingsCategoryOperations +from .operations import ManagementGroupDiagnosticSettingsOperations +from .operations import SubscriptionDiagnosticSettingsOperations +from . import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar diagnostic_settings: DiagnosticSettingsOperations operations + :vartype diagnostic_settings: $(python-base-namespace).v2021_05_01_preview.operations.DiagnosticSettingsOperations + :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations + :vartype diagnostic_settings_category: $(python-base-namespace).v2021_05_01_preview.operations.DiagnosticSettingsCategoryOperations + :ivar management_group_diagnostic_settings: ManagementGroupDiagnosticSettingsOperations operations + :vartype management_group_diagnostic_settings: $(python-base-namespace).v2021_05_01_preview.operations.ManagementGroupDiagnosticSettingsOperations + :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations + :vartype subscription_diagnostic_settings: $(python-base-namespace).v2021_05_01_preview.operations.SubscriptionDiagnosticSettingsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.diagnostic_settings = DiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MonitorManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..96ce9b45c05b5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient'] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..af72dcd13a9f8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class MonitorManagementClientConfiguration(Configuration): + """Configuration for MonitorManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_monitor_management_client.py new file mode 100644 index 0000000000000..4885d1a8aef9d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/_monitor_management_client.py @@ -0,0 +1,96 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MonitorManagementClientConfiguration +from .operations import DiagnosticSettingsOperations +from .operations import DiagnosticSettingsCategoryOperations +from .operations import ManagementGroupDiagnosticSettingsOperations +from .operations import SubscriptionDiagnosticSettingsOperations +from .. import models + + +class MonitorManagementClient(object): + """Monitor Management Client. + + :ivar diagnostic_settings: DiagnosticSettingsOperations operations + :vartype diagnostic_settings: $(python-base-namespace).v2021_05_01_preview.aio.operations.DiagnosticSettingsOperations + :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations + :vartype diagnostic_settings_category: $(python-base-namespace).v2021_05_01_preview.aio.operations.DiagnosticSettingsCategoryOperations + :ivar management_group_diagnostic_settings: ManagementGroupDiagnosticSettingsOperations operations + :vartype management_group_diagnostic_settings: $(python-base-namespace).v2021_05_01_preview.aio.operations.ManagementGroupDiagnosticSettingsOperations + :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations + :vartype subscription_diagnostic_settings: $(python-base-namespace).v2021_05_01_preview.aio.operations.SubscriptionDiagnosticSettingsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.diagnostic_settings = DiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MonitorManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..b6b49b4266985 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._diagnostic_settings_operations import DiagnosticSettingsOperations +from ._diagnostic_settings_category_operations import DiagnosticSettingsCategoryOperations +from ._management_group_diagnostic_settings_operations import ManagementGroupDiagnosticSettingsOperations +from ._subscription_diagnostic_settings_operations import SubscriptionDiagnosticSettingsOperations + +__all__ = [ + 'DiagnosticSettingsOperations', + 'DiagnosticSettingsCategoryOperations', + 'ManagementGroupDiagnosticSettingsOperations', + 'SubscriptionDiagnosticSettingsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py new file mode 100644 index 0000000000000..aa9858884eae9 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_category_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticSettingsCategoryOperations: + """DiagnosticSettingsCategoryOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_uri: str, + name: str, + **kwargs: Any + ) -> "_models.DiagnosticSettingsCategoryResource": + """Gets the diagnostic settings category for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsCategoryResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsCategoryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore + + def list( + self, + resource_uri: str, + **kwargs: Any + ) -> AsyncIterable["_models.DiagnosticSettingsCategoryResourceCollection"]: + """Lists the diagnostic settings categories for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticSettingsCategoryResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_operations.py new file mode 100644 index 0000000000000..1c0867bbab312 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_diagnostic_settings_operations.py @@ -0,0 +1,291 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticSettingsOperations: + """DiagnosticSettingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_uri: str, + name: str, + **kwargs: Any + ) -> "_models.DiagnosticSettingsResource": + """Gets the active diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + async def create_or_update( + self, + resource_uri: str, + name: str, + parameters: "_models.DiagnosticSettingsResource", + **kwargs: Any + ) -> "_models.DiagnosticSettingsResource": + """Creates or updates diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + async def delete( + self, + resource_uri: str, + name: str, + **kwargs: Any + ) -> None: + """Deletes existing diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + resource_uri: str, + **kwargs: Any + ) -> AsyncIterable["_models.DiagnosticSettingsResourceCollection"]: + """Gets the active diagnostic settings list for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticSettingsResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py new file mode 100644 index 0000000000000..0d3a2f487cb7a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_management_group_diagnostic_settings_operations.py @@ -0,0 +1,291 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupDiagnosticSettingsOperations: + """ManagementGroupDiagnosticSettingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + management_group_id: str, + name: str, + **kwargs: Any + ) -> "_models.ManagementGroupDiagnosticSettingsResource": + """Gets the active management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + async def create_or_update( + self, + management_group_id: str, + name: str, + parameters: "_models.ManagementGroupDiagnosticSettingsResource", + **kwargs: Any + ) -> "_models.ManagementGroupDiagnosticSettingsResource": + """Creates or updates management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + async def delete( + self, + management_group_id: str, + name: str, + **kwargs: Any + ) -> None: + """Deletes existing management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + management_group_id: str, + **kwargs: Any + ) -> AsyncIterable["_models.ManagementGroupDiagnosticSettingsResourceCollection"]: + """Gets the active management group diagnostic settings list for the specified management group. + + :param management_group_id: The management group id. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagementGroupDiagnosticSettingsResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py new file mode 100644 index 0000000000000..303455c75d844 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/aio/operations/_subscription_diagnostic_settings_operations.py @@ -0,0 +1,279 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionDiagnosticSettingsOperations: + """SubscriptionDiagnosticSettingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + name: str, + **kwargs: Any + ) -> "_models.SubscriptionDiagnosticSettingsResource": + """Gets the active subscription diagnostic settings for the specified resource. + + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + async def create_or_update( + self, + name: str, + parameters: "_models.SubscriptionDiagnosticSettingsResource", + **kwargs: Any + ) -> "_models.SubscriptionDiagnosticSettingsResource": + """Creates or updates subscription diagnostic settings for the specified resource. + + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + async def delete( + self, + name: str, + **kwargs: Any + ) -> None: + """Deletes existing subscription diagnostic settings for the specified resource. + + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SubscriptionDiagnosticSettingsResourceCollection"]: + """Gets the active subscription diagnostic settings list for the specified subscriptionId. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SubscriptionDiagnosticSettingsResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/__init__.py new file mode 100644 index 0000000000000..dd66e4aa49e47 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/__init__.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import DiagnosticSettingsCategoryResource + from ._models_py3 import DiagnosticSettingsCategoryResourceCollection + from ._models_py3 import DiagnosticSettingsResource + from ._models_py3 import DiagnosticSettingsResourceCollection + from ._models_py3 import ErrorResponse + from ._models_py3 import LogSettings + from ._models_py3 import ManagementGroupDiagnosticSettingsResource + from ._models_py3 import ManagementGroupDiagnosticSettingsResourceCollection + from ._models_py3 import ManagementGroupLogSettings + from ._models_py3 import MetricSettings + from ._models_py3 import Resource + from ._models_py3 import RetentionPolicy + from ._models_py3 import SubscriptionDiagnosticSettingsResource + from ._models_py3 import SubscriptionDiagnosticSettingsResourceCollection + from ._models_py3 import SubscriptionLogSettings + from ._models_py3 import SystemData +except (SyntaxError, ImportError): + from ._models import DiagnosticSettingsCategoryResource # type: ignore + from ._models import DiagnosticSettingsCategoryResourceCollection # type: ignore + from ._models import DiagnosticSettingsResource # type: ignore + from ._models import DiagnosticSettingsResourceCollection # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import LogSettings # type: ignore + from ._models import ManagementGroupDiagnosticSettingsResource # type: ignore + from ._models import ManagementGroupDiagnosticSettingsResourceCollection # type: ignore + from ._models import ManagementGroupLogSettings # type: ignore + from ._models import MetricSettings # type: ignore + from ._models import Resource # type: ignore + from ._models import RetentionPolicy # type: ignore + from ._models import SubscriptionDiagnosticSettingsResource # type: ignore + from ._models import SubscriptionDiagnosticSettingsResourceCollection # type: ignore + from ._models import SubscriptionLogSettings # type: ignore + from ._models import SystemData # type: ignore + +from ._monitor_management_client_enums import ( + CategoryType, + CreatedByType, +) + +__all__ = [ + 'DiagnosticSettingsCategoryResource', + 'DiagnosticSettingsCategoryResourceCollection', + 'DiagnosticSettingsResource', + 'DiagnosticSettingsResourceCollection', + 'ErrorResponse', + 'LogSettings', + 'ManagementGroupDiagnosticSettingsResource', + 'ManagementGroupDiagnosticSettingsResourceCollection', + 'ManagementGroupLogSettings', + 'MetricSettings', + 'Resource', + 'RetentionPolicy', + 'SubscriptionDiagnosticSettingsResource', + 'SubscriptionDiagnosticSettingsResourceCollection', + 'SubscriptionLogSettings', + 'SystemData', + 'CategoryType', + 'CreatedByType', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_models.py new file mode 100644 index 0000000000000..17aa1b8f6a7ad --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_models.py @@ -0,0 +1,653 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DiagnosticSettingsCategoryResource(Resource): + """The diagnostic settings category resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param category_type: The type of the diagnostic settings category. Possible values include: + "Metrics", "Logs". + :type category_type: str or ~$(python-base-namespace).v2021_05_01_preview.models.CategoryType + :param category_groups: the collection of what category groups are supported. + :type category_groups: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'category_type': {'key': 'properties.categoryType', 'type': 'str'}, + 'category_groups': {'key': 'properties.categoryGroups', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsCategoryResource, self).__init__(**kwargs) + self.system_data = None + self.category_type = kwargs.get('category_type', None) + self.category_groups = kwargs.get('category_groups', None) + + +class DiagnosticSettingsCategoryResourceCollection(msrest.serialization.Model): + """Represents a collection of diagnostic setting category resources. + + :param value: The collection of diagnostic settings category resources. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsCategoryResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsCategoryResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DiagnosticSettingsResource(Resource): + """The diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param metrics: The list of metric settings. + :type metrics: list[~$(python-base-namespace).v2021_05_01_preview.models.MetricSettings] + :param logs: The list of logs settings. + :type logs: list[~$(python-base-namespace).v2021_05_01_preview.models.LogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which + you would like to send Diagnostic Logs. + :type marketplace_partner_id: str + :param log_analytics_destination_type: A string indicating whether the export to Log Analytics + should use the default destination type, i.e. AzureDiagnostics, or use a destination type + constructed as follows: :code:``_:code:``. Possible values are: Dedicated and null (null is default.). + :type log_analytics_destination_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'marketplace_partner_id': {'key': 'properties.marketplacePartnerId', 'type': 'str'}, + 'log_analytics_destination_type': {'key': 'properties.logAnalyticsDestinationType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsResource, self).__init__(**kwargs) + self.system_data = None + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.metrics = kwargs.get('metrics', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.marketplace_partner_id = kwargs.get('marketplace_partner_id', None) + self.log_analytics_destination_type = kwargs.get('log_analytics_destination_type', None) + + +class DiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: The collection of diagnostic settings resources;. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ErrorResponse(msrest.serialization.Model): + """Describes the format of Error response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class LogSettings(msrest.serialization.Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type this setting is applied + to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET + diagnostic settings operation. + :type category: str + :param category_group: Name of a Diagnostic Log category group for a resource type this setting + is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a + GET diagnostic settings operation. + :type category_group: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: ~$(python-base-namespace).v2021_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'category_group': {'key': 'categoryGroup', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.category_group = kwargs.get('category_group', None) + self.enabled = kwargs['enabled'] + self.retention_policy = kwargs.get('retention_policy', None) + + +class ManagementGroupDiagnosticSettingsResource(Resource): + """The management group diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: + list[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which + you would like to send Diagnostic Logs. + :type marketplace_partner_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[ManagementGroupLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'marketplace_partner_id': {'key': 'properties.marketplacePartnerId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResource, self).__init__(**kwargs) + self.system_data = None + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.marketplace_partner_id = kwargs.get('marketplace_partner_id', None) + + +class ManagementGroupDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of management group diagnostic settings resources. + + :param value: The collection of management group diagnostic settings resources. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementGroupDiagnosticSettingsResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ManagementGroupLogSettings(msrest.serialization.Model): + """Part of Management Group diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Management Group Diagnostic Log category for a resource type this + setting is applied to. + :type category: str + :param category_group: Name of a Management Group Diagnostic Log category group for a resource + type this setting is applied to. + :type category_group: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'category_group': {'key': 'categoryGroup', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementGroupLogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.category_group = kwargs.get('category_group', None) + self.enabled = kwargs['enabled'] + + +class MetricSettings(msrest.serialization.Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: the timegrain of the metric in ISO8601 format. + :type time_grain: ~datetime.timedelta + :param category: Name of a Diagnostic Metric category for a resource type this setting is + applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a + GET diagnostic settings operation. + :type category: str + :param enabled: Required. a value indicating whether this category is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this category. + :type retention_policy: ~$(python-base-namespace).v2021_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = kwargs.get('time_grain', None) + self.category = kwargs.get('category', None) + self.enabled = kwargs['enabled'] + self.retention_policy = kwargs.get('retention_policy', None) + + +class RetentionPolicy(msrest.serialization.Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A value of 0 will retain + the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs['enabled'] + self.days = kwargs['days'] + + +class SubscriptionDiagnosticSettingsResource(Resource): + """The subscription diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which + you would like to send Diagnostic Logs. + :type marketplace_partner_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[SubscriptionLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'marketplace_partner_id': {'key': 'properties.marketplacePartnerId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResource, self).__init__(**kwargs) + self.system_data = None + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + self.marketplace_partner_id = kwargs.get('marketplace_partner_id', None) + + +class SubscriptionDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of subscription diagnostic settings resources. + + :param value: The collection of subscription diagnostic settings resources. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionDiagnosticSettingsResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class SubscriptionLogSettings(msrest.serialization.Model): + """Part of Subscription diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Subscription Diagnostic Log category for a resource type this + setting is applied to. + :type category: str + :param category_group: Name of a Subscription Diagnostic Log category group for a resource type + this setting is applied to. + :type category_group: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'category_group': {'key': 'categoryGroup', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionLogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.category_group = kwargs.get('category_group', None) + self.enabled = kwargs['enabled'] + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or + ~$(python-base-namespace).v2021_05_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~$(python-base-namespace).v2021_05_01_preview.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..5cc3de570d3b1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_models_py3.py @@ -0,0 +1,726 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._monitor_management_client_enums import * + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class DiagnosticSettingsCategoryResource(Resource): + """The diagnostic settings category resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param category_type: The type of the diagnostic settings category. Possible values include: + "Metrics", "Logs". + :type category_type: str or ~$(python-base-namespace).v2021_05_01_preview.models.CategoryType + :param category_groups: the collection of what category groups are supported. + :type category_groups: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'category_type': {'key': 'properties.categoryType', 'type': 'str'}, + 'category_groups': {'key': 'properties.categoryGroups', 'type': '[str]'}, + } + + def __init__( + self, + *, + category_type: Optional[Union[str, "CategoryType"]] = None, + category_groups: Optional[List[str]] = None, + **kwargs + ): + super(DiagnosticSettingsCategoryResource, self).__init__(**kwargs) + self.system_data = None + self.category_type = category_type + self.category_groups = category_groups + + +class DiagnosticSettingsCategoryResourceCollection(msrest.serialization.Model): + """Represents a collection of diagnostic setting category resources. + + :param value: The collection of diagnostic settings category resources. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsCategoryResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["DiagnosticSettingsCategoryResource"]] = None, + **kwargs + ): + super(DiagnosticSettingsCategoryResourceCollection, self).__init__(**kwargs) + self.value = value + + +class DiagnosticSettingsResource(Resource): + """The diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param metrics: The list of metric settings. + :type metrics: list[~$(python-base-namespace).v2021_05_01_preview.models.MetricSettings] + :param logs: The list of logs settings. + :type logs: list[~$(python-base-namespace).v2021_05_01_preview.models.LogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which + you would like to send Diagnostic Logs. + :type marketplace_partner_id: str + :param log_analytics_destination_type: A string indicating whether the export to Log Analytics + should use the default destination type, i.e. AzureDiagnostics, or use a destination type + constructed as follows: :code:``_:code:``. Possible values are: Dedicated and null (null is default.). + :type log_analytics_destination_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, + 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'marketplace_partner_id': {'key': 'properties.marketplacePartnerId', 'type': 'str'}, + 'log_analytics_destination_type': {'key': 'properties.logAnalyticsDestinationType', 'type': 'str'}, + } + + def __init__( + self, + *, + storage_account_id: Optional[str] = None, + service_bus_rule_id: Optional[str] = None, + event_hub_authorization_rule_id: Optional[str] = None, + event_hub_name: Optional[str] = None, + metrics: Optional[List["MetricSettings"]] = None, + logs: Optional[List["LogSettings"]] = None, + workspace_id: Optional[str] = None, + marketplace_partner_id: Optional[str] = None, + log_analytics_destination_type: Optional[str] = None, + **kwargs + ): + super(DiagnosticSettingsResource, self).__init__(**kwargs) + self.system_data = None + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.metrics = metrics + self.logs = logs + self.workspace_id = workspace_id + self.marketplace_partner_id = marketplace_partner_id + self.log_analytics_destination_type = log_analytics_destination_type + + +class DiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of alert rule resources. + + :param value: The collection of diagnostic settings resources;. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DiagnosticSettingsResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["DiagnosticSettingsResource"]] = None, + **kwargs + ): + super(DiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = value + + +class ErrorResponse(msrest.serialization.Model): + """Describes the format of Error response. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class LogSettings(msrest.serialization.Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Diagnostic Log category for a resource type this setting is applied + to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET + diagnostic settings operation. + :type category: str + :param category_group: Name of a Diagnostic Log category group for a resource type this setting + is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a + GET diagnostic settings operation. + :type category_group: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this log. + :type retention_policy: ~$(python-base-namespace).v2021_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'category_group': {'key': 'categoryGroup', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + *, + enabled: bool, + category: Optional[str] = None, + category_group: Optional[str] = None, + retention_policy: Optional["RetentionPolicy"] = None, + **kwargs + ): + super(LogSettings, self).__init__(**kwargs) + self.category = category + self.category_group = category_group + self.enabled = enabled + self.retention_policy = retention_policy + + +class ManagementGroupDiagnosticSettingsResource(Resource): + """The management group diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: + list[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which + you would like to send Diagnostic Logs. + :type marketplace_partner_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[ManagementGroupLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'marketplace_partner_id': {'key': 'properties.marketplacePartnerId', 'type': 'str'}, + } + + def __init__( + self, + *, + storage_account_id: Optional[str] = None, + service_bus_rule_id: Optional[str] = None, + event_hub_authorization_rule_id: Optional[str] = None, + event_hub_name: Optional[str] = None, + logs: Optional[List["ManagementGroupLogSettings"]] = None, + workspace_id: Optional[str] = None, + marketplace_partner_id: Optional[str] = None, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResource, self).__init__(**kwargs) + self.system_data = None + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.logs = logs + self.workspace_id = workspace_id + self.marketplace_partner_id = marketplace_partner_id + + +class ManagementGroupDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of management group diagnostic settings resources. + + :param value: The collection of management group diagnostic settings resources. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementGroupDiagnosticSettingsResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagementGroupDiagnosticSettingsResource"]] = None, + **kwargs + ): + super(ManagementGroupDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = value + + +class ManagementGroupLogSettings(msrest.serialization.Model): + """Part of Management Group diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Management Group Diagnostic Log category for a resource type this + setting is applied to. + :type category: str + :param category_group: Name of a Management Group Diagnostic Log category group for a resource + type this setting is applied to. + :type category_group: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'category_group': {'key': 'categoryGroup', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: bool, + category: Optional[str] = None, + category_group: Optional[str] = None, + **kwargs + ): + super(ManagementGroupLogSettings, self).__init__(**kwargs) + self.category = category + self.category_group = category_group + self.enabled = enabled + + +class MetricSettings(msrest.serialization.Model): + """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. + + All required parameters must be populated in order to send to Azure. + + :param time_grain: the timegrain of the metric in ISO8601 format. + :type time_grain: ~datetime.timedelta + :param category: Name of a Diagnostic Metric category for a resource type this setting is + applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a + GET diagnostic settings operation. + :type category: str + :param enabled: Required. a value indicating whether this category is enabled. + :type enabled: bool + :param retention_policy: the retention policy for this category. + :type retention_policy: ~$(python-base-namespace).v2021_05_01_preview.models.RetentionPolicy + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__( + self, + *, + enabled: bool, + time_grain: Optional[datetime.timedelta] = None, + category: Optional[str] = None, + retention_policy: Optional["RetentionPolicy"] = None, + **kwargs + ): + super(MetricSettings, self).__init__(**kwargs) + self.time_grain = time_grain + self.category = category + self.enabled = enabled + self.retention_policy = retention_policy + + +class RetentionPolicy(msrest.serialization.Model): + """Specifies the retention policy for the log. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. a value indicating whether the retention policy is enabled. + :type enabled: bool + :param days: Required. the number of days for the retention in days. A value of 0 will retain + the events indefinitely. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__( + self, + *, + enabled: bool, + days: int, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + +class SubscriptionDiagnosticSettingsResource(Resource): + """The subscription diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~$(python-base-namespace).v2021_05_01_preview.models.SystemData + :param storage_account_id: The resource ID of the storage account to which you would like to + send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to + maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, the default event hub + will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: list[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would + like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + :type workspace_id: str + :param marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which + you would like to send Diagnostic Logs. + :type marketplace_partner_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[SubscriptionLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + 'marketplace_partner_id': {'key': 'properties.marketplacePartnerId', 'type': 'str'}, + } + + def __init__( + self, + *, + storage_account_id: Optional[str] = None, + service_bus_rule_id: Optional[str] = None, + event_hub_authorization_rule_id: Optional[str] = None, + event_hub_name: Optional[str] = None, + logs: Optional[List["SubscriptionLogSettings"]] = None, + workspace_id: Optional[str] = None, + marketplace_partner_id: Optional[str] = None, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResource, self).__init__(**kwargs) + self.system_data = None + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.logs = logs + self.workspace_id = workspace_id + self.marketplace_partner_id = marketplace_partner_id + + +class SubscriptionDiagnosticSettingsResourceCollection(msrest.serialization.Model): + """Represents a collection of subscription diagnostic settings resources. + + :param value: The collection of subscription diagnostic settings resources. + :type value: + list[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionDiagnosticSettingsResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["SubscriptionDiagnosticSettingsResource"]] = None, + **kwargs + ): + super(SubscriptionDiagnosticSettingsResourceCollection, self).__init__(**kwargs) + self.value = value + + +class SubscriptionLogSettings(msrest.serialization.Model): + """Part of Subscription diagnostic setting. Specifies the settings for a particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Name of a Subscription Diagnostic Log category for a resource type this + setting is applied to. + :type category: str + :param category_group: Name of a Subscription Diagnostic Log category group for a resource type + this setting is applied to. + :type category_group: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'category_group': {'key': 'categoryGroup', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: bool, + category: Optional[str] = None, + category_group: Optional[str] = None, + **kwargs + ): + super(SubscriptionLogSettings, self).__init__(**kwargs) + self.category = category + self.category_group = category_group + self.enabled = enabled + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or + ~$(python-base-namespace).v2021_05_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~$(python-base-namespace).v2021_05_01_preview.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "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_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_monitor_management_client_enums.py new file mode 100644 index 0000000000000..23bf96752a362 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/models/_monitor_management_client_enums.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class CategoryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the diagnostic settings category. + """ + + METRICS = "Metrics" + LOGS = "Logs" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..b6b49b4266985 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._diagnostic_settings_operations import DiagnosticSettingsOperations +from ._diagnostic_settings_category_operations import DiagnosticSettingsCategoryOperations +from ._management_group_diagnostic_settings_operations import ManagementGroupDiagnosticSettingsOperations +from ._subscription_diagnostic_settings_operations import SubscriptionDiagnosticSettingsOperations + +__all__ = [ + 'DiagnosticSettingsOperations', + 'DiagnosticSettingsCategoryOperations', + 'ManagementGroupDiagnosticSettingsOperations', + 'SubscriptionDiagnosticSettingsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_category_operations.py new file mode 100644 index 0000000000000..d6954cacf3447 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_category_operations.py @@ -0,0 +1,176 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticSettingsCategoryOperations(object): + """DiagnosticSettingsCategoryOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_uri, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DiagnosticSettingsCategoryResource" + """Gets the diagnostic settings category for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsCategoryResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsCategoryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}'} # type: ignore + + def list( + self, + resource_uri, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DiagnosticSettingsCategoryResourceCollection"] + """Lists the diagnostic settings categories for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticSettingsCategoryResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsCategoryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsCategoryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticSettingsCategoryResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_operations.py new file mode 100644 index 0000000000000..ba435b4c62074 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_diagnostic_settings_operations.py @@ -0,0 +1,299 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticSettingsOperations(object): + """DiagnosticSettingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_uri, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DiagnosticSettingsResource" + """Gets the active diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def create_or_update( + self, + resource_uri, # type: str + name, # type: str + parameters, # type: "_models.DiagnosticSettingsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DiagnosticSettingsResource" + """Creates or updates diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DiagnosticSettingsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def delete( + self, + resource_uri, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes existing diagnostic settings for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + resource_uri, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DiagnosticSettingsResourceCollection"] + """Gets the active diagnostic settings list for the specified resource. + + :param resource_uri: The identifier of the resource. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticSettingsResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.DiagnosticSettingsResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DiagnosticSettingsResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_management_group_diagnostic_settings_operations.py new file mode 100644 index 0000000000000..4c8c369237073 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_management_group_diagnostic_settings_operations.py @@ -0,0 +1,299 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupDiagnosticSettingsOperations(object): + """ManagementGroupDiagnosticSettingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + management_group_id, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagementGroupDiagnosticSettingsResource" + """Gets the active management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def create_or_update( + self, + management_group_id, # type: str + name, # type: str + parameters, # type: "_models.ManagementGroupDiagnosticSettingsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagementGroupDiagnosticSettingsResource" + """Creates or updates management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementGroupDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def delete( + self, + management_group_id, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes existing management group diagnostic settings for the specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + management_group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ManagementGroupDiagnosticSettingsResourceCollection"] + """Gets the active management group diagnostic settings list for the specified management group. + + :param management_group_id: The management group id. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagementGroupDiagnosticSettingsResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.ManagementGroupDiagnosticSettingsResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementGroupDiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_subscription_diagnostic_settings_operations.py new file mode 100644 index 0000000000000..dbb63fa1f3fe2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/operations/_subscription_diagnostic_settings_operations.py @@ -0,0 +1,287 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionDiagnosticSettingsOperations(object): + """SubscriptionDiagnosticSettingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~$(python-base-namespace).v2021_05_01_preview.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SubscriptionDiagnosticSettingsResource" + """Gets the active subscription diagnostic settings for the specified resource. + + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def create_or_update( + self, + name, # type: str + parameters, # type: "_models.SubscriptionDiagnosticSettingsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.SubscriptionDiagnosticSettingsResource" + """Creates or updates subscription diagnostic settings for the specified resource. + + :param name: The name of the diagnostic setting. + :type name: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionDiagnosticSettingsResource, or the result of cls(response) + :rtype: ~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionDiagnosticSettingsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionDiagnosticSettingsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def delete( + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes existing subscription diagnostic settings for the specified resource. + + :param name: The name of the diagnostic setting. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SubscriptionDiagnosticSettingsResourceCollection"] + """Gets the active subscription diagnostic settings list for the specified subscriptionId. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SubscriptionDiagnosticSettingsResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2021_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionDiagnosticSettingsResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SubscriptionDiagnosticSettingsResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings'} # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/py.typed b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_05_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file