diff --git a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md index 3bb2f86ecf44..09c40ffc8218 100644 --- a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md +++ b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 0.11.0 (2020-07-15) + +**Features** + + - Model MetricTrigger has a new parameter metric_namespace + - Model MetricTrigger has a new parameter dimensions + - Added operation group ManagementGroupDiagnosticSettingsOperations + ## 0.10.0 (2020-06-08) **Features** diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py index aeea35e75ffa..660160f0c293 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py @@ -116,6 +116,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-03-01: :mod:`v2019_03_01.models` * 2019-06-01: :mod:`v2019_06_01.models` * 2019-10-17-preview: :mod:`v2019_10_17.models` + * 2020-01-01-preview: :mod:`v2020_01_01_preview.models` """ if api_version == '2015-04-01': from .v2015_04_01 import models @@ -171,6 +172,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-10-17-preview': from .v2019_10_17 import models return models + elif api_version == '2020-01-01-preview': + from .v2020_01_01_preview import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -370,6 +374,19 @@ def log_profiles(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def management_group_diagnostic_settings(self): + """Instance depends on the API version: + + * 2020-01-01-preview: :class:`ManagementGroupDiagnosticSettingsOperations` + """ + api_version = self._get_api_version('management_group_diagnostic_settings') + if api_version == '2020-01-01-preview': + from .v2020_01_01_preview.operations import ManagementGroupDiagnosticSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def metric_alerts(self): """Instance depends on the API version: 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 702f8f003ca3..689b98f4190d 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 @@ -29,6 +29,7 @@ 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 TimeWindow from ._models_py3 import WebhookNotification @@ -52,6 +53,7 @@ from ._models import ScaleAction from ._models import ScaleCapacity from ._models import ScaleRule + from ._models import ScaleRuleMetricDimension from ._models import SenderAuthorization from ._models import TimeWindow from ._models import WebhookNotification @@ -63,6 +65,7 @@ MetricStatisticType, TimeAggregationType, ComparisonOperationType, + ScaleRuleMetricDimensionOperationType, ScaleDirection, ScaleType, RecurrenceFrequency, @@ -88,6 +91,7 @@ 'ScaleAction', 'ScaleCapacity', 'ScaleRule', + 'ScaleRuleMetricDimension', 'SenderAuthorization', 'TimeWindow', 'WebhookNotification', @@ -98,6 +102,7 @@ 'MetricStatisticType', 'TimeAggregationType', 'ComparisonOperationType', + 'ScaleRuleMetricDimensionOperationType', 'ScaleDirection', 'ScaleType', 'RecurrenceFrequency', 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 a6afb8ed292a..aa4356fb0ee2 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 @@ -559,6 +559,9 @@ class MetricTrigger(Model): :param metric_name: Required. the name of the metric that defines what the rule monitors. :type metric_name: str + :param metric_namespace: the namespace of the metric that defines what the + rule monitors. + :type metric_namespace: str :param metric_resource_uri: Required. the resource identifier of the resource the rule monitors. :type metric_resource_uri: str @@ -590,6 +593,10 @@ class MetricTrigger(Model): :param threshold: Required. the threshold of the metric that triggers the scale action. :type threshold: float + :param dimensions: List of dimension conditions. For example: + [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + :type dimensions: + list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimension] """ _validation = { @@ -605,6 +612,7 @@ class MetricTrigger(Model): _attribute_map = { 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'}, 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, 'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'}, @@ -612,11 +620,13 @@ class MetricTrigger(Model): 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, 'threshold': {'key': 'threshold', 'type': 'float'}, + 'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'}, } def __init__(self, **kwargs): super(MetricTrigger, self).__init__(**kwargs) self.metric_name = kwargs.get('metric_name', None) + self.metric_namespace = kwargs.get('metric_namespace', None) self.metric_resource_uri = kwargs.get('metric_resource_uri', None) self.time_grain = kwargs.get('time_grain', None) self.statistic = kwargs.get('statistic', None) @@ -624,6 +634,7 @@ def __init__(self, **kwargs): self.time_aggregation = kwargs.get('time_aggregation', None) self.operator = kwargs.get('operator', None) self.threshold = kwargs.get('threshold', None) + self.dimensions = kwargs.get('dimensions', None) class Operation(Model): @@ -918,6 +929,43 @@ def __init__(self, **kwargs): self.scale_action = kwargs.get('scale_action', None) +class ScaleRuleMetricDimension(Model): + """Specifies an auto scale rule metric dimension. + + All required parameters must be populated in order to send to Azure. + + :param dimension_name: Required. Name of the dimension. + :type dimension_name: str + :param operator: Required. the dimension operator. Only 'Equals' and + 'NotEquals' are supported. 'Equals' being equal to any of the values. + 'NotEquals' being not equal to all of the values. Possible values include: + 'Equals', 'NotEquals' + :type operator: str or + ~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimensionOperationType + :param values: Required. list of dimension values. For example: + ["App1","App2"]. + :type values: list[str] + """ + + _validation = { + 'dimension_name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'dimension_name': {'key': 'DimensionName', 'type': 'str'}, + 'operator': {'key': 'Operator', 'type': 'str'}, + 'values': {'key': 'Values', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(ScaleRuleMetricDimension, self).__init__(**kwargs) + self.dimension_name = kwargs.get('dimension_name', None) + self.operator = kwargs.get('operator', None) + self.values = kwargs.get('values', None) + + class SenderAuthorization(Model): """the authorization used by the user who has performed the operation that led to this event. This captures the RBAC properties of the event. These 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 c6f6b6be2a53..b5098aeb5191 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 @@ -559,6 +559,9 @@ class MetricTrigger(Model): :param metric_name: Required. the name of the metric that defines what the rule monitors. :type metric_name: str + :param metric_namespace: the namespace of the metric that defines what the + rule monitors. + :type metric_namespace: str :param metric_resource_uri: Required. the resource identifier of the resource the rule monitors. :type metric_resource_uri: str @@ -590,6 +593,10 @@ class MetricTrigger(Model): :param threshold: Required. the threshold of the metric that triggers the scale action. :type threshold: float + :param dimensions: List of dimension conditions. For example: + [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + :type dimensions: + list[~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimension] """ _validation = { @@ -605,6 +612,7 @@ class MetricTrigger(Model): _attribute_map = { 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'metric_namespace': {'key': 'metricNamespace', 'type': 'str'}, 'metric_resource_uri': {'key': 'metricResourceUri', 'type': 'str'}, 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, 'statistic': {'key': 'statistic', 'type': 'MetricStatisticType'}, @@ -612,11 +620,13 @@ class MetricTrigger(Model): 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, 'threshold': {'key': 'threshold', 'type': 'float'}, + 'dimensions': {'key': 'dimensions', 'type': '[ScaleRuleMetricDimension]'}, } - def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, **kwargs) -> None: + def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, metric_namespace: str=None, dimensions=None, **kwargs) -> None: super(MetricTrigger, self).__init__(**kwargs) self.metric_name = metric_name + self.metric_namespace = metric_namespace self.metric_resource_uri = metric_resource_uri self.time_grain = time_grain self.statistic = statistic @@ -624,6 +634,7 @@ def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, st self.time_aggregation = time_aggregation self.operator = operator self.threshold = threshold + self.dimensions = dimensions class Operation(Model): @@ -918,6 +929,43 @@ def __init__(self, *, metric_trigger, scale_action, **kwargs) -> None: self.scale_action = scale_action +class ScaleRuleMetricDimension(Model): + """Specifies an auto scale rule metric dimension. + + All required parameters must be populated in order to send to Azure. + + :param dimension_name: Required. Name of the dimension. + :type dimension_name: str + :param operator: Required. the dimension operator. Only 'Equals' and + 'NotEquals' are supported. 'Equals' being equal to any of the values. + 'NotEquals' being not equal to all of the values. Possible values include: + 'Equals', 'NotEquals' + :type operator: str or + ~azure.mgmt.monitor.v2015_04_01.models.ScaleRuleMetricDimensionOperationType + :param values: Required. list of dimension values. For example: + ["App1","App2"]. + :type values: list[str] + """ + + _validation = { + 'dimension_name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'dimension_name': {'key': 'DimensionName', 'type': 'str'}, + 'operator': {'key': 'Operator', 'type': 'str'}, + 'values': {'key': 'Values', 'type': '[str]'}, + } + + def __init__(self, *, dimension_name: str, operator, values, **kwargs) -> None: + super(ScaleRuleMetricDimension, self).__init__(**kwargs) + self.dimension_name = dimension_name + self.operator = operator + self.values = values + + class SenderAuthorization(Model): """the authorization used by the user who has performed the operation that led to this event. This captures the RBAC properties of the event. These diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py index 52c429290595..3755f369c0cf 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2015_04_01/models/_monitor_management_client_enums.py @@ -49,6 +49,12 @@ class ComparisonOperationType(str, Enum): less_than_or_equal = "LessThanOrEqual" +class ScaleRuleMetricDimensionOperationType(str, Enum): + + equals = "Equals" + not_equals = "NotEquals" + + class ScaleDirection(str, Enum): none = "None" 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 new file mode 100644 index 000000000000..8e97360e5ffb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import MonitorManagementClientConfiguration +from ._monitor_management_client import MonitorManagementClient +__all__ = ['MonitorManagementClient', 'MonitorManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + 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 new file mode 100644 index 000000000000..9b4e1e19d961 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class MonitorManagementClientConfiguration(AzureConfiguration): + """Configuration for MonitorManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MonitorManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-monitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py new file mode 100644 index 000000000000..3d270763b4b5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/_monitor_management_client.py @@ -0,0 +1,47 @@ +# 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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import MonitorManagementClientConfiguration +from .operations import ManagementGroupDiagnosticSettingsOperations +from . import models + + +class MonitorManagementClient(SDKClient): + """Monitor Management Client + + :ivar config: Configuration for client. + :vartype config: MonitorManagementClientConfiguration + + :ivar management_group_diagnostic_settings: ManagementGroupDiagnosticSettings operations + :vartype management_group_diagnostic_settings: azure.mgmt.monitor.v2020_01_01_preview.operations.ManagementGroupDiagnosticSettingsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = MonitorManagementClientConfiguration(credentials, base_url) + super(MonitorManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2020-01-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.management_group_diagnostic_settings = ManagementGroupDiagnosticSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/__init__.py new file mode 100644 index 000000000000..e2807e83bb2b --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/__init__.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ManagementGroupDiagnosticSettingsResource + from ._models_py3 import ManagementGroupLogSettings + from ._models_py3 import ManagementGroupProxyOnlyResource +except (SyntaxError, ImportError): + from ._models import ErrorResponse, ErrorResponseException + from ._models import ManagementGroupDiagnosticSettingsResource + from ._models import ManagementGroupLogSettings + from ._models import ManagementGroupProxyOnlyResource +from ._paged_models import ManagementGroupDiagnosticSettingsResourcePaged + +__all__ = [ + 'ErrorResponse', 'ErrorResponseException', + 'ManagementGroupDiagnosticSettingsResource', + 'ManagementGroupLogSettings', + 'ManagementGroupProxyOnlyResource', + 'ManagementGroupDiagnosticSettingsResourcePaged', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py new file mode 100644 index 000000000000..bebee01fd210 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models.py @@ -0,0 +1,183 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ManagementGroupProxyOnlyResource(Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :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: Location of the resource + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagementGroupProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + + +class ManagementGroupDiagnosticSettingsResource(ManagementGroupProxyOnlyResource): + """The management group diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :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: Location of the resource + :type location: str + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic + setting. This is here to maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, + the default event hub will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: + list[~azure.mgmt.monitor.v2020_01_01_preview.models.ManagementGroupLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics + workspace to which you would like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[ManagementGroupLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagementGroupDiagnosticSettingsResource, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) + self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) + self.event_hub_name = kwargs.get('event_hub_name', None) + self.logs = kwargs.get('logs', None) + self.workspace_id = kwargs.get('workspace_id', None) + + +class ManagementGroupLogSettings(Model): + """Part of Management Group diagnostic setting. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Required. Name of a Management Group Diagnostic Log + category for a resource type this setting is applied to. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'category': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ManagementGroupLogSettings, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.enabled = kwargs.get('enabled', None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..f6f4e180078a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_models_py3.py @@ -0,0 +1,183 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ManagementGroupProxyOnlyResource(Model): + """A proxy only azure resource object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :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: Location of the resource + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, **kwargs) -> None: + super(ManagementGroupProxyOnlyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + + +class ManagementGroupDiagnosticSettingsResource(ManagementGroupProxyOnlyResource): + """The management group diagnostic setting resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :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: Location of the resource + :type location: str + :param storage_account_id: The resource ID of the storage account to which + you would like to send Diagnostic Logs. + :type storage_account_id: str + :param service_bus_rule_id: The service bus rule Id of the diagnostic + setting. This is here to maintain backwards compatibility. + :type service_bus_rule_id: str + :param event_hub_authorization_rule_id: The resource Id for the event hub + authorization rule. + :type event_hub_authorization_rule_id: str + :param event_hub_name: The name of the event hub. If none is specified, + the default event hub will be selected. + :type event_hub_name: str + :param logs: The list of logs settings. + :type logs: + list[~azure.mgmt.monitor.v2020_01_01_preview.models.ManagementGroupLogSettings] + :param workspace_id: The full ARM resource ID of the Log Analytics + workspace to which you would like to send Diagnostic Logs. Example: + /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + :type workspace_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, + 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, + 'event_hub_name': {'key': 'properties.eventHubName', 'type': 'str'}, + 'logs': {'key': 'properties.logs', 'type': '[ManagementGroupLogSettings]'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, storage_account_id: str=None, service_bus_rule_id: str=None, event_hub_authorization_rule_id: str=None, event_hub_name: str=None, logs=None, workspace_id: str=None, **kwargs) -> None: + super(ManagementGroupDiagnosticSettingsResource, self).__init__(location=location, **kwargs) + self.storage_account_id = storage_account_id + self.service_bus_rule_id = service_bus_rule_id + self.event_hub_authorization_rule_id = event_hub_authorization_rule_id + self.event_hub_name = event_hub_name + self.logs = logs + self.workspace_id = workspace_id + + +class ManagementGroupLogSettings(Model): + """Part of Management Group diagnostic setting. Specifies the settings for a + particular log. + + All required parameters must be populated in order to send to Azure. + + :param category: Required. Name of a Management Group Diagnostic Log + category for a resource type this setting is applied to. + :type category: str + :param enabled: Required. a value indicating whether this log is enabled. + :type enabled: bool + """ + + _validation = { + 'category': {'required': True}, + 'enabled': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, *, category: str, enabled: bool, **kwargs) -> None: + super(ManagementGroupLogSettings, self).__init__(**kwargs) + self.category = category + self.enabled = enabled diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_paged_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..273102cc15ed --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/models/_paged_models.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class ManagementGroupDiagnosticSettingsResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagementGroupDiagnosticSettingsResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagementGroupDiagnosticSettingsResource]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagementGroupDiagnosticSettingsResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/__init__.py new file mode 100644 index 000000000000..08bd52e52d78 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._management_group_diagnostic_settings_operations import ManagementGroupDiagnosticSettingsOperations + +__all__ = [ + 'ManagementGroupDiagnosticSettingsOperations', +] diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py new file mode 100644 index 000000000000..24fc4072d622 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/_management_group_diagnostic_settings_operations.py @@ -0,0 +1,291 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ManagementGroupDiagnosticSettingsOperations(object): + """ManagementGroupDiagnosticSettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2020-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-01-01-preview" + + self.config = config + + def get( + self, management_group_id, name, custom_headers=None, raw=False, **operation_config): + """Gets the active management group diagnostic settings for the specified + resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagementGroupDiagnosticSettingsResource or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} + + def create_or_update( + self, management_group_id, parameters, name, custom_headers=None, raw=False, **operation_config): + """Creates or updates management group diagnostic settings for the + specified resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param parameters: Parameters supplied to the operation. + :type parameters: + ~azure.mgmt.monitor.v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + :param name: The name of the diagnostic setting. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagementGroupDiagnosticSettingsResource or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.monitor.v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagementGroupDiagnosticSettingsResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagementGroupDiagnosticSettingsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} + + def delete( + self, management_group_id, name, custom_headers=None, raw=False, **operation_config): + """Deletes existing management group diagnostic settings for the specified + resource. + + :param management_group_id: The management group id. + :type management_group_id: str + :param name: The name of the diagnostic setting. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings/{name}'} + + def list( + self, management_group_id, custom_headers=None, raw=False, **operation_config): + """Gets the active management group diagnostic settings list for the + specified management group. + + :param management_group_id: The management group id. + :type management_group_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + ManagementGroupDiagnosticSettingsResource + :rtype: + ~azure.mgmt.monitor.v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResourcePaged[~azure.mgmt.monitor.v2020_01_01_preview.models.ManagementGroupDiagnosticSettingsResource] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagementGroupDiagnosticSettingsResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/microsoft.management/managementGroups/{managementGroupId}/providers/microsoft.insights/diagnosticSettings'} diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/version.py new file mode 100644 index 000000000000..cb7f31a45de7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2020-01-01-preview" + diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/version.py index 1f08862acee4..afa3d545c718 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.10.0" +VERSION = "0.11.0"