1# coding=utf-8 2# -------------------------------------------------------------------------- 3# Copyright (c) Microsoft Corporation. All rights reserved. 4# Licensed under the MIT License. See License.txt in the project root for license information. 5# Code generated by Microsoft (R) AutoRest Code Generator. 6# Changes may cause incorrect behavior and will be lost if the code is regenerated. 7# -------------------------------------------------------------------------- 8 9from azure.core.exceptions import HttpResponseError 10import msrest.serialization 11 12 13class ErrorResponse(msrest.serialization.Model): 14 """Describes the format of Error response. 15 16 :param code: Error code. 17 :type code: str 18 :param message: Error message indicating why the operation failed. 19 :type message: str 20 """ 21 22 _attribute_map = { 23 'code': {'key': 'code', 'type': 'str'}, 24 'message': {'key': 'message', 'type': 'str'}, 25 } 26 27 def __init__( 28 self, 29 **kwargs 30 ): 31 super(ErrorResponse, self).__init__(**kwargs) 32 self.code = kwargs.get('code', None) 33 self.message = kwargs.get('message', None) 34 35 36class LocalizableString(msrest.serialization.Model): 37 """The localizable string class. 38 39 All required parameters must be populated in order to send to Azure. 40 41 :param value: Required. the invariant value. 42 :type value: str 43 :param localized_value: the locale specific value. 44 :type localized_value: str 45 """ 46 47 _validation = { 48 'value': {'required': True}, 49 } 50 51 _attribute_map = { 52 'value': {'key': 'value', 'type': 'str'}, 53 'localized_value': {'key': 'localizedValue', 'type': 'str'}, 54 } 55 56 def __init__( 57 self, 58 **kwargs 59 ): 60 super(LocalizableString, self).__init__(**kwargs) 61 self.value = kwargs['value'] 62 self.localized_value = kwargs.get('localized_value', None) 63 64 65class LogSettings(msrest.serialization.Model): 66 """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. 67 68 All required parameters must be populated in order to send to Azure. 69 70 :param category: Name of a Diagnostic Log category for a resource type this setting is applied 71 to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET 72 diagnostic settings operation. 73 :type category: str 74 :param enabled: Required. a value indicating whether this log is enabled. 75 :type enabled: bool 76 :param retention_policy: the retention policy for this log. 77 :type retention_policy: ~$(python-base-namespace).v2016_09_01.models.RetentionPolicy 78 """ 79 80 _validation = { 81 'enabled': {'required': True}, 82 } 83 84 _attribute_map = { 85 'category': {'key': 'category', 'type': 'str'}, 86 'enabled': {'key': 'enabled', 'type': 'bool'}, 87 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, 88 } 89 90 def __init__( 91 self, 92 **kwargs 93 ): 94 super(LogSettings, self).__init__(**kwargs) 95 self.category = kwargs.get('category', None) 96 self.enabled = kwargs['enabled'] 97 self.retention_policy = kwargs.get('retention_policy', None) 98 99 100class Metric(msrest.serialization.Model): 101 """A set of metric values in a time range. 102 103 All required parameters must be populated in order to send to Azure. 104 105 :param id: the id, resourceId, of the metric. 106 :type id: str 107 :param type: the resource type of the metric resource. 108 :type type: str 109 :param name: Required. the name and the display name of the metric, i.e. it is localizable 110 string. 111 :type name: ~$(python-base-namespace).v2016_09_01.models.LocalizableString 112 :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes", 113 "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds". 114 :type unit: str or ~$(python-base-namespace).v2016_09_01.models.Unit 115 :param data: Required. Array of data points representing the metric values. 116 :type data: list[~$(python-base-namespace).v2016_09_01.models.MetricValue] 117 """ 118 119 _validation = { 120 'name': {'required': True}, 121 'unit': {'required': True}, 122 'data': {'required': True}, 123 } 124 125 _attribute_map = { 126 'id': {'key': 'id', 'type': 'str'}, 127 'type': {'key': 'type', 'type': 'str'}, 128 'name': {'key': 'name', 'type': 'LocalizableString'}, 129 'unit': {'key': 'unit', 'type': 'str'}, 130 'data': {'key': 'data', 'type': '[MetricValue]'}, 131 } 132 133 def __init__( 134 self, 135 **kwargs 136 ): 137 super(Metric, self).__init__(**kwargs) 138 self.id = kwargs.get('id', None) 139 self.type = kwargs.get('type', None) 140 self.name = kwargs['name'] 141 self.unit = kwargs['unit'] 142 self.data = kwargs['data'] 143 144 145class MetricCollection(msrest.serialization.Model): 146 """The collection of metric value sets. 147 148 All required parameters must be populated in order to send to Azure. 149 150 :param value: Required. the value of the collection. 151 :type value: list[~$(python-base-namespace).v2016_09_01.models.Metric] 152 """ 153 154 _validation = { 155 'value': {'required': True}, 156 } 157 158 _attribute_map = { 159 'value': {'key': 'value', 'type': '[Metric]'}, 160 } 161 162 def __init__( 163 self, 164 **kwargs 165 ): 166 super(MetricCollection, self).__init__(**kwargs) 167 self.value = kwargs['value'] 168 169 170class MetricSettings(msrest.serialization.Model): 171 """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. 172 173 All required parameters must be populated in order to send to Azure. 174 175 :param time_grain: Required. the timegrain of the metric in ISO8601 format. 176 :type time_grain: ~datetime.timedelta 177 :param enabled: Required. a value indicating whether this timegrain is enabled. 178 :type enabled: bool 179 :param retention_policy: the retention policy for this timegrain. 180 :type retention_policy: ~$(python-base-namespace).v2016_09_01.models.RetentionPolicy 181 """ 182 183 _validation = { 184 'time_grain': {'required': True}, 185 'enabled': {'required': True}, 186 } 187 188 _attribute_map = { 189 'time_grain': {'key': 'timeGrain', 'type': 'duration'}, 190 'enabled': {'key': 'enabled', 'type': 'bool'}, 191 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, 192 } 193 194 def __init__( 195 self, 196 **kwargs 197 ): 198 super(MetricSettings, self).__init__(**kwargs) 199 self.time_grain = kwargs['time_grain'] 200 self.enabled = kwargs['enabled'] 201 self.retention_policy = kwargs.get('retention_policy', None) 202 203 204class MetricValue(msrest.serialization.Model): 205 """Represents a metric value. 206 207 All required parameters must be populated in order to send to Azure. 208 209 :param time_stamp: Required. the timestamp for the metric value in ISO 8601 format. 210 :type time_stamp: ~datetime.datetime 211 :param average: the average value in the time range. 212 :type average: float 213 :param minimum: the least value in the time range. 214 :type minimum: float 215 :param maximum: the greatest value in the time range. 216 :type maximum: float 217 :param total: the sum of all of the values in the time range. 218 :type total: float 219 :param count: the number of samples in the time range. Can be used to determine the number of 220 values that contributed to the average value. 221 :type count: long 222 """ 223 224 _validation = { 225 'time_stamp': {'required': True}, 226 } 227 228 _attribute_map = { 229 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, 230 'average': {'key': 'average', 'type': 'float'}, 231 'minimum': {'key': 'minimum', 'type': 'float'}, 232 'maximum': {'key': 'maximum', 'type': 'float'}, 233 'total': {'key': 'total', 'type': 'float'}, 234 'count': {'key': 'count', 'type': 'long'}, 235 } 236 237 def __init__( 238 self, 239 **kwargs 240 ): 241 super(MetricValue, self).__init__(**kwargs) 242 self.time_stamp = kwargs['time_stamp'] 243 self.average = kwargs.get('average', None) 244 self.minimum = kwargs.get('minimum', None) 245 self.maximum = kwargs.get('maximum', None) 246 self.total = kwargs.get('total', None) 247 self.count = kwargs.get('count', None) 248 249 250class Resource(msrest.serialization.Model): 251 """An azure resource object. 252 253 Variables are only populated by the server, and will be ignored when sending a request. 254 255 All required parameters must be populated in order to send to Azure. 256 257 :ivar id: Azure resource Id. 258 :vartype id: str 259 :ivar name: Azure resource name. 260 :vartype name: str 261 :ivar type: Azure resource type. 262 :vartype type: str 263 :param location: Required. Resource location. 264 :type location: str 265 :param tags: A set of tags. Resource tags. 266 :type tags: dict[str, str] 267 """ 268 269 _validation = { 270 'id': {'readonly': True}, 271 'name': {'readonly': True}, 272 'type': {'readonly': True}, 273 'location': {'required': True}, 274 } 275 276 _attribute_map = { 277 'id': {'key': 'id', 'type': 'str'}, 278 'name': {'key': 'name', 'type': 'str'}, 279 'type': {'key': 'type', 'type': 'str'}, 280 'location': {'key': 'location', 'type': 'str'}, 281 'tags': {'key': 'tags', 'type': '{str}'}, 282 } 283 284 def __init__( 285 self, 286 **kwargs 287 ): 288 super(Resource, self).__init__(**kwargs) 289 self.id = None 290 self.name = None 291 self.type = None 292 self.location = kwargs['location'] 293 self.tags = kwargs.get('tags', None) 294 295 296class RetentionPolicy(msrest.serialization.Model): 297 """Specifies the retention policy for the log. 298 299 All required parameters must be populated in order to send to Azure. 300 301 :param enabled: Required. a value indicating whether the retention policy is enabled. 302 :type enabled: bool 303 :param days: Required. the number of days for the retention in days. A value of 0 will retain 304 the events indefinitely. 305 :type days: int 306 """ 307 308 _validation = { 309 'enabled': {'required': True}, 310 'days': {'required': True, 'minimum': 0}, 311 } 312 313 _attribute_map = { 314 'enabled': {'key': 'enabled', 'type': 'bool'}, 315 'days': {'key': 'days', 'type': 'int'}, 316 } 317 318 def __init__( 319 self, 320 **kwargs 321 ): 322 super(RetentionPolicy, self).__init__(**kwargs) 323 self.enabled = kwargs['enabled'] 324 self.days = kwargs['days'] 325 326 327class ServiceDiagnosticSettingsResource(Resource): 328 """Description of a service diagnostic setting. 329 330 Variables are only populated by the server, and will be ignored when sending a request. 331 332 All required parameters must be populated in order to send to Azure. 333 334 :ivar id: Azure resource Id. 335 :vartype id: str 336 :ivar name: Azure resource name. 337 :vartype name: str 338 :ivar type: Azure resource type. 339 :vartype type: str 340 :param location: Required. Resource location. 341 :type location: str 342 :param tags: A set of tags. Resource tags. 343 :type tags: dict[str, str] 344 :param storage_account_id: The resource ID of the storage account to which you would like to 345 send Diagnostic Logs. 346 :type storage_account_id: str 347 :param service_bus_rule_id: The service bus rule ID of the service bus namespace in which you 348 would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the 349 format: '{service bus resource ID}/authorizationrules/{key name}'. 350 :type service_bus_rule_id: str 351 :param event_hub_authorization_rule_id: The resource Id for the event hub namespace 352 authorization rule. 353 :type event_hub_authorization_rule_id: str 354 :param metrics: the list of metric settings. 355 :type metrics: list[~$(python-base-namespace).v2016_09_01.models.MetricSettings] 356 :param logs: the list of logs settings. 357 :type logs: list[~$(python-base-namespace).v2016_09_01.models.LogSettings] 358 :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log 359 Analytics workspace to which you would like to send Diagnostic Logs. Example: 360 /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- 361 integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. 362 :type workspace_id: str 363 """ 364 365 _validation = { 366 'id': {'readonly': True}, 367 'name': {'readonly': True}, 368 'type': {'readonly': True}, 369 'location': {'required': True}, 370 } 371 372 _attribute_map = { 373 'id': {'key': 'id', 'type': 'str'}, 374 'name': {'key': 'name', 'type': 'str'}, 375 'type': {'key': 'type', 'type': 'str'}, 376 'location': {'key': 'location', 'type': 'str'}, 377 'tags': {'key': 'tags', 'type': '{str}'}, 378 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, 379 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, 380 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, 381 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, 382 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, 383 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, 384 } 385 386 def __init__( 387 self, 388 **kwargs 389 ): 390 super(ServiceDiagnosticSettingsResource, self).__init__(**kwargs) 391 self.storage_account_id = kwargs.get('storage_account_id', None) 392 self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) 393 self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) 394 self.metrics = kwargs.get('metrics', None) 395 self.logs = kwargs.get('logs', None) 396 self.workspace_id = kwargs.get('workspace_id', None) 397 398 399class ServiceDiagnosticSettingsResourcePatch(msrest.serialization.Model): 400 """Service diagnostic setting resource for patch operations. 401 402 :param tags: A set of tags. Resource tags. 403 :type tags: dict[str, str] 404 :param storage_account_id: The resource ID of the storage account to which you would like to 405 send Diagnostic Logs. 406 :type storage_account_id: str 407 :param service_bus_rule_id: The service bus rule ID of the service bus namespace in which you 408 would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the 409 format: '{service bus resource ID}/authorizationrules/{key name}'. 410 :type service_bus_rule_id: str 411 :param event_hub_authorization_rule_id: The resource Id for the event hub namespace 412 authorization rule. 413 :type event_hub_authorization_rule_id: str 414 :param metrics: the list of metric settings. 415 :type metrics: list[~$(python-base-namespace).v2016_09_01.models.MetricSettings] 416 :param logs: the list of logs settings. 417 :type logs: list[~$(python-base-namespace).v2016_09_01.models.LogSettings] 418 :param workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log 419 Analytics workspace to which you would like to send Diagnostic Logs. Example: 420 /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights- 421 integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. 422 :type workspace_id: str 423 """ 424 425 _attribute_map = { 426 'tags': {'key': 'tags', 'type': '{str}'}, 427 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, 428 'service_bus_rule_id': {'key': 'properties.serviceBusRuleId', 'type': 'str'}, 429 'event_hub_authorization_rule_id': {'key': 'properties.eventHubAuthorizationRuleId', 'type': 'str'}, 430 'metrics': {'key': 'properties.metrics', 'type': '[MetricSettings]'}, 431 'logs': {'key': 'properties.logs', 'type': '[LogSettings]'}, 432 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, 433 } 434 435 def __init__( 436 self, 437 **kwargs 438 ): 439 super(ServiceDiagnosticSettingsResourcePatch, self).__init__(**kwargs) 440 self.tags = kwargs.get('tags', None) 441 self.storage_account_id = kwargs.get('storage_account_id', None) 442 self.service_bus_rule_id = kwargs.get('service_bus_rule_id', None) 443 self.event_hub_authorization_rule_id = kwargs.get('event_hub_authorization_rule_id', None) 444 self.metrics = kwargs.get('metrics', None) 445 self.logs = kwargs.get('logs', None) 446 self.workspace_id = kwargs.get('workspace_id', None) 447