diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py index ccbeb512b0c20..fa63968b37592 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..2bc4e47f80c84 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py @@ -17,15 +17,15 @@ from ._version import VERSION -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 96% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_client.py index f92fe821ee92d..8a46c7761c455 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_client.py @@ -14,7 +14,7 @@ from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -23,7 +23,7 @@ def __init__(self, *args, **kwargs): """ pass -class MonitorManagementClient(MultiApiClientMixin, _SDKClient): +class MonitorClient(MultiApiClientMixin, _SDKClient): """Monitor Management Client. This ready contains multiple API versions, to help you deal with all of the Azure clouds @@ -36,7 +36,7 @@ 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. @@ -47,7 +47,7 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): """ DEFAULT_API_VERSION = '2019-10-17-preview' - _PROFILE_TAG = "azure.mgmt.monitor.MonitorManagementClient" + _PROFILE_TAG = "azure.mgmt.monitor.MonitorClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, @@ -92,9 +92,9 @@ def __init__( ): if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(MonitorManagementClient, self).__init__( + super(MonitorClient, self).__init__( api_version=api_version, profile=profile ) @@ -265,10 +265,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)) @@ -304,10 +310,13 @@ def baseline(self): def baselines(self): """Instance depends on the API version: + * 2018-09-01: :class:`BaselinesOperations` * 2019-03-01: :class:`BaselinesOperations` """ api_version = self._get_api_version('baselines') - if api_version == '2019-03-01': + if api_version == '2018-09-01': + from .v2018_09_01.operations import BaselinesOperations as OperationClass + elif api_version == '2019-03-01': from .v2019_03_01.operations import BaselinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'baselines'".format(api_version)) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..a68fd941da58a 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 @@ -17,15 +17,15 @@ from .._version import VERSION -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -39,7 +39,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 96% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client.py index fbdc799766592..221efe2f65398 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_client.py @@ -14,7 +14,7 @@ from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -23,7 +23,7 @@ def __init__(self, *args, **kwargs): """ pass -class MonitorManagementClient(MultiApiClientMixin, _SDKClient): +class MonitorClient(MultiApiClientMixin, _SDKClient): """Monitor Management Client. This ready contains multiple API versions, to help you deal with all of the Azure clouds @@ -36,7 +36,7 @@ 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. @@ -47,7 +47,7 @@ class MonitorManagementClient(MultiApiClientMixin, _SDKClient): """ DEFAULT_API_VERSION = '2019-10-17-preview' - _PROFILE_TAG = "azure.mgmt.monitor.MonitorManagementClient" + _PROFILE_TAG = "azure.mgmt.monitor.MonitorClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, @@ -92,9 +92,9 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(MonitorManagementClient, self).__init__( + super(MonitorClient, self).__init__( api_version=api_version, profile=profile ) @@ -265,10 +265,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)) @@ -304,10 +310,13 @@ def baseline(self): def baselines(self): """Instance depends on the API version: + * 2018-09-01: :class:`BaselinesOperations` * 2019-03-01: :class:`BaselinesOperations` """ api_version = self._get_api_version('baselines') - if api_version == '2019-03-01': + if api_version == '2018-09-01': + from ..v2018_09_01.aio.operations import BaselinesOperations as OperationClass + elif api_version == '2019-03-01': from ..v2019_03_01.aio.operations import BaselinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'baselines'".format(api_version)) 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..42d890f25d926 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,11 +43,10 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) 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..2ac0deed7dc5e 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,15 +1,15 @@ { "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", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -56,7 +56,8 @@ "autoscale_settings": "AutoscaleSettingsOperations", "event_categories": "EventCategoriesOperations", "operations": "Operations", - "tenant_activity_logs": "TenantActivityLogsOperations" + "tenant_activity_logs": "TenantActivityLogsOperations", + "alert_rules": "AlertRulesOperations" }, "operation_mixins": { }, 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_client.py similarity index 85% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/_monitor_client.py index cf573933ec237..42169675de6df 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_client.py @@ -17,16 +17,17 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActivityLogsOperations from .operations import AutoscaleSettingsOperations from .operations import EventCategoriesOperations from .operations import Operations from .operations import TenantActivityLogsOperations +from .operations import AlertRulesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar activity_logs: ActivityLogsOperations operations @@ -39,9 +40,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 """ @@ -56,12 +59,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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_logs = ActivityLogsOperations( @@ -74,13 +76,15 @@ 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 close(self): # type: () -> None self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..9fa79839e530a 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,11 +40,10 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) 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_client.py similarity index 85% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/aio/_monitor_client.py index d38f6a5af172e..4a1ffa65b98c4 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_client.py @@ -15,16 +15,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActivityLogsOperations from .operations import AutoscaleSettingsOperations from .operations import EventCategoriesOperations from .operations import Operations from .operations import TenantActivityLogsOperations +from .operations import AlertRulesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar activity_logs: ActivityLogsOperations operations @@ -37,9 +38,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 """ @@ -53,12 +56,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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_logs = ActivityLogsOperations( @@ -71,11 +73,13 @@ 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 close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..6bd1f93be7424 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 @@ -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 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..e61669c1d327b --- /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 + ) -> "_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(_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 + ) -> 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(_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 + ) -> "_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(_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 + ) -> "_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(_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 + ) -> 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(_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 + ) -> 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(_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..ea56e5280661a 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 @@ -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 @@ -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) @@ -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) @@ -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) @@ -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'), } @@ -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 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..85e1759884043 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 ( +from ._monitor_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..c1db417a7af52 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. @@ -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. @@ -606,6 +763,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. @@ -863,6 +1173,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. @@ -1039,6 +1646,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..afe56580f0cc4 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 @@ -12,7 +12,234 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_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): @@ -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. @@ -661,6 +839,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. @@ -947,6 +1291,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. @@ -1143,6 +1817,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_client_enums.py similarity index 87% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_client_enums.py index 8ff9a5c89e3d8..faa35f29041ab 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_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 """ @@ -96,6 +105,16 @@ class ScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PERCENT_CHANGE_COUNT = "PercentChangeCount" EXACT_COUNT = "ExactCount" +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 value is Average. 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..e03482cbb90b8 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 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..cc27cda51c22a --- /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(_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(_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(_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(_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(_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(_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..a313979a04956 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 @@ -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) @@ -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) @@ -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) @@ -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'), } @@ -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 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..42d890f25d926 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 @@ -20,28 +20,33 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, 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..6f9626041b96c 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,15 +1,15 @@ { "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", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -18,6 +18,12 @@ "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": { @@ -26,11 +32,17 @@ "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 ID of the target subscription.", + "docstring_type": "str", + "required": true } }, "constant": { }, - "call": "credential" + "call": "credential, subscription_id" }, "config": { "credential": true, @@ -40,7 +52,8 @@ "credential_key_header_name": null }, "operation_groups": { - "service_diagnostic_settings": "ServiceDiagnosticSettingsOperations" + "service_diagnostic_settings": "ServiceDiagnosticSettingsOperations", + "alert_rules": "AlertRulesOperations" }, "operation_mixins": { }, 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_client.py similarity index 77% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/_monitor_client.py index dfd0c5dbf56ab..6dda891eada43 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_client.py @@ -17,47 +17,54 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ServiceDiagnosticSettingsOperations +from .operations import AlertRulesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar service_diagnostic_settings: ServiceDiagnosticSettingsOperations operations :vartype service_diagnostic_settings: $(python-base-namespace).v2015_07_01.operations.ServiceDiagnosticSettingsOperations + :ivar alert_rules: AlertRulesOperations operations + :vartype alert_rules: $(python-base-namespace).v2015_07_01.operations.AlertRulesOperations :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 = MonitorClientConfiguration(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.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize) def close(self): # type: () -> None self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..9fa79839e530a 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 @@ -18,27 +18,32 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, 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_client.py similarity index 76% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/aio/_monitor_client.py index ba78ca1a42c1b..acc62f79506e7 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_client.py @@ -15,44 +15,51 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ServiceDiagnosticSettingsOperations +from .operations import AlertRulesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar service_diagnostic_settings: ServiceDiagnosticSettingsOperations operations :vartype service_diagnostic_settings: $(python-base-namespace).v2015_07_01.aio.operations.ServiceDiagnosticSettingsOperations + :ivar alert_rules: AlertRulesOperations operations + :vartype alert_rules: $(python-base-namespace).v2015_07_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 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 = MonitorClientConfiguration(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.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..bb12987150039 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,9 @@ # -------------------------------------------------------------------------- from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations +from ._alert_rules_operations import AlertRulesOperations __all__ = [ 'ServiceDiagnosticSettingsOperations', + 'AlertRulesOperations', ] 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..677675169ba7e --- /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 + ) -> "_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(_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 + ) -> 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(_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 + ) -> "_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(_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 + ) -> "_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(_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 + ) -> 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(_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 + ) -> 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(_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/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/__init__.py index f1974dfd3d2d4..acc8230fdc07b 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,77 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AlertRuleResource + from ._models_py3 import AlertRuleResourceCollection + from ._models_py3 import AlertRuleResourcePatch from ._models_py3 import ErrorResponse + from ._models_py3 import LocationThresholdRuleCondition from ._models_py3 import LogSettings + from ._models_py3 import ManagementEventAggregationCondition + from ._models_py3 import ManagementEventRuleCondition from ._models_py3 import MetricSettings 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 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 ErrorResponse # type: ignore + from ._models import LocationThresholdRuleCondition # type: ignore from ._models import LogSettings # type: ignore + from ._models import ManagementEventAggregationCondition # type: ignore + from ._models import ManagementEventRuleCondition # type: ignore from ._models import MetricSettings # 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 ThresholdRuleCondition # type: ignore + +from ._monitor_client_enums import ( + ConditionOperator, + TimeAggregationOperator, +) __all__ = [ + 'AlertRuleResource', + 'AlertRuleResourceCollection', + 'AlertRuleResourcePatch', 'ErrorResponse', + 'LocationThresholdRuleCondition', 'LogSettings', + 'ManagementEventAggregationCondition', + 'ManagementEventRuleCondition', 'MetricSettings', 'Resource', 'RetentionPolicy', + 'RuleAction', + 'RuleCondition', + 'RuleDataSource', + 'RuleEmailAction', + 'RuleManagementEventClaimsDataSource', + 'RuleManagementEventDataSource', + 'RuleMetricDataSource', + 'RuleWebhookAction', 'ServiceDiagnosticSettingsResource', + 'ThresholdRuleCondition', + 'ConditionOperator', + 'TimeAggregationOperator', ] 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..44554c724c164 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,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_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 ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. @@ -33,6 +236,90 @@ def __init__( self.message = kwargs.get('message', 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. @@ -68,6 +355,75 @@ def __init__( self.retention_policy = kwargs.get('retention_policy', 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 MetricSettings(msrest.serialization.Model): """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. @@ -102,81 +458,332 @@ def __init__( self.retention_policy = kwargs.get('retention_policy', None) -class Resource(msrest.serialization.Model): - """An azure resource object. +class RetentionPolicy(msrest.serialization.Model): + """Specifies the retention policy for the log. - 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 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}, + } + + _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 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. - :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 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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + 'odata_type': {'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}'}, + '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(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) + super(RuleAction, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] -class RetentionPolicy(msrest.serialization.Model): - """Specifies the retention policy for the log. +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 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 + :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 = { - 'enabled': {'required': True}, - 'days': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, + '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(RetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs['enabled'] - self.days = kwargs['days'] + 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): @@ -244,3 +851,59 @@ def __init__( self.metrics = kwargs.get('metrics', None) self.logs = kwargs.get('logs', None) self.workspace_id = kwargs.get('workspace_id', 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..b867b3e494038 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,240 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._monitor_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 ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. @@ -39,6 +268,96 @@ def __init__( self.message = message +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. @@ -78,6 +397,82 @@ def __init__( self.retention_policy = retention_policy +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 MetricSettings(msrest.serialization.Model): """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. @@ -116,87 +511,368 @@ def __init__( self.retention_policy = retention_policy -class Resource(msrest.serialization.Model): - """An azure resource object. +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}, + } + + _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 - Variables are only populated by the server, and will be ignored when sending a request. + +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. - :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 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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + 'odata_type': {'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}'}, + '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, *, - location: str, - tags: Optional[Dict[str, str]] = None, + resource_uri: Optional[str] = None, + legacy_resource_id: Optional[str] = None, + resource_location: Optional[str] = None, + metric_namespace: 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(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 RetentionPolicy(msrest.serialization.Model): - """Specifies the retention policy for the log. +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 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 + :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 = { - 'enabled': {'required': True}, - 'days': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'days': {'key': 'days', 'type': 'int'}, + 'odata_type': {'key': 'odata\\.type', 'type': 'str'}, + 'send_to_service_owners': {'key': 'sendToServiceOwners', 'type': 'bool'}, + 'custom_emails': {'key': 'customEmails', 'type': '[str]'}, } def __init__( self, *, - enabled: bool, - days: int, + send_to_service_owners: Optional[bool] = None, + custom_emails: Optional[List[str]] = None, **kwargs ): - super(RetentionPolicy, self).__init__(**kwargs) - self.enabled = enabled - self.days = days + 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): @@ -272,3 +948,65 @@ def __init__( self.metrics = metrics self.logs = logs self.workspace_id = workspace_id + + +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/v2018_09_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_monitor_client_enums.py similarity index 67% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_07_01/models/_monitor_client_enums.py index 26ccadca63031..fe9f939c9ea6e 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/v2015_07_01/models/_monitor_client_enums.py @@ -26,24 +26,21 @@ def __getattr__(cls, name): raise AttributeError(name) -class ReceiverStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Indicates the status of the receiver. Receivers that are not Enabled will not receive any - communications. +class ConditionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operators allowed in the rule condition. """ - NOT_SPECIFIED = "NotSpecified" - ENABLED = "Enabled" - DISABLED = "Disabled" + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" -class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - DATA = "Data" - METADATA = "Metadata" - -class Sensitivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The sensitivity of the baseline. +class TimeAggregationOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Aggregation operators allowed in a rule. """ - LOW = "Low" - MEDIUM = "Medium" - HIGH = "High" + AVERAGE = "Average" + MINIMUM = "Minimum" + MAXIMUM = "Maximum" + TOTAL = "Total" + LAST = "Last" 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..bb12987150039 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,9 @@ # -------------------------------------------------------------------------- from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations +from ._alert_rules_operations import AlertRulesOperations __all__ = [ 'ServiceDiagnosticSettingsOperations', + 'AlertRulesOperations', ] 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..27b0565115455 --- /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(_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(_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(_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(_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(_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(_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/v2016_03_01/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/__init__.py index ccbeb512b0c20..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..f4891a9af5f63 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..c59aaa7a1174c 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 @@ -2,14 +2,14 @@ "chosen_version": "2016-03-01", "total_api_version_list": ["2016-03-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 90% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/_monitor_client.py index 8513c920c077f..5a41cf46428c6 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_client.py @@ -17,7 +17,7 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import AlertRuleIncidentsOperations from .operations import AlertRulesOperations from .operations import LogProfilesOperations @@ -25,7 +25,7 @@ from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar alert_rule_incidents: AlertRuleIncidentsOperations operations @@ -38,7 +38,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 """ @@ -53,12 +53,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.alert_rule_incidents = AlertRuleIncidentsOperations( @@ -75,7 +74,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..b40e218cff256 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/aio/_monitor_client.py index e5406701f0bea..980330bd826fc 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_client.py @@ -15,7 +15,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import AlertRuleIncidentsOperations from .operations import AlertRulesOperations from .operations import LogProfilesOperations @@ -23,7 +23,7 @@ from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar alert_rule_incidents: AlertRuleIncidentsOperations operations @@ -36,7 +36,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 """ @@ -50,12 +50,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.alert_rule_incidents = AlertRuleIncidentsOperations( @@ -70,7 +69,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..e023fd1718e10 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 @@ -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) @@ -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..4217952ba17cb 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 @@ -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) @@ -110,7 +110,7 @@ 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, @@ -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,12 +160,13 @@ 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(_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, @@ -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(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AlertRuleResource', pipeline_response) @@ -221,7 +225,7 @@ 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, @@ -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'), } @@ -293,7 +297,7 @@ 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, @@ -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,15 +359,16 @@ 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) 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, @@ -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(_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..500370642e6b1 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 @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py index e000ddda20342..149859a248132 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/__init__.py @@ -63,7 +63,7 @@ from ._models import RuleWebhookAction # type: ignore from ._models import ThresholdRuleCondition # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( AggregationType, ConditionOperator, TimeAggregationOperator, 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..67aebe30b1a18 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 @@ -776,6 +794,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 +810,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 +826,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 +897,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 +933,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 +975,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 +993,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'}, } 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..1494a452adec6 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class Resource(msrest.serialization.Model): @@ -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 @@ -854,6 +876,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 +892,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 +905,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 +989,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 +1025,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 +1043,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 +1057,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 +1081,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 +1099,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 +1109,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 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_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_03_01/models/_monitor_client_enums.py 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..7f21013f401e5 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) @@ -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..179c8d3f247ee 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) @@ -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(_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(_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'), } @@ -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(_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(_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..d630eb29ee31e 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) @@ -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) @@ -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) @@ -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) @@ -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 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..c3607ad334d17 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 @@ -20,8 +20,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2016-09-01" 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..a9ebbe9478d41 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 @@ -2,14 +2,14 @@ "chosen_version": "2016-09-01", "total_api_version_list": ["2016-09-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/_monitor_client.py index 18c80e72a6616..3b7995ae4a4cb 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_client.py @@ -17,13 +17,13 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricsOperations from .operations import ServiceDiagnosticSettingsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metrics: MetricsOperations operations @@ -44,12 +44,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metrics = MetricsOperations( @@ -62,7 +61,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..e4edee68690cc 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 @@ -18,8 +18,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -35,7 +35,7 @@ def __init__( ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2016-09-01" 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/aio/_monitor_client.py index 1c424ce98abcf..9cfa6badc4d04 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_client.py @@ -15,13 +15,13 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricsOperations from .operations import ServiceDiagnosticSettingsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metrics: MetricsOperations operations @@ -41,12 +41,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metrics = MetricsOperations( @@ -57,7 +56,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py index ef62a11f121aa..11dadcbbb65ae 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py @@ -31,7 +31,7 @@ from ._models import ServiceDiagnosticSettingsResource # type: ignore from ._models import ServiceDiagnosticSettingsResourcePatch # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( Unit, ) 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..30e6c213a6083 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class ErrorResponse(msrest.serialization.Model): 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_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/_monitor_client_enums.py 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..fcb3564874c65 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..2faba829c9fa4 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 @@ -2,14 +2,14 @@ "chosen_version": "2017-03-01-preview", "total_api_version_list": ["2017-03-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 86% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/_monitor_client.py index ddf7efa85be1d..b182de1b3f5c0 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_client.py @@ -17,19 +17,19 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActivityLogAlertsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar activity_log_alerts: ActivityLogAlertsOperations operations :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 """ @@ -44,12 +44,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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( @@ -60,7 +59,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..14f365399402a 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 85% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_03_01_preview/aio/_monitor_client.py index 1f97fff0df70e..251777fb9a7ca 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_client.py @@ -15,19 +15,19 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActivityLogAlertsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar activity_log_alerts: ActivityLogAlertsOperations operations :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 """ @@ -41,12 +41,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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( @@ -55,7 +54,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..eb7657627b2e9 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 @@ -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'), } @@ -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'), } @@ -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'), } @@ -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'), } @@ -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 @@ -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) 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..57de9f7a81b99 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'), } @@ -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'), } @@ -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'), } @@ -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'), } @@ -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 @@ -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) 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..bc4592a69bab2 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..fa3a79740cb07 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 @@ -2,14 +2,14 @@ "chosen_version": "2017-04-01", "total_api_version_list": ["2017-04-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 87% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/_monitor_client.py index ae156e7cffec3..977cd6d6089a0 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_client.py @@ -17,13 +17,13 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import ActivityLogAlertsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -32,7 +32,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 """ @@ -47,12 +47,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -65,7 +64,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..1447112a163df 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 87% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/aio/_monitor_client.py index e2c0fd2efe6ba..e7bc0061da7e6 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_client.py @@ -15,13 +15,13 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import ActivityLogAlertsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -30,7 +30,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 """ @@ -44,12 +44,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -60,7 +59,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..6f1f0cd91e9ee 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 @@ -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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..b3e1bb02a22f7 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 @@ -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'), } @@ -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'), } @@ -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'), } @@ -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'), } @@ -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 @@ -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) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py index ae82597fb0278..db94c22bc0ec0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/__init__.py @@ -47,7 +47,7 @@ from ._models import SmsReceiver # type: ignore from ._models import WebhookReceiver # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( ReceiverStatus, ) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/models/_monitor_client_enums.py 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..512e9b73fcd45 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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..9fba898f42793 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'), } @@ -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'), } @@ -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'), } @@ -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'), } @@ -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 @@ -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) 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..42be0e5ff4406 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 @@ -20,27 +20,33 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, 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..bb504726c78d3 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 @@ -2,14 +2,14 @@ "chosen_version": "2017-05-01-preview", "total_api_version_list": ["2017-05-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -18,6 +18,12 @@ "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": { @@ -26,11 +32,17 @@ "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 ID of the target subscription.", + "docstring_type": "str", + "required": true } }, "constant": { }, - "call": "credential" + "call": "credential, subscription_id" }, "config": { "credential": true, 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_client.py similarity index 91% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/_monitor_client.py index 32bfe4c988873..bd4737e84fe55 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_client.py @@ -17,7 +17,7 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import DiagnosticSettingsCategoryOperations from .operations import DiagnosticSettingsOperations from .operations import MetricDefinitionsOperations @@ -26,7 +26,7 @@ from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations @@ -41,24 +41,26 @@ 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 = MonitorClientConfiguration(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_category = DiagnosticSettingsCategoryOperations( @@ -77,7 +79,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..586e70bef5959 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 @@ -18,26 +18,32 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MonitorClientConfiguration, 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_client.py similarity index 91% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/_monitor_client.py index 61dc9b9b1aac7..a5aac63fcbe93 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_client.py @@ -15,7 +15,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import DiagnosticSettingsCategoryOperations from .operations import DiagnosticSettingsOperations from .operations import MetricDefinitionsOperations @@ -24,7 +24,7 @@ from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations @@ -39,23 +39,25 @@ 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 = MonitorClientConfiguration(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_category = DiagnosticSettingsCategoryOperations( @@ -72,7 +74,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..7a4503afc0843 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 ) -> "_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) @@ -100,15 +97,12 @@ async def get( async def create_or_update( self, - subscription_id: str, name: str, parameters: "_models.SubscriptionDiagnosticSettingsResource", **kwargs ) -> "_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) @@ -166,14 +160,11 @@ async def create_or_update( async def delete( self, - subscription_id: str, name: str, **kwargs ) -> 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) @@ -221,13 +212,10 @@ async def delete( async def list( self, - subscription_id: str, **kwargs ) -> "_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) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py index 087885d528368..c0dd979a816db 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/__init__.py @@ -53,7 +53,7 @@ from ._models import SubscriptionProxyOnlyResource # type: ignore from ._models import TimeSeriesElement # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( AggregationType, CategoryType, ResultType, 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..5dba26e3628e8 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class ProxyOnlyResource(msrest.serialization.Model): 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_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/models/_monitor_client_enums.py 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..eb8d627fb6c7d 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) @@ -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) @@ -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) @@ -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) 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..d0fb26233a4a8 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 @@ -20,8 +20,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2017-11-01-preview" 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..032220920274e 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 @@ -2,14 +2,14 @@ "chosen_version": "2017-11-01-preview", "total_api_version_list": ["2017-11-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { 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_client.py similarity index 88% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/_monitor_client.py index a2ab9af3b53c9..3c48248a52c13 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_client.py @@ -17,12 +17,12 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricBaselineOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metric_baseline: MetricBaselineOperations operations @@ -41,12 +41,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metric_baseline = MetricBaselineOperations( @@ -57,7 +56,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..28b010a60fb59 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 @@ -18,8 +18,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -35,7 +35,7 @@ def __init__( ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2017-11-01-preview" 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_client.py similarity index 87% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/aio/_monitor_client.py index 0c7128dc2c6d1..a34fecffc2872 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_client.py @@ -15,12 +15,12 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricBaselineOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metric_baseline: MetricBaselineOperations operations @@ -38,12 +38,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metric_baseline = MetricBaselineOperations( @@ -52,7 +51,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..dcf2a8ffe0cce 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 @@ -127,7 +127,7 @@ 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, @@ -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/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py index 6bd9d401e19d5..76219a2696ea7 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/__init__.py @@ -23,7 +23,7 @@ from ._models import LocalizableString # type: ignore from ._models import TimeSeriesInformation # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( ResultType, Sensitivity, ) 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..0b2aab63413b4 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): 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..3f49d6e6bec29 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class Baseline(msrest.serialization.Model): @@ -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): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_11_01_preview/models/_monitor_client_enums.py 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..51ca70ad8cf35 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 @@ -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, @@ -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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..f791805e52f26 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 @@ -20,8 +20,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2017-12-01-preview" 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..90b18ede7f520 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 @@ -2,14 +2,14 @@ "chosen_version": "2017-12-01-preview", "total_api_version_list": ["2017-12-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { 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_client.py similarity index 88% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/_monitor_client.py index 52d74ca8855f1..7dc3c6fcb82ec 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_client.py @@ -17,12 +17,12 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricNamespacesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metric_namespaces: MetricNamespacesOperations operations @@ -41,12 +41,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metric_namespaces = MetricNamespacesOperations( @@ -57,7 +56,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..00dc29134a32f 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 @@ -18,8 +18,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -35,7 +35,7 @@ def __init__( ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2017-12-01-preview" 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_client.py similarity index 87% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_12_01_preview/aio/_monitor_client.py index 6aa7637f579ca..7371583d4223d 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_client.py @@ -15,12 +15,12 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricNamespacesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metric_namespaces: MetricNamespacesOperations operations @@ -38,12 +38,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metric_namespaces = MetricNamespacesOperations( @@ -52,7 +51,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..449982bc94c71 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 @@ -20,8 +20,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2018-01-01" 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..b4d69509a4328 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 @@ -2,14 +2,14 @@ "chosen_version": "2018-01-01", "total_api_version_list": ["2018-01-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/_monitor_client.py index 4426433aa4e4f..d49d26f76ec57 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_client.py @@ -17,13 +17,13 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricDefinitionsOperations from .operations import MetricsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metric_definitions: MetricDefinitionsOperations operations @@ -44,12 +44,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metric_definitions = MetricDefinitionsOperations( @@ -62,7 +61,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..3357ffb00a13a 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 @@ -18,8 +18,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -35,7 +35,7 @@ def __init__( ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2018-01-01" 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/aio/_monitor_client.py index d35ab95edecf6..41b74d643867f 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_client.py @@ -15,13 +15,13 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import MetricDefinitionsOperations from .operations import MetricsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar metric_definitions: MetricDefinitionsOperations operations @@ -41,12 +41,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.metric_definitions = MetricDefinitionsOperations( @@ -57,7 +56,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..bf45cc3364e86 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 @@ -29,7 +29,7 @@ from ._models import Response # type: ignore from ._models import TimeSeriesElement # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( AggregationType, ResultType, Unit, 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..ed8a10be7993d 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class ErrorResponse(msrest.serialization.Model): 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_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_01_01/models/_monitor_client_enums.py 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..718b0b39e1483 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..e09c455355280 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 @@ -2,14 +2,14 @@ "chosen_version": "2018-03-01", "total_api_version_list": ["2018-03-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/_monitor_client.py index fd71e69c92ba8..354331be0fd19 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_client.py @@ -17,14 +17,14 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import MetricAlertsOperations from .operations import MetricAlertsStatusOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -35,7 +35,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 """ @@ -50,12 +50,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -70,7 +69,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..1eaafa2d0ef38 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 88% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/aio/_monitor_client.py index 85660a0938d79..c57af291d385b 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_client.py @@ -15,14 +15,14 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import MetricAlertsOperations from .operations import MetricAlertsStatusOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -33,7 +33,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 """ @@ -47,12 +47,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -65,7 +64,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..20fff72692cba 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 @@ -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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..bcb7ec9eb3cbd 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 @@ -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 @@ -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) @@ -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'), } @@ -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'), } @@ -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'), } @@ -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(_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..5d54d2126dd11 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 @@ -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'), } @@ -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'), 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..88e96542db434 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 @@ -71,8 +71,8 @@ from ._models import WebhookReceiver # type: ignore from ._models import WebtestLocationAvailabilityCriteria # type: ignore -from ._monitor_management_client_enums import ( - AggregationType, +from ._monitor_client_enums import ( + 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..48f31fe1d8ce0 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 @@ -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 @@ -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 @@ -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] """ @@ -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): @@ -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 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..60421cf177d7a 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class ActionGroupList(msrest.serialization.Model): @@ -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,7 +417,7 @@ def __init__( *, name: str, metric_name: str, - time_aggregation: Union[str, "AggregationType"], + time_aggregation: Union[str, "AggregationTypeEnum"], additional_properties: Optional[Dict[str, object]] = None, metric_namespace: Optional[str] = None, dimensions: Optional[List["MetricDimension"]] = None, @@ -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 @@ -507,7 +507,7 @@ 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", @@ -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] """ @@ -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): @@ -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,7 +1292,7 @@ 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, 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_client_enums.py similarity index 97% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/models/_monitor_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_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..2136919981569 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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..4fa5737e2e213 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 @@ -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) @@ -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'), } @@ -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'), } @@ -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'), } @@ -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(_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..2741282189ff3 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'), } @@ -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'), 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..57c1f46a36c58 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..09db871cd6ac0 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 @@ -2,14 +2,14 @@ "chosen_version": "2018-04-16", "total_api_version_list": ["2018-04-16"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 86% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_monitor_client.py index 775dcebb84e46..a792f5f4a951a 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_client.py @@ -17,19 +17,19 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ScheduledQueryRulesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations :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 """ @@ -44,12 +44,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.scheduled_query_rules = ScheduledQueryRulesOperations( @@ -60,7 +59,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..e84103f20bf38 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 85% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/aio/_monitor_client.py index 72801e36fa29a..b6702dcf88bfb 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_client.py @@ -15,19 +15,19 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ScheduledQueryRulesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations :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 """ @@ -41,12 +41,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.scheduled_query_rules = ScheduledQueryRulesOperations( @@ -55,7 +54,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..6c39df8ccc2b2 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 @@ -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(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -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(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -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(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -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,7 +286,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(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -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(_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) @@ -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(_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) 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..1ccef5cb05c36 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 @@ -39,7 +41,7 @@ from ._models import Source # type: ignore from ._models import TriggerCondition # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( AlertSeverity, ConditionalOperator, Enabled, @@ -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..956dc3bf35b3a 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,13 +226,14 @@ 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". + '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". + 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. @@ -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,24 @@ 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 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 @@ -326,6 +378,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 +394,12 @@ 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'}, 'enabled': {'key': 'properties.enabled', 'type': 'str'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -352,7 +413,10 @@ 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.enabled = kwargs.get('enabled', None) self.last_updated_time = None self.provisioning_state = None @@ -510,7 +574,8 @@ 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". + '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. @@ -535,6 +600,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..9b7b68cef6faf 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class Action(msrest.serialization.Model): @@ -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,13 +251,14 @@ 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". + '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". + 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. @@ -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,24 @@ 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 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 @@ -357,6 +411,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 +427,12 @@ 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'}, 'enabled': {'key': 'properties.enabled', 'type': 'str'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -386,12 +449,16 @@ def __init__( action: "Action", tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, + display_name: Optional[str] = None, 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.enabled = enabled self.last_updated_time = None self.provisioning_state = None @@ -564,7 +631,8 @@ 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". + '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. @@ -587,7 +655,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_client_enums.py similarity index 96% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/models/_monitor_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_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..07d8c9f7445f3 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(_models.ErrorContract, 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'), '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(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -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(_models.ErrorContract, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LogSearchRuleResource', pipeline_response) @@ -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,7 +294,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(_models.ErrorContract, 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_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(_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) @@ -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(_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) 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..5d0e9fab4ebe7 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..3fb8560e260d9 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 @@ -2,14 +2,14 @@ "chosen_version": "2018-06-01-preview", "total_api_version_list": ["2018-06-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 88% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/_monitor_client.py index dd2026fed6b0d..16554184d341d 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_client.py @@ -17,13 +17,13 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import GuestDiagnosticsSettingsAssociationOperations from .operations import GuestDiagnosticsSettingsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar guest_diagnostics_settings_association: GuestDiagnosticsSettingsAssociationOperations operations @@ -32,7 +32,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 """ @@ -47,12 +47,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations( @@ -65,7 +64,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..969801767a013 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 88% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/aio/_monitor_client.py index fe83fe02be0cd..bd0486fad72fc 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_client.py @@ -15,13 +15,13 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import GuestDiagnosticsSettingsAssociationOperations from .operations import GuestDiagnosticsSettingsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar guest_diagnostics_settings_association: GuestDiagnosticsSettingsAssociationOperations operations @@ -30,7 +30,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 """ @@ -44,12 +44,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations( @@ -60,7 +59,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..6050896e0fac2 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 @@ -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 @@ -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 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..0f36472724cf8 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 @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 @@ -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 diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py index 1dab1d930479d..447d789e73d01 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/__init__.py @@ -39,7 +39,7 @@ from ._models import Resource # type: ignore from ._models import SinkConfiguration # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( DataSourceKind, GuestDiagnosticSettingsOsType, SinkConfigurationKind, 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..25e58f8f957dd 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class DataSource(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_monitor_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_06_01_preview/models/_monitor_client_enums.py 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..d312dee8235e2 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 @@ -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 @@ -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 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..8fd1f62c36cab 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) @@ -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) @@ -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) @@ -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) @@ -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 @@ -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 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..7713d61e810de 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..05aa3b6b3093e 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 @@ -2,14 +2,14 @@ "chosen_version": "2018-09-01", "total_api_version_list": ["2018-09-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -54,7 +54,8 @@ "operation_groups": { "action_groups": "ActionGroupsOperations", "metric_baseline": "MetricBaselineOperations", - "baseline": "BaselineOperations" + "baseline": "BaselineOperations", + "baselines": "BaselinesOperations" }, "operation_mixins": { }, 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_client.py similarity index 83% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/_monitor_client.py index cd65097c83547..5e4c4090386f9 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_client.py @@ -17,14 +17,15 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import MetricBaselineOperations from .operations import BaselineOperations +from .operations import BaselinesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -33,9 +34,11 @@ class MonitorManagementClient(object): :vartype metric_baseline: $(python-base-namespace).v2018_09_01.operations.MetricBaselineOperations :ivar baseline: BaselineOperations operations :vartype baseline: $(python-base-namespace).v2018_09_01.operations.BaselineOperations + :ivar baselines: BaselinesOperations operations + :vartype baselines: $(python-base-namespace).v2018_09_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 """ @@ -50,12 +53,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -64,13 +66,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.baseline = BaselineOperations( self._client, self._config, self._serialize, self._deserialize) + self.baselines = BaselinesOperations( + self._client, self._config, self._serialize, self._deserialize) def close(self): # type: () -> None self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..2999ac5f0c4f9 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 82% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/_monitor_client.py index b4c6c5e5f83a2..f690281710f9c 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_client.py @@ -15,14 +15,15 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import MetricBaselineOperations from .operations import BaselineOperations +from .operations import BaselinesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -31,9 +32,11 @@ class MonitorManagementClient(object): :vartype metric_baseline: $(python-base-namespace).v2018_09_01.aio.operations.MetricBaselineOperations :ivar baseline: BaselineOperations operations :vartype baseline: $(python-base-namespace).v2018_09_01.aio.operations.BaselineOperations + :ivar baselines: BaselinesOperations operations + :vartype baselines: $(python-base-namespace).v2018_09_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 """ @@ -47,12 +50,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -61,11 +63,13 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.baseline = BaselineOperations( self._client, self._config, self._serialize, self._deserialize) + self.baselines = BaselinesOperations( + self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py index 636f48f0362a0..1b1612af9bd2f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/__init__.py @@ -9,9 +9,11 @@ from ._action_groups_operations import ActionGroupsOperations from ._metric_baseline_operations import MetricBaselineOperations from ._baseline_operations import BaselineOperations +from ._baselines_operations import BaselinesOperations __all__ = [ 'ActionGroupsOperations', 'MetricBaselineOperations', 'BaselineOperations', + 'BaselinesOperations', ] 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..0a47034cd1b91 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 @@ -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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..7f16e9be2a851 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 @@ -139,4 +139,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/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baselines_operations.py new file mode 100644 index 0000000000000..6fcec58fd8967 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/aio/operations/_baselines_operations.py @@ -0,0 +1,163 @@ +# 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, 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 BaselinesOperations: + """BaselinesOperations 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).v2018_09_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, + metricnames: Optional[str] = None, + metricnamespace: Optional[str] = None, + timespan: Optional[str] = None, + interval: Optional[datetime.timedelta] = None, + aggregation: Optional[str] = None, + sensitivities: Optional[str] = None, + filter: Optional[str] = None, + result_type: Optional[Union[str, "_models.ResultType"]] = None, + **kwargs + ) -> 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. + :type metricnames: str + :param metricnamespace: Metric namespace to query metric definitions for. + :type metricnamespace: str + :param timespan: The timespan of the query. It is a string with the following format + 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: ~datetime.timedelta + :param aggregation: The list of aggregation types (comma separated) to retrieve. + :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 ‘*\ ’**. + :type filter: str + :param result_type: Allows retrieving only metadata of the baseline. On data request all + information is retrieved. + :type result_type: str or ~$(python-base-namespace).v2018_09_01.models.ResultType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetricBaselinesResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2018_09_01.models.MetricBaselinesResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricBaselinesResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-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] + if metricnames is not None: + query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if sensitivities is not None: + query_parameters['sensitivities'] = self._serialize.query("sensitivities", sensitivities, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'str') + 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('MetricBaselinesResponse', 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(_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/metricBaselines'} # 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..8f208124673b8 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 @@ -138,7 +138,7 @@ 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, @@ -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..0139245a69a42 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 @@ -15,17 +15,24 @@ from ._models_py3 import AzureAppPushReceiver from ._models_py3 import AzureFunctionReceiver from ._models_py3 import Baseline + from ._models_py3 import BaselineMetadata 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 from ._models_py3 import ItsmReceiver from ._models_py3 import LocalizableString 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 + from ._models_py3 import TimeSeriesBaseline from ._models_py3 import TimeSeriesInformation from ._models_py3 import VoiceReceiver from ._models_py3 import WebhookReceiver @@ -38,22 +45,33 @@ from ._models import AzureAppPushReceiver # type: ignore from ._models import AzureFunctionReceiver # type: ignore from ._models import Baseline # type: ignore + from ._models import BaselineMetadata # type: ignore 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 from ._models import ItsmReceiver # type: ignore from ._models import LocalizableString # type: ignore 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 + from ._models import TimeSeriesBaseline # type: ignore from ._models import TimeSeriesInformation # type: ignore from ._models import VoiceReceiver # type: ignore from ._models import WebhookReceiver # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( + BaselineSensitivity, + ErrorType, + ErrorTypeAutoGenerated, + PredictionResultType, ReceiverStatus, ResultType, Sensitivity, @@ -68,20 +86,31 @@ 'AzureAppPushReceiver', 'AzureFunctionReceiver', 'Baseline', + 'BaselineMetadata', 'BaselineMetadataValue', 'BaselineResponse', 'CalculateBaselineResponse', + 'CalculateBaselineResponseStatistics', 'EmailReceiver', 'EnableRequest', 'ErrorResponse', 'ItsmReceiver', 'LocalizableString', 'LogicAppReceiver', + 'MetricBaselinesResponse', + 'MetricSingleDimension', 'Resource', + 'SingleBaseline', + 'SingleMetricBaseline', 'SmsReceiver', + 'TimeSeriesBaseline', 'TimeSeriesInformation', 'VoiceReceiver', 'WebhookReceiver', + 'BaselineSensitivity', + 'ErrorType', + 'ErrorTypeAutoGenerated', + '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..f2bed493f4fd4 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 @@ -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': 'int'}, + 'error_type': {'key': 'ErrorType', 'type': 'int'}, } def __init__( @@ -387,6 +399,39 @@ 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 BaselineMetadata(msrest.serialization.Model): + """Represents a baseline metadata value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the baseline metadata. + :type name: str + :param value: Required. Value of the baseline metadata. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BaselineMetadata, self).__init__(**kwargs) + self.name = kwargs['name'] + self.value = kwargs['value'] class BaselineMetadataValue(msrest.serialization.Model): @@ -423,6 +468,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 +491,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': 'int'}, + 'error_type': {'key': 'errorType', 'type': 'int'}, '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 +525,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 +549,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.ErrorTypeAutoGenerated """ _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': 'int'}, } def __init__( @@ -507,6 +582,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): @@ -710,6 +815,154 @@ def __init__( self.callback_url = kwargs['callback_url'] +class MetricBaselinesResponse(msrest.serialization.Model): + """A list of metric baselines. + + All required parameters must be populated in order to send to Azure. + + :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 + back from what was originally requested. + :type timespan: str + :param interval: Required. The interval (window size) for which the metric data was returned + in. This 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. + :type namespace: str + :param value: The baseline for each time series that was queried. + :type value: list[~$(python-base-namespace).v2018_09_01.models.SingleMetricBaseline] + """ + + _validation = { + 'timespan': {'required': True}, + 'interval': {'required': True}, + } + + _attribute_map = { + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'duration'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SingleMetricBaseline]'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricBaselinesResponse, self).__init__(**kwargs) + self.timespan = kwargs['timespan'] + self.interval = kwargs['interval'] + self.namespace = kwargs.get('namespace', None) + self.value = kwargs.get('value', None) + + +class MetricSingleDimension(msrest.serialization.Model): + """The metric dimension name and value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param value: Required. Value of the dimension. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricSingleDimension, self).__init__(**kwargs) + self.name = kwargs['name'] + self.value = kwargs['value'] + + +class SingleBaseline(msrest.serialization.Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible values include: "Low", + "Medium", "High". + :type sensitivity: str or ~$(python-base-namespace).v2018_09_01.models.BaselineSensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(SingleBaseline, self).__init__(**kwargs) + self.sensitivity = kwargs['sensitivity'] + self.low_thresholds = kwargs['low_thresholds'] + self.high_thresholds = kwargs['high_thresholds'] + + +class SingleMetricBaseline(msrest.serialization.Model): + """The baseline results of a single metric. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The metric baseline Id. + :type id: str + :param type: Required. The resource type of the metric baseline resource. + :type type: str + :param metric_name: Required. The name of the metric for which the baselines were retrieved. + :type metric_name: str + :param baselines: Required. The baseline for each time series that was queried. + :type baselines: list[~$(python-base-namespace).v2018_09_01.models.TimeSeriesBaseline] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'metric_name': {'required': True}, + 'baselines': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'baselines': {'key': 'baselines', 'type': '[TimeSeriesBaseline]'}, + } + + def __init__( + self, + **kwargs + ): + super(SingleMetricBaseline, self).__init__(**kwargs) + self.id = kwargs['id'] + self.type = kwargs['type'] + self.metric_name = kwargs['metric_name'] + self.baselines = kwargs['baselines'] + + class SmsReceiver(msrest.serialization.Model): """An SMS receiver. @@ -754,6 +1007,49 @@ def __init__( self.status = None +class TimeSeriesBaseline(msrest.serialization.Model): + """The baseline values for a single time series. + + All required parameters must be populated in order to send to Azure. + + :param aggregation: Required. The aggregation type of the metric. + :type aggregation: str + :param dimensions: The dimensions of this time series. + :type dimensions: list[~$(python-base-namespace).v2018_09_01.models.MetricSingleDimension] + :param timestamps: Required. The list of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] + :param data: Required. The baseline values for each sensitivity. + :type data: list[~$(python-base-namespace).v2018_09_01.models.SingleBaseline] + :param metadata_values: The baseline metadata values. + :type metadata_values: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadata] + """ + + _validation = { + 'aggregation': {'required': True}, + 'timestamps': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'aggregation': {'key': 'aggregation', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'data': {'key': 'data', 'type': '[SingleBaseline]'}, + 'metadata_values': {'key': 'metadataValues', 'type': '[BaselineMetadata]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimeSeriesBaseline, self).__init__(**kwargs) + self.aggregation = kwargs['aggregation'] + self.dimensions = kwargs.get('dimensions', None) + self.timestamps = kwargs['timestamps'] + self.data = kwargs['data'] + self.metadata_values = kwargs.get('metadata_values', None) + + class TimeSeriesInformation(msrest.serialization.Model): """The time series info needed for calculating the baseline. 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..d7948e902b087 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class ActionGroupList(msrest.serialization.Model): @@ -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': 'int'}, + 'error_type': {'key': 'ErrorType', 'type': 'int'}, } def __init__( @@ -432,12 +444,51 @@ 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[int, "PredictionResultType"]] = None, + error_type: Optional[Union[int, "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 BaselineMetadata(msrest.serialization.Model): + """Represents a baseline metadata value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the baseline metadata. + :type name: str + :param value: Required. Value of the baseline metadata. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: str, + **kwargs + ): + super(BaselineMetadata, self).__init__(**kwargs) + self.name = name + self.value = value class BaselineMetadataValue(msrest.serialization.Model): @@ -477,6 +528,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 +551,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': 'int'}, + 'error_type': {'key': 'errorType', 'type': 'int'}, '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[int, "PredictionResultType"]] = None, + error_type: Optional[Union[int, "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 +618,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.ErrorTypeAutoGenerated """ _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': 'int'}, } def __init__( @@ -566,12 +649,48 @@ def __init__( type: str, baseline: List["Baseline"], timestamps: Optional[List[datetime.datetime]] = None, + statistics: Optional["CalculateBaselineResponseStatistics"] = None, + error_type: Optional[Union[int, "ErrorTypeAutoGenerated"]] = 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): @@ -796,6 +915,171 @@ def __init__( self.callback_url = callback_url +class MetricBaselinesResponse(msrest.serialization.Model): + """A list of metric baselines. + + All required parameters must be populated in order to send to Azure. + + :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 + back from what was originally requested. + :type timespan: str + :param interval: Required. The interval (window size) for which the metric data was returned + in. This 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. + :type namespace: str + :param value: The baseline for each time series that was queried. + :type value: list[~$(python-base-namespace).v2018_09_01.models.SingleMetricBaseline] + """ + + _validation = { + 'timespan': {'required': True}, + 'interval': {'required': True}, + } + + _attribute_map = { + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'duration'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SingleMetricBaseline]'}, + } + + def __init__( + self, + *, + timespan: str, + interval: datetime.timedelta, + namespace: Optional[str] = None, + value: Optional[List["SingleMetricBaseline"]] = None, + **kwargs + ): + super(MetricBaselinesResponse, self).__init__(**kwargs) + self.timespan = timespan + self.interval = interval + self.namespace = namespace + self.value = value + + +class MetricSingleDimension(msrest.serialization.Model): + """The metric dimension name and value. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension. + :type name: str + :param value: Required. Value of the dimension. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: str, + **kwargs + ): + super(MetricSingleDimension, self).__init__(**kwargs) + self.name = name + self.value = value + + +class SingleBaseline(msrest.serialization.Model): + """The baseline values for a single sensitivity value. + + All required parameters must be populated in order to send to Azure. + + :param sensitivity: Required. the sensitivity of the baseline. Possible values include: "Low", + "Medium", "High". + :type sensitivity: str or ~$(python-base-namespace).v2018_09_01.models.BaselineSensitivity + :param low_thresholds: Required. The low thresholds of the baseline. + :type low_thresholds: list[float] + :param high_thresholds: Required. The high thresholds of the baseline. + :type high_thresholds: list[float] + """ + + _validation = { + 'sensitivity': {'required': True}, + 'low_thresholds': {'required': True}, + 'high_thresholds': {'required': True}, + } + + _attribute_map = { + 'sensitivity': {'key': 'sensitivity', 'type': 'str'}, + 'low_thresholds': {'key': 'lowThresholds', 'type': '[float]'}, + 'high_thresholds': {'key': 'highThresholds', 'type': '[float]'}, + } + + def __init__( + self, + *, + sensitivity: Union[str, "BaselineSensitivity"], + low_thresholds: List[float], + high_thresholds: List[float], + **kwargs + ): + super(SingleBaseline, self).__init__(**kwargs) + self.sensitivity = sensitivity + self.low_thresholds = low_thresholds + self.high_thresholds = high_thresholds + + +class SingleMetricBaseline(msrest.serialization.Model): + """The baseline results of a single metric. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The metric baseline Id. + :type id: str + :param type: Required. The resource type of the metric baseline resource. + :type type: str + :param metric_name: Required. The name of the metric for which the baselines were retrieved. + :type metric_name: str + :param baselines: Required. The baseline for each time series that was queried. + :type baselines: list[~$(python-base-namespace).v2018_09_01.models.TimeSeriesBaseline] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + 'metric_name': {'required': True}, + 'baselines': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'baselines': {'key': 'baselines', 'type': '[TimeSeriesBaseline]'}, + } + + def __init__( + self, + *, + id: str, + type: str, + metric_name: str, + baselines: List["TimeSeriesBaseline"], + **kwargs + ): + super(SingleMetricBaseline, self).__init__(**kwargs) + self.id = id + self.type = type + self.metric_name = metric_name + self.baselines = baselines + + class SmsReceiver(msrest.serialization.Model): """An SMS receiver. @@ -844,6 +1128,55 @@ def __init__( self.status = None +class TimeSeriesBaseline(msrest.serialization.Model): + """The baseline values for a single time series. + + All required parameters must be populated in order to send to Azure. + + :param aggregation: Required. The aggregation type of the metric. + :type aggregation: str + :param dimensions: The dimensions of this time series. + :type dimensions: list[~$(python-base-namespace).v2018_09_01.models.MetricSingleDimension] + :param timestamps: Required. The list of timestamps of the baselines. + :type timestamps: list[~datetime.datetime] + :param data: Required. The baseline values for each sensitivity. + :type data: list[~$(python-base-namespace).v2018_09_01.models.SingleBaseline] + :param metadata_values: The baseline metadata values. + :type metadata_values: list[~$(python-base-namespace).v2018_09_01.models.BaselineMetadata] + """ + + _validation = { + 'aggregation': {'required': True}, + 'timestamps': {'required': True}, + 'data': {'required': True}, + } + + _attribute_map = { + 'aggregation': {'key': 'aggregation', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricSingleDimension]'}, + 'timestamps': {'key': 'timestamps', 'type': '[iso-8601]'}, + 'data': {'key': 'data', 'type': '[SingleBaseline]'}, + 'metadata_values': {'key': 'metadataValues', 'type': '[BaselineMetadata]'}, + } + + def __init__( + self, + *, + aggregation: str, + timestamps: List[datetime.datetime], + data: List["SingleBaseline"], + dimensions: Optional[List["MetricSingleDimension"]] = None, + metadata_values: Optional[List["BaselineMetadata"]] = None, + **kwargs + ): + super(TimeSeriesBaseline, self).__init__(**kwargs) + self.aggregation = aggregation + self.dimensions = dimensions + self.timestamps = timestamps + self.data = data + self.metadata_values = metadata_values + + class TimeSeriesInformation(msrest.serialization.Model): """The time series info needed for calculating the baseline. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_client_enums.py new file mode 100644 index 0000000000000..ee5930cfc24f9 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/models/_monitor_client_enums.py @@ -0,0 +1,89 @@ +# 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 BaselineSensitivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """the sensitivity of the baseline. + """ + + LOW = "Low" + MEDIUM = "Medium" + HIGH = "High" + +class ErrorType(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """The error type of the baseline. + """ + + ZERO = 0 + ONE = 1 + TWO = 2 + THREE = 3 + FOUR = 4 + ONE_HUNDRED = 100 + TWO_HUNDRED = 200 + +class ErrorTypeAutoGenerated(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """The error type for calculating the baseline. + """ + + ZERO = 0 + ONE = 1 + TWO = 2 + THREE = 3 + FOUR = 4 + ONE_HUNDRED = 100 + TWO_HUNDRED = 200 + +class PredictionResultType(with_metaclass(_CaseInsensitiveEnumMeta, int, 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. + """ + + NOT_SPECIFIED = "NotSpecified" + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DATA = "Data" + METADATA = "Metadata" + +class Sensitivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The sensitivity of the baseline. + """ + + LOW = "Low" + MEDIUM = "Medium" + HIGH = "High" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py index 636f48f0362a0..1b1612af9bd2f 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/__init__.py @@ -9,9 +9,11 @@ from ._action_groups_operations import ActionGroupsOperations from ._metric_baseline_operations import MetricBaselineOperations from ._baseline_operations import BaselineOperations +from ._baselines_operations import BaselinesOperations __all__ = [ 'ActionGroupsOperations', 'MetricBaselineOperations', 'BaselineOperations', + 'BaselinesOperations', ] 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..e2d74663633c9 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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..5ff644b7d4eda 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 @@ -144,4 +144,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/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baselines_operations.py new file mode 100644 index 0000000000000..a6ce41f00d9a8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_09_01/operations/_baselines_operations.py @@ -0,0 +1,168 @@ +# 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 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 BaselinesOperations(object): + """BaselinesOperations 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).v2018_09_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 + metricnames=None, # type: Optional[str] + metricnamespace=None, # type: Optional[str] + timespan=None, # type: Optional[str] + interval=None, # type: Optional[datetime.timedelta] + aggregation=None, # type: Optional[str] + sensitivities=None, # type: Optional[str] + filter=None, # type: Optional[str] + result_type=None, # type: Optional[Union[str, "_models.ResultType"]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_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. + :type metricnames: str + :param metricnamespace: Metric namespace to query metric definitions for. + :type metricnamespace: str + :param timespan: The timespan of the query. It is a string with the following format + 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: ~datetime.timedelta + :param aggregation: The list of aggregation types (comma separated) to retrieve. + :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 ‘*\ ’**. + :type filter: str + :param result_type: Allows retrieving only metadata of the baseline. On data request all + information is retrieved. + :type result_type: str or ~$(python-base-namespace).v2018_09_01.models.ResultType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetricBaselinesResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2018_09_01.models.MetricBaselinesResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricBaselinesResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-09-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] + if metricnames is not None: + query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str') + if metricnamespace is not None: + query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str') + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if sensitivities is not None: + query_parameters['sensitivities'] = self._serialize.query("sensitivities", sensitivities, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'str') + 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('MetricBaselinesResponse', 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(_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/metricBaselines'} # 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..1a4acd854d5f1 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 @@ -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, @@ -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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..5633dfdd4b07a 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 @@ -20,8 +20,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2018-11-27-preview" 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..e8bd03081bb22 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 @@ -2,14 +2,14 @@ "chosen_version": "2018-11-27-preview", "total_api_version_list": ["2018-11-27-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { 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_client.py similarity index 88% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/_monitor_client.py index 6005223afa1bd..fe69a0cda202f 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_client.py @@ -17,12 +17,12 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import VMInsightsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar vm_insights: VMInsightsOperations operations @@ -41,12 +41,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.vm_insights = VMInsightsOperations( @@ -57,7 +56,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..5a81e34b4d7af 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 @@ -18,8 +18,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -35,7 +35,7 @@ def __init__( ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2018-11-27-preview" 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_client.py similarity index 87% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_monitor_client.py index 14ccf5f02108d..3709f21b2721e 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_client.py @@ -15,12 +15,12 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import VMInsightsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar vm_insights: VMInsightsOperations operations @@ -38,12 +38,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.vm_insights = VMInsightsOperations( @@ -52,7 +51,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py index 94c27fef8dc0a..1a15faf3924b8 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/__init__.py @@ -21,7 +21,7 @@ from ._models import VMInsightsOnboardingStatus # type: ignore from ._models import WorkspaceInfo # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( DataStatus, OnboardingStatus, ) 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..49abd7377a2e8 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class DataContainer(msrest.serialization.Model): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_client_enums.py 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..ce0570b5023a9 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..6ae28c52d4000 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 @@ -2,14 +2,14 @@ "chosen_version": "2019-03-01", "total_api_version_list": ["2019-03-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 87% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/_monitor_client.py index 64272557194e3..845317cadcab6 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_client.py @@ -17,13 +17,13 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import BaselinesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -32,7 +32,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 """ @@ -47,12 +47,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -65,7 +64,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..8c5535947922d 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 86% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/aio/_monitor_client.py index 07f26ba351e4c..7143739948754 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_client.py @@ -15,13 +15,13 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .operations import BaselinesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations @@ -30,7 +30,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 """ @@ -44,12 +44,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -60,7 +59,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..494e0f68b863b 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 @@ -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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..b4422cb6294f4 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 @@ -160,4 +160,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..c042cdd310651 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 @@ -53,7 +53,7 @@ from ._models import VoiceReceiver # type: ignore from ._models import WebhookReceiver # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( BaselineSensitivity, ReceiverStatus, ResultType, @@ -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..965955a6470f7 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. @@ -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'}, @@ -780,8 +798,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 +813,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 +825,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): 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..5fbec30379871 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class ActionGroupList(msrest.serialization.Model): @@ -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. @@ -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'}, @@ -874,8 +892,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 +907,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 +917,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 +925,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): diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_03_01/models/_monitor_client_enums.py 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..2784128d35727 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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..fa732d8872809 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 @@ -165,4 +165,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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..a0c3b662aa507 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..e6ff433e7106f 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 @@ -2,14 +2,14 @@ "chosen_version": "2019-06-01", "total_api_version_list": ["2019-06-01"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 86% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/_monitor_client.py index 8602679e95fb4..eeea0925bb510 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_client.py @@ -17,19 +17,19 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations :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 """ @@ -44,12 +44,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -60,7 +59,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..c808e76a91c94 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 85% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/aio/_monitor_client.py index defe4fa3c7211..e71723fc43ce3 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_client.py @@ -15,19 +15,19 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ActionGroupsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations :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 """ @@ -41,12 +41,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.action_groups = ActionGroupsOperations( @@ -55,7 +54,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..50450066d735a 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 @@ -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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..1cc4645d39ee2 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,13 @@ 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 ErrorDetail 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,17 +32,18 @@ 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 ErrorDetail # 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 -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( ReceiverStatus, ) @@ -53,12 +55,13 @@ 'AutomationRunbookReceiver', 'AzureAppPushReceiver', 'AzureFunctionReceiver', + 'AzureResource', 'EmailReceiver', 'EnableRequest', + 'ErrorDetail', '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..bebd54c564281 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. @@ -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'}, @@ -437,8 +455,8 @@ def __init__( self.receiver_name = kwargs['receiver_name'] -class ErrorResponse(msrest.serialization.Model): - """Describes the format of Error response. +class ErrorDetail(msrest.serialization.Model): + """The error detail. :param code: Error code. :type code: str @@ -455,11 +473,30 @@ def __init__( self, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) + super(ErrorDetail, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) +class ErrorResponse(msrest.serialization.Model): + """Describes the format of Error response. + + :param error: The error object. + :type error: ~$(python-base-namespace).v2019_06_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class ItsmReceiver(msrest.serialization.Model): """An Itsm receiver. 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..a8c775d7c4f66 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. @@ -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'}, @@ -490,8 +508,8 @@ def __init__( self.receiver_name = receiver_name -class ErrorResponse(msrest.serialization.Model): - """Describes the format of Error response. +class ErrorDetail(msrest.serialization.Model): + """The error detail. :param code: Error code. :type code: str @@ -511,11 +529,32 @@ def __init__( message: Optional[str] = None, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) + super(ErrorDetail, self).__init__(**kwargs) self.code = code self.message = message +class ErrorResponse(msrest.serialization.Model): + """Describes the format of Error response. + + :param error: The error object. + :type error: ~$(python-base-namespace).v2019_06_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + class ItsmReceiver(msrest.serialization.Model): """An Itsm receiver. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_06_01/models/_monitor_client_enums.py 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..124cb038deb75 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) @@ -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) @@ -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) @@ -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'), } @@ -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 @@ -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 @@ -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) 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..657970816bd01 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..bfdea836bd8cd 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 @@ -2,14 +2,14 @@ "chosen_version": "2019-10-17-preview", "total_api_version_list": ["2019-10-17-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_client", "description": "Monitor Management Client.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 92% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/_monitor_client.py index 17ca2fc7e5c52..f586875e4a69f 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_client.py @@ -17,7 +17,7 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import PrivateLinkScopesOperations from .operations import PrivateLinkScopeOperationStatusOperations from .operations import PrivateLinkResourcesOperations @@ -26,7 +26,7 @@ from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar private_link_scopes: PrivateLinkScopesOperations operations @@ -41,7 +41,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. @@ -57,12 +57,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.private_link_scopes = PrivateLinkScopesOperations( @@ -81,7 +80,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..4cfc739a8cccb 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 91% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_10_17/aio/_monitor_client.py index 21dbf08efa5cc..58a0b50bdbaf4 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_client.py @@ -15,7 +15,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import PrivateLinkScopesOperations from .operations import PrivateLinkScopeOperationStatusOperations from .operations import PrivateLinkResourcesOperations @@ -24,7 +24,7 @@ from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar private_link_scopes: PrivateLinkScopesOperations operations @@ -39,7 +39,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. @@ -54,12 +54,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.private_link_scopes = PrivateLinkScopesOperations( @@ -76,7 +75,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..afff5949f540b 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 @@ -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'), @@ -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'), @@ -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'), @@ -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'), @@ -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'), @@ -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..b69c459190264 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 @@ -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'), } @@ -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..3910328d964ea 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 @@ -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..85c7e4f6b1e66 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 @@ -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'), @@ -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'), @@ -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'), @@ -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'), @@ -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'), @@ -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..be17b6f80a592 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 @@ -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 @@ -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 @@ -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) @@ -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'), } @@ -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) @@ -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) @@ -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/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..f7f91017e9f7e 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'), @@ -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'), @@ -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..45b7372e65b1d 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'), @@ -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'), @@ -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..01f3919b9eb9e 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) @@ -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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..7a00eb694f1eb 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 @@ -20,8 +20,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..c0b06cb89a145 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 @@ -2,14 +2,14 @@ "chosen_version": "2019-11-01-preview", "total_api_version_list": ["2019-11-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { 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_client.py similarity index 90% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/_monitor_client.py index 26e7eb98aa3bb..528421a8cb96b 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_client.py @@ -17,13 +17,13 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import DataCollectionRuleAssociationsOperations from .operations import DataCollectionRulesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations @@ -47,12 +47,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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_rule_associations = DataCollectionRuleAssociationsOperations( @@ -65,7 +64,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..d84f7c4bcb3d0 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 @@ -18,8 +18,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/aio/_monitor_client.py index 723bd1e63fee5..b435d889ab516 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_client.py @@ -15,13 +15,13 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import DataCollectionRuleAssociationsOperations from .operations import DataCollectionRulesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations @@ -44,12 +44,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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_rule_associations = DataCollectionRuleAssociationsOperations( @@ -60,7 +59,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..161faf6d805f1 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 @@ -26,9 +26,9 @@ from ._models_py3 import ErrorDetails from ._models_py3 import ErrorDetailsAutoGenerated from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseError from ._models_py3 import ErrorResponseAutoGenerated from ._models_py3 import ErrorResponseError + from ._models_py3 import ErrorResponseErrorAutoGenerated from ._models_py3 import ExtensionDataSource from ._models_py3 import LogAnalyticsDestination from ._models_py3 import PerfCounterDataSource @@ -55,9 +55,9 @@ from ._models import ErrorDetails # type: ignore from ._models import ErrorDetailsAutoGenerated # 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 ErrorResponseErrorAutoGenerated # type: ignore from ._models import ExtensionDataSource # type: ignore from ._models import LogAnalyticsDestination # type: ignore from ._models import PerfCounterDataSource # type: ignore @@ -65,7 +65,7 @@ from ._models import SyslogDataSource # type: ignore from ._models import WindowsEventLogDataSource # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( KnownDataCollectionRuleAssociationProvisioningState, KnownDataCollectionRuleProvisioningState, KnownDataFlowStreams, @@ -99,9 +99,9 @@ 'ErrorDetails', 'ErrorDetailsAutoGenerated', 'ErrorResponse', - 'ErrorResponseError', 'ErrorResponseAutoGenerated', 'ErrorResponseError', + 'ErrorResponseErrorAutoGenerated', 'ExtensionDataSource', 'LogAnalyticsDestination', 'PerfCounterDataSource', 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..60075942c9d58 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 @@ -728,7 +728,32 @@ def __init__( self.error = None -class ErrorResponseError(ErrorDetailsAutoGenerated): +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. @@ -741,8 +766,7 @@ class ErrorResponseError(ErrorDetailsAutoGenerated): error). :vartype target: str :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] + :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] @@ -760,7 +784,7 @@ class ErrorResponseError(ErrorDetailsAutoGenerated): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } @@ -771,32 +795,7 @@ def __init__( 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): +class ErrorResponseErrorAutoGenerated(ErrorDetailsAutoGenerated): """Error details. Variables are only populated by the server, and will be ignored when sending a request. @@ -809,7 +808,8 @@ class ErrorResponseError(ErrorDetails): error). :vartype target: str :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] + :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] @@ -827,7 +827,7 @@ class ErrorResponseError(ErrorDetails): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } @@ -835,7 +835,7 @@ def __init__( self, **kwargs ): - super(ErrorResponseError, self).__init__(**kwargs) + super(ErrorResponseErrorAutoGenerated, self).__init__(**kwargs) class ExtensionDataSource(msrest.serialization.Model): 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..2a19661dae905 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class AzureMonitorMetricsDestination(msrest.serialization.Model): @@ -787,7 +787,32 @@ def __init__( self.error = None -class ErrorResponseError(ErrorDetailsAutoGenerated): +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. @@ -800,8 +825,7 @@ class ErrorResponseError(ErrorDetailsAutoGenerated): error). :vartype target: str :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base- - namespace).v2019_11_01_preview.models.ErrorDetailsAutoGenerated] + :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] @@ -819,7 +843,7 @@ class ErrorResponseError(ErrorDetailsAutoGenerated): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } @@ -830,32 +854,7 @@ def __init__( 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): +class ErrorResponseErrorAutoGenerated(ErrorDetailsAutoGenerated): """Error details. Variables are only populated by the server, and will be ignored when sending a request. @@ -868,7 +867,8 @@ class ErrorResponseError(ErrorDetails): error). :vartype target: str :ivar details: Additional nested error detail objects. - :vartype details: list[~$(python-base-namespace).v2019_11_01_preview.models.ErrorDetails] + :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] @@ -886,7 +886,7 @@ class ErrorResponseError(ErrorDetails): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + 'details': {'key': 'details', 'type': '[ErrorDetailsAutoGenerated]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } @@ -894,7 +894,7 @@ def __init__( self, **kwargs ): - super(ErrorResponseError, self).__init__(**kwargs) + super(ErrorResponseErrorAutoGenerated, self).__init__(**kwargs) class ExtensionDataSource(msrest.serialization.Model): 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_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2019_11_01_preview/models/_monitor_client_enums.py 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..40a30732e6b8f 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 @@ -20,8 +20,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2020-01-01-preview" 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..0e184819af2c1 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 @@ -2,14 +2,14 @@ "chosen_version": "2020-01-01-preview", "total_api_version_list": ["2020-01-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { 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_client.py similarity index 89% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_client.py index c3d1b9f772ef4..0a44a2308e031 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_client.py @@ -17,12 +17,12 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ManagementGroupDiagnosticSettingsOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar management_group_diagnostic_settings: ManagementGroupDiagnosticSettingsOperations operations @@ -41,12 +41,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( @@ -57,7 +56,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..f2814440fdb47 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 @@ -18,8 +18,8 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -35,7 +35,7 @@ def __init__( ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MonitorManagementClientConfiguration, self).__init__(**kwargs) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2020-01-01-preview" 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_client.py similarity index 88% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/aio/_monitor_client.py index 2f7456674d928..0cb96dc6dedd8 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_client.py @@ -15,12 +15,12 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ManagementGroupDiagnosticSettingsOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar management_group_diagnostic_settings: ManagementGroupDiagnosticSettingsOperations operations @@ -38,12 +38,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, **kwargs) + self._config = MonitorClientConfiguration(credential, **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.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( @@ -52,7 +51,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..fa63968b37592 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 @@ -6,8 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] try: from ._patch import patch_sdk # type: ignore 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..dab590d5f4ce3 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 @@ -20,15 +20,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -43,7 +43,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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..bcf965e81eff4 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 @@ -2,14 +2,14 @@ "chosen_version": "2020-05-01-preview", "total_api_version_list": ["2020-05-01-preview"], "client": { - "name": "MonitorManagementClient", - "filename": "_monitor_management_client", + "name": "MonitorClient", + "filename": "_monitor_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 + "client_side_validation": true }, "global_parameters": { "sync": { @@ -21,7 +21,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -35,7 +35,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The Azure subscription Id.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } 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_client.py similarity index 86% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/_monitor_client.py index 57f192b65071c..439226f76ba48 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_client.py @@ -17,19 +17,19 @@ from azure.core.credentials import TokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ScheduledQueryRulesOperations from . import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations :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 """ @@ -44,12 +44,11 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.scheduled_query_rules = ScheduledQueryRulesOperations( @@ -60,7 +59,7 @@ def close(self): self._client.close() def __enter__(self): - # type: () -> MonitorManagementClient + # type: () -> MonitorClient self._client.__enter__() return self diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py index 96ce9b45c05b5..7096a59fbc1f0 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._monitor_management_client import MonitorManagementClient -__all__ = ['MonitorManagementClient'] +from ._monitor_client import MonitorClient +__all__ = ['MonitorClient'] 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..d3eff86218f9d 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 @@ -18,15 +18,15 @@ VERSION = "unknown" -class MonitorManagementClientConfiguration(Configuration): - """Configuration for MonitorManagementClient. +class MonitorClientConfiguration(Configuration): + """Configuration for MonitorClient. 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 Azure subscription Id. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -40,7 +40,7 @@ def __init__( 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) + super(MonitorClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id 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_client.py similarity index 85% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_management_client.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/_monitor_client.py index 8ec830e0b2525..b4ab0fa33042d 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_client.py @@ -15,19 +15,19 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MonitorManagementClientConfiguration +from ._configuration import MonitorClientConfiguration from .operations import ScheduledQueryRulesOperations from .. import models -class MonitorManagementClient(object): +class MonitorClient(object): """Monitor Management Client. :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations :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 """ @@ -41,12 +41,11 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = MonitorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = MonitorClientConfiguration(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.scheduled_query_rules = ScheduledQueryRulesOperations( @@ -55,7 +54,7 @@ def __init__( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MonitorManagementClient": + async def __aenter__(self) -> "MonitorClient": await self._client.__aenter__() return self 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..00518fa8b596e 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 @@ -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 @@ -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) @@ -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'), } @@ -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'), } @@ -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'), } @@ -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'), } diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py index 4856ee24980c8..58149d4e6127e 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/__init__.py @@ -35,7 +35,7 @@ from ._models import ScheduledQueryRuleResourcePatch # type: ignore from ._models import TrackedResource # type: ignore -from ._monitor_management_client_enums import ( +from ._monitor_client_enums import ( AlertSeverity, ConditionOperator, DimensionOperator, 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..a6636f3ed425c 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 @@ -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) @@ -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..268a54fac856c 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._monitor_management_client_enums import * +from ._monitor_client_enums import * class Action(msrest.serialization.Model): @@ -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 @@ -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/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py similarity index 100% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_management_client_enums.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/models/_monitor_client_enums.py 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..2fb3b6b14f460 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 @@ -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) @@ -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'), } @@ -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'), } @@ -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'), } @@ -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'), }