From 3a98c64651ea0046a413715eb0f2e8e92975450f Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 15 Oct 2020 07:53:44 +0000 Subject: [PATCH] Generated from 8acedb942c7da1656bdb33bd6811eb6affa07906 --- sdk/azure-mgmt-workloadmonitor/CHANGELOG.md | 5 + sdk/azure-mgmt-workloadmonitor/MANIFEST.in | 5 + sdk/azure-mgmt-workloadmonitor/README.md | 21 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/workloadmonitor/__init__.py | 19 + .../mgmt/workloadmonitor/_configuration.py | 43 ++ .../workloadmonitor/_workload_monitor_api.py | 52 +++ .../mgmt/workloadmonitor/models/__init__.py | 50 +++ .../mgmt/workloadmonitor/models/_models.py | 374 +++++++++++++++++ .../workloadmonitor/models/_models_py3.py | 374 +++++++++++++++++ .../workloadmonitor/models/_paged_models.py | 53 +++ .../models/_workload_monitor_api_enums.py | 20 + .../workloadmonitor/operations/__init__.py | 18 + .../operations/_monitors_operations.py | 382 ++++++++++++++++++ .../workloadmonitor/operations/_operations.py | 100 +++++ .../azure/mgmt/workloadmonitor/version.py | 13 + .../sdk_packaging.toml | 8 + sdk/azure-mgmt-workloadmonitor/setup.cfg | 2 + sdk/azure-mgmt-workloadmonitor/setup.py | 90 +++++ 20 files changed, 1631 insertions(+) create mode 100644 sdk/azure-mgmt-workloadmonitor/CHANGELOG.md create mode 100644 sdk/azure-mgmt-workloadmonitor/MANIFEST.in create mode 100644 sdk/azure-mgmt-workloadmonitor/README.md create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/__init__.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/__init__.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/__init__.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_configuration.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_workload_monitor_api.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/__init__.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models_py3.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_paged_models.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_workload_monitor_api_enums.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/__init__.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_monitors_operations.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_operations.py create mode 100644 sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/version.py create mode 100644 sdk/azure-mgmt-workloadmonitor/sdk_packaging.toml create mode 100644 sdk/azure-mgmt-workloadmonitor/setup.cfg create mode 100644 sdk/azure-mgmt-workloadmonitor/setup.py diff --git a/sdk/azure-mgmt-workloadmonitor/CHANGELOG.md b/sdk/azure-mgmt-workloadmonitor/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/azure-mgmt-workloadmonitor/MANIFEST.in b/sdk/azure-mgmt-workloadmonitor/MANIFEST.in new file mode 100644 index 000000000000..a3cb07df8765 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/azure-mgmt-workloadmonitor/README.md b/sdk/azure-mgmt-workloadmonitor/README.md new file mode 100644 index 000000000000..32d125b17877 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/README.md @@ -0,0 +1,21 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + +For code examples, see [MyService Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-workloadmonitor%2FREADME.png) diff --git a/sdk/azure-mgmt-workloadmonitor/azure/__init__.py b/sdk/azure-mgmt-workloadmonitor/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/__init__.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/__init__.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/__init__.py new file mode 100644 index 000000000000..92f9b14ab12e --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/__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 WorkloadMonitorAPIConfiguration +from ._workload_monitor_api import WorkloadMonitorAPI +__all__ = ['WorkloadMonitorAPI', 'WorkloadMonitorAPIConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_configuration.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_configuration.py new file mode 100644 index 000000000000..940558141b2a --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_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 WorkloadMonitorAPIConfiguration(AzureConfiguration): + """Configuration for WorkloadMonitorAPI + 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(WorkloadMonitorAPIConfiguration, 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-workloadmonitor/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_workload_monitor_api.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_workload_monitor_api.py new file mode 100644 index 000000000000..46d29f90fd99 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_workload_monitor_api.py @@ -0,0 +1,52 @@ +# 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 WorkloadMonitorAPIConfiguration +from .operations import Operations +from .operations import MonitorsOperations +from . import models + + +class WorkloadMonitorAPI(SDKClient): + """Workload Monitor API + + :ivar config: Configuration for client. + :vartype config: WorkloadMonitorAPIConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloadmonitor.operations.Operations + :ivar monitors: Monitors operations + :vartype monitors: azure.mgmt.workloadmonitor.operations.MonitorsOperations + + :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 = WorkloadMonitorAPIConfiguration(credentials, base_url) + super(WorkloadMonitorAPI, 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-13-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/__init__.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/__init__.py new file mode 100644 index 000000000000..24a5377ad28f --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/__init__.py @@ -0,0 +1,50 @@ +# 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 DefaultError, DefaultErrorException + from ._models_py3 import DefaultErrorError + from ._models_py3 import ErrorDetails + from ._models_py3 import Monitor + from ._models_py3 import MonitorStateChange + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import Resource +except (SyntaxError, ImportError): + from ._models import DefaultError, DefaultErrorException + from ._models import DefaultErrorError + from ._models import ErrorDetails + from ._models import Monitor + from ._models import MonitorStateChange + from ._models import Operation + from ._models import OperationDisplay + from ._models import Resource +from ._paged_models import MonitorPaged +from ._paged_models import MonitorStateChangePaged +from ._paged_models import OperationPaged +from ._workload_monitor_api_enums import ( + HealthState, +) + +__all__ = [ + 'DefaultError', 'DefaultErrorException', + 'DefaultErrorError', + 'ErrorDetails', + 'Monitor', + 'MonitorStateChange', + 'Operation', + 'OperationDisplay', + 'Resource', + 'OperationPaged', + 'MonitorPaged', + 'MonitorStateChangePaged', + 'HealthState', +] diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models.py new file mode 100644 index 000000000000..dd8365be6770 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models.py @@ -0,0 +1,374 @@ +# 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 DefaultError(Model): + """Default Error. + + Error body contract. + + :param error: error details. Details about the error + :type error: ~azure.mgmt.workloadmonitor.models.DefaultErrorError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'DefaultErrorError'}, + } + + def __init__(self, **kwargs): + super(DefaultError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class DefaultErrorException(HttpOperationError): + """Server responsed with exception of type: 'DefaultError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DefaultErrorException, self).__init__(deserialize, response, 'DefaultError', *args) + + +class DefaultErrorError(Model): + """error details. + + Details about the error. + + :param code: Service-defined error code. This code serves as a sub-status + for the HTTP error code specified in the response. + :type code: str + :param message: Human-readable representation of the error. + :type message: str + :param details: Details of the error. + :type details: list[~azure.mgmt.workloadmonitor.models.ErrorDetails] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + } + + def __init__(self, **kwargs): + super(DefaultErrorError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + + +class ErrorDetails(Model): + """Error Details. + + Error details of the error body contract. + + :param code: Property level error code. + :type code: str + :param message: Human-readable representation of property-level error. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDetails, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class Resource(Model): + """The resource model definition for the ARM proxy resource, + 'microsoft.workloadmonitor/monitors'. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Arm ID. Arm ID of this monitor. + :vartype id: str + :ivar name: Url-encoded monitor name. Url-encoded monitor name. + :vartype name: str + :ivar type: Resource type. Type of ARM resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Monitor(Resource): + """Monitor Status. + + Information about a monitor. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Arm ID. Arm ID of this monitor. + :vartype id: str + :ivar name: Url-encoded monitor name. Url-encoded monitor name. + :vartype name: str + :ivar type: Resource type. Type of ARM resource. + :vartype type: str + :param monitor_name: Monitor Name. Human-readable name of this monitor. + :type monitor_name: str + :param monitor_type: Monitor Type. Type of this monitor. + :type monitor_type: str + :param monitored_object: Monitored Object. Dynamic monitored object of + this monitor. + :type monitored_object: str + :param parent_monitor_name: Parent Monitor Name. Name of this monitor's + parent. + :type parent_monitor_name: str + :param previous_monitor_state: Health State. Current health state of this + monitor. Possible values include: 'Healthy', 'Critical', 'Warning', + 'Unknown' + :type previous_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param current_monitor_state: Health State. Current health state of this + monitor. Possible values include: 'Healthy', 'Critical', 'Warning', + 'Unknown' + :type current_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param evaluation_timestamp: Last Evaluated. Timestamp that this monitor + was last evaluated. + :type evaluation_timestamp: str + :param current_state_first_observed_timestamp: Last State Change. + Timestamp of this monitor's last state change. + :type current_state_first_observed_timestamp: str + :param last_reported_timestamp: Last Reported. Timestamp of this monitor's + last reported state. + :type last_reported_timestamp: str + :param evidence: Evidence. Evidence of this monitor's last state change. + :type evidence: object + :param monitor_configuration: Configuration. Configuration settings at the + time of this monitor's last state change. + :type monitor_configuration: object + """ + + _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'}, + 'monitor_name': {'key': 'properties.monitorName', 'type': 'str'}, + 'monitor_type': {'key': 'properties.monitorType', 'type': 'str'}, + 'monitored_object': {'key': 'properties.monitoredObject', 'type': 'str'}, + 'parent_monitor_name': {'key': 'properties.parentMonitorName', 'type': 'str'}, + 'previous_monitor_state': {'key': 'properties.previousMonitorState', 'type': 'str'}, + 'current_monitor_state': {'key': 'properties.currentMonitorState', 'type': 'str'}, + 'evaluation_timestamp': {'key': 'properties.evaluationTimestamp', 'type': 'str'}, + 'current_state_first_observed_timestamp': {'key': 'properties.currentStateFirstObservedTimestamp', 'type': 'str'}, + 'last_reported_timestamp': {'key': 'properties.lastReportedTimestamp', 'type': 'str'}, + 'evidence': {'key': 'properties.evidence', 'type': 'object'}, + 'monitor_configuration': {'key': 'properties.monitorConfiguration', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(Monitor, self).__init__(**kwargs) + self.monitor_name = kwargs.get('monitor_name', None) + self.monitor_type = kwargs.get('monitor_type', None) + self.monitored_object = kwargs.get('monitored_object', None) + self.parent_monitor_name = kwargs.get('parent_monitor_name', None) + self.previous_monitor_state = kwargs.get('previous_monitor_state', None) + self.current_monitor_state = kwargs.get('current_monitor_state', None) + self.evaluation_timestamp = kwargs.get('evaluation_timestamp', None) + self.current_state_first_observed_timestamp = kwargs.get('current_state_first_observed_timestamp', None) + self.last_reported_timestamp = kwargs.get('last_reported_timestamp', None) + self.evidence = kwargs.get('evidence', None) + self.monitor_configuration = kwargs.get('monitor_configuration', None) + + +class MonitorStateChange(Resource): + """Monitor State Change. + + Information about a state transition of a monitor. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Arm ID. Arm ID of this monitor. + :vartype id: str + :ivar name: Url-encoded monitor name. Url-encoded monitor name. + :vartype name: str + :ivar type: Resource type. Type of ARM resource. + :vartype type: str + :param monitor_name: Monitor Name. Human-readable name of this monitor. + :type monitor_name: str + :param monitor_type: Monitor Type. Type of this monitor. + :type monitor_type: str + :param monitored_object: Monitored Object. Dynamic monitored object of + this monitor. + :type monitored_object: str + :param evaluation_timestamp: Timestamp. Timestamp of that this event + ocurred. + :type evaluation_timestamp: str + :param current_state_first_observed_timestamp: Timestamp. Timestamp of + that this health state first ocurred. + :type current_state_first_observed_timestamp: str + :param previous_monitor_state: Previous Health State. Previous health + state. Possible values include: 'Healthy', 'Critical', 'Warning', + 'Unknown' + :type previous_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param current_monitor_state: New Health State. New health state. Possible + values include: 'Healthy', 'Critical', 'Warning', 'Unknown' + :type current_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param evidence: Evidence. Evidence of this monitor's last state change. + :type evidence: object + :param monitor_configuration: Configuration. Configuration settings at the + time of this monitor's last state change. + :type monitor_configuration: object + """ + + _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'}, + 'monitor_name': {'key': 'properties.monitorName', 'type': 'str'}, + 'monitor_type': {'key': 'properties.monitorType', 'type': 'str'}, + 'monitored_object': {'key': 'properties.monitoredObject', 'type': 'str'}, + 'evaluation_timestamp': {'key': 'properties.evaluationTimestamp', 'type': 'str'}, + 'current_state_first_observed_timestamp': {'key': 'properties.currentStateFirstObservedTimestamp', 'type': 'str'}, + 'previous_monitor_state': {'key': 'properties.previousMonitorState', 'type': 'str'}, + 'current_monitor_state': {'key': 'properties.currentMonitorState', 'type': 'str'}, + 'evidence': {'key': 'properties.evidence', 'type': 'object'}, + 'monitor_configuration': {'key': 'properties.monitorConfiguration', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(MonitorStateChange, self).__init__(**kwargs) + self.monitor_name = kwargs.get('monitor_name', None) + self.monitor_type = kwargs.get('monitor_type', None) + self.monitored_object = kwargs.get('monitored_object', None) + self.evaluation_timestamp = kwargs.get('evaluation_timestamp', None) + self.current_state_first_observed_timestamp = kwargs.get('current_state_first_observed_timestamp', None) + self.previous_monitor_state = kwargs.get('previous_monitor_state', None) + self.current_monitor_state = kwargs.get('current_monitor_state', None) + self.evidence = kwargs.get('evidence', None) + self.monitor_configuration = kwargs.get('monitor_configuration', None) + + +class Operation(Model): + """Operation. + + Operation supported by the resource provider. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Operation Name. Name of the operation. + :type name: str + :param display: Required. Display. The properties of the resource + operation. + :type display: ~azure.mgmt.workloadmonitor.models.OperationDisplay + :param origin: Required. Origin. The origin of the operation. + :type origin: str + """ + + _validation = { + 'name': {'required': True}, + 'display': {'required': True}, + 'origin': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class OperationDisplay(Model): + """Display. + + The properties of the resource operation. + + All required parameters must be populated in order to send to Azure. + + :param provider: Required. Provider Name. Provider name of this operation. + :type provider: str + :param resource: Required. Resource Name. Resource name of this operation. + :type resource: str + :param operation: Required. Operation Name. Operation name of the + operation. + :type operation: str + :param description: Required. Description. Description of the operation. + :type description: str + """ + + _validation = { + 'provider': {'required': True}, + 'resource': {'required': True}, + 'operation': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models_py3.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models_py3.py new file mode 100644 index 000000000000..0e915fc5ec59 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_models_py3.py @@ -0,0 +1,374 @@ +# 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 DefaultError(Model): + """Default Error. + + Error body contract. + + :param error: error details. Details about the error + :type error: ~azure.mgmt.workloadmonitor.models.DefaultErrorError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'DefaultErrorError'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(DefaultError, self).__init__(**kwargs) + self.error = error + + +class DefaultErrorException(HttpOperationError): + """Server responsed with exception of type: 'DefaultError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DefaultErrorException, self).__init__(deserialize, response, 'DefaultError', *args) + + +class DefaultErrorError(Model): + """error details. + + Details about the error. + + :param code: Service-defined error code. This code serves as a sub-status + for the HTTP error code specified in the response. + :type code: str + :param message: Human-readable representation of the error. + :type message: str + :param details: Details of the error. + :type details: list[~azure.mgmt.workloadmonitor.models.ErrorDetails] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetails]'}, + } + + def __init__(self, *, code: str=None, message: str=None, details=None, **kwargs) -> None: + super(DefaultErrorError, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class ErrorDetails(Model): + """Error Details. + + Error details of the error body contract. + + :param code: Property level error code. + :type code: str + :param message: Human-readable representation of property-level error. + :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(ErrorDetails, self).__init__(**kwargs) + self.code = code + self.message = message + + +class Resource(Model): + """The resource model definition for the ARM proxy resource, + 'microsoft.workloadmonitor/monitors'. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Arm ID. Arm ID of this monitor. + :vartype id: str + :ivar name: Url-encoded monitor name. Url-encoded monitor name. + :vartype name: str + :ivar type: Resource type. Type of ARM resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Monitor(Resource): + """Monitor Status. + + Information about a monitor. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Arm ID. Arm ID of this monitor. + :vartype id: str + :ivar name: Url-encoded monitor name. Url-encoded monitor name. + :vartype name: str + :ivar type: Resource type. Type of ARM resource. + :vartype type: str + :param monitor_name: Monitor Name. Human-readable name of this monitor. + :type monitor_name: str + :param monitor_type: Monitor Type. Type of this monitor. + :type monitor_type: str + :param monitored_object: Monitored Object. Dynamic monitored object of + this monitor. + :type monitored_object: str + :param parent_monitor_name: Parent Monitor Name. Name of this monitor's + parent. + :type parent_monitor_name: str + :param previous_monitor_state: Health State. Current health state of this + monitor. Possible values include: 'Healthy', 'Critical', 'Warning', + 'Unknown' + :type previous_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param current_monitor_state: Health State. Current health state of this + monitor. Possible values include: 'Healthy', 'Critical', 'Warning', + 'Unknown' + :type current_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param evaluation_timestamp: Last Evaluated. Timestamp that this monitor + was last evaluated. + :type evaluation_timestamp: str + :param current_state_first_observed_timestamp: Last State Change. + Timestamp of this monitor's last state change. + :type current_state_first_observed_timestamp: str + :param last_reported_timestamp: Last Reported. Timestamp of this monitor's + last reported state. + :type last_reported_timestamp: str + :param evidence: Evidence. Evidence of this monitor's last state change. + :type evidence: object + :param monitor_configuration: Configuration. Configuration settings at the + time of this monitor's last state change. + :type monitor_configuration: object + """ + + _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'}, + 'monitor_name': {'key': 'properties.monitorName', 'type': 'str'}, + 'monitor_type': {'key': 'properties.monitorType', 'type': 'str'}, + 'monitored_object': {'key': 'properties.monitoredObject', 'type': 'str'}, + 'parent_monitor_name': {'key': 'properties.parentMonitorName', 'type': 'str'}, + 'previous_monitor_state': {'key': 'properties.previousMonitorState', 'type': 'str'}, + 'current_monitor_state': {'key': 'properties.currentMonitorState', 'type': 'str'}, + 'evaluation_timestamp': {'key': 'properties.evaluationTimestamp', 'type': 'str'}, + 'current_state_first_observed_timestamp': {'key': 'properties.currentStateFirstObservedTimestamp', 'type': 'str'}, + 'last_reported_timestamp': {'key': 'properties.lastReportedTimestamp', 'type': 'str'}, + 'evidence': {'key': 'properties.evidence', 'type': 'object'}, + 'monitor_configuration': {'key': 'properties.monitorConfiguration', 'type': 'object'}, + } + + def __init__(self, *, monitor_name: str=None, monitor_type: str=None, monitored_object: str=None, parent_monitor_name: str=None, previous_monitor_state=None, current_monitor_state=None, evaluation_timestamp: str=None, current_state_first_observed_timestamp: str=None, last_reported_timestamp: str=None, evidence=None, monitor_configuration=None, **kwargs) -> None: + super(Monitor, self).__init__(**kwargs) + self.monitor_name = monitor_name + self.monitor_type = monitor_type + self.monitored_object = monitored_object + self.parent_monitor_name = parent_monitor_name + self.previous_monitor_state = previous_monitor_state + self.current_monitor_state = current_monitor_state + self.evaluation_timestamp = evaluation_timestamp + self.current_state_first_observed_timestamp = current_state_first_observed_timestamp + self.last_reported_timestamp = last_reported_timestamp + self.evidence = evidence + self.monitor_configuration = monitor_configuration + + +class MonitorStateChange(Resource): + """Monitor State Change. + + Information about a state transition of a monitor. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Arm ID. Arm ID of this monitor. + :vartype id: str + :ivar name: Url-encoded monitor name. Url-encoded monitor name. + :vartype name: str + :ivar type: Resource type. Type of ARM resource. + :vartype type: str + :param monitor_name: Monitor Name. Human-readable name of this monitor. + :type monitor_name: str + :param monitor_type: Monitor Type. Type of this monitor. + :type monitor_type: str + :param monitored_object: Monitored Object. Dynamic monitored object of + this monitor. + :type monitored_object: str + :param evaluation_timestamp: Timestamp. Timestamp of that this event + ocurred. + :type evaluation_timestamp: str + :param current_state_first_observed_timestamp: Timestamp. Timestamp of + that this health state first ocurred. + :type current_state_first_observed_timestamp: str + :param previous_monitor_state: Previous Health State. Previous health + state. Possible values include: 'Healthy', 'Critical', 'Warning', + 'Unknown' + :type previous_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param current_monitor_state: New Health State. New health state. Possible + values include: 'Healthy', 'Critical', 'Warning', 'Unknown' + :type current_monitor_state: str or + ~azure.mgmt.workloadmonitor.models.HealthState + :param evidence: Evidence. Evidence of this monitor's last state change. + :type evidence: object + :param monitor_configuration: Configuration. Configuration settings at the + time of this monitor's last state change. + :type monitor_configuration: object + """ + + _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'}, + 'monitor_name': {'key': 'properties.monitorName', 'type': 'str'}, + 'monitor_type': {'key': 'properties.monitorType', 'type': 'str'}, + 'monitored_object': {'key': 'properties.monitoredObject', 'type': 'str'}, + 'evaluation_timestamp': {'key': 'properties.evaluationTimestamp', 'type': 'str'}, + 'current_state_first_observed_timestamp': {'key': 'properties.currentStateFirstObservedTimestamp', 'type': 'str'}, + 'previous_monitor_state': {'key': 'properties.previousMonitorState', 'type': 'str'}, + 'current_monitor_state': {'key': 'properties.currentMonitorState', 'type': 'str'}, + 'evidence': {'key': 'properties.evidence', 'type': 'object'}, + 'monitor_configuration': {'key': 'properties.monitorConfiguration', 'type': 'object'}, + } + + def __init__(self, *, monitor_name: str=None, monitor_type: str=None, monitored_object: str=None, evaluation_timestamp: str=None, current_state_first_observed_timestamp: str=None, previous_monitor_state=None, current_monitor_state=None, evidence=None, monitor_configuration=None, **kwargs) -> None: + super(MonitorStateChange, self).__init__(**kwargs) + self.monitor_name = monitor_name + self.monitor_type = monitor_type + self.monitored_object = monitored_object + self.evaluation_timestamp = evaluation_timestamp + self.current_state_first_observed_timestamp = current_state_first_observed_timestamp + self.previous_monitor_state = previous_monitor_state + self.current_monitor_state = current_monitor_state + self.evidence = evidence + self.monitor_configuration = monitor_configuration + + +class Operation(Model): + """Operation. + + Operation supported by the resource provider. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Operation Name. Name of the operation. + :type name: str + :param display: Required. Display. The properties of the resource + operation. + :type display: ~azure.mgmt.workloadmonitor.models.OperationDisplay + :param origin: Required. Origin. The origin of the operation. + :type origin: str + """ + + _validation = { + 'name': {'required': True}, + 'display': {'required': True}, + 'origin': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, *, name: str, display, origin: str, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + + +class OperationDisplay(Model): + """Display. + + The properties of the resource operation. + + All required parameters must be populated in order to send to Azure. + + :param provider: Required. Provider Name. Provider name of this operation. + :type provider: str + :param resource: Required. Resource Name. Resource name of this operation. + :type resource: str + :param operation: Required. Operation Name. Operation name of the + operation. + :type operation: str + :param description: Required. Description. Description of the operation. + :type description: str + """ + + _validation = { + 'provider': {'required': True}, + 'resource': {'required': True}, + 'operation': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_paged_models.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_paged_models.py new file mode 100644 index 000000000000..72d0c2fb4366 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_paged_models.py @@ -0,0 +1,53 @@ +# 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 OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class MonitorPaged(Paged): + """ + A paging container for iterating over a list of :class:`Monitor ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Monitor]'} + } + + def __init__(self, *args, **kwargs): + + super(MonitorPaged, self).__init__(*args, **kwargs) +class MonitorStateChangePaged(Paged): + """ + A paging container for iterating over a list of :class:`MonitorStateChange ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MonitorStateChange]'} + } + + def __init__(self, *args, **kwargs): + + super(MonitorStateChangePaged, self).__init__(*args, **kwargs) diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_workload_monitor_api_enums.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_workload_monitor_api_enums.py new file mode 100644 index 000000000000..a69965058ef3 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/models/_workload_monitor_api_enums.py @@ -0,0 +1,20 @@ +# 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 + + +class HealthState(str, Enum): + + healthy = "Healthy" + critical = "Critical" + warning = "Warning" + unknown = "Unknown" diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/__init__.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/__init__.py new file mode 100644 index 000000000000..094d07b7664a --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/__init__.py @@ -0,0 +1,18 @@ +# 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 ._operations import Operations +from ._monitors_operations import MonitorsOperations + +__all__ = [ + 'Operations', + 'MonitorsOperations', +] diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_monitors_operations.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_monitors_operations.py new file mode 100644 index 000000000000..51db88c29e94 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_monitors_operations.py @@ -0,0 +1,382 @@ +# 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 MonitorsOperations(object): + """MonitorsOperations 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: The API version to use for this operation. Constant value: "2020-01-13-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-01-13-preview" + + self.config = config + + def list( + self, subscription_id, resource_group_name, resource_namespace, resource_type, resource_name, filter=None, expand=None, custom_headers=None, raw=False, **operation_config): + """Get list of a monitors of a resource (with optional filter). + + :param subscription_id: The subscriptionId of the resource + :type subscription_id: str + :param resource_group_name: The resourceGroupName of the resource + :type resource_group_name: str + :param resource_namespace: The resourceNamespace of the resource + :type resource_namespace: str + :param resource_type: The resourceType of the resource + :type resource_type: str + :param resource_name: The resourceType of the resource + :type resource_name: str + :param filter: list example: $filter=monitorName eq + 'logical-disks|C:|disk-free-space-mb'; history example: + $filter=isHeartbeat eq false + :type filter: str + :param expand: ex: $expand=evidence,configuration + :type expand: 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 Monitor + :rtype: + ~azure.mgmt.workloadmonitor.models.MonitorPaged[~azure.mgmt.workloadmonitor.models.Monitor] + :raises: + :class:`DefaultErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, '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.DefaultErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MonitorPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors'} + + def get( + self, subscription_id, resource_group_name, resource_namespace, resource_type, resource_name, monitor_id, expand=None, custom_headers=None, raw=False, **operation_config): + """Get the current status of a monitor of a resource. + + :param subscription_id: The subscriptionId of the resource + :type subscription_id: str + :param resource_group_name: The resourceGroupName of the resource + :type resource_group_name: str + :param resource_namespace: The resourceNamespace of the resource + :type resource_namespace: str + :param resource_type: The resourceType of the resource + :type resource_type: str + :param resource_name: The resourceType of the resource + :type resource_name: str + :param monitor_id: The monitorId of the resource (url encoded) + :type monitor_id: str + :param expand: ex: $expand=evidence,configuration + :type expand: 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: Monitor or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.workloadmonitor.models.Monitor or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DefaultErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'monitorId': self._serialize.url("monitor_id", monitor_id, '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') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, '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.DefaultErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Monitor', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}'} + + def list_state_changes( + self, subscription_id, resource_group_name, resource_namespace, resource_type, resource_name, monitor_id, filter=None, expand=None, start_timestamp_utc=None, end_timestamp_utc=None, custom_headers=None, raw=False, **operation_config): + """Get history of a monitor of a resource (with optional filter). + + :param subscription_id: The subscriptionId of the resource + :type subscription_id: str + :param resource_group_name: The resourceGroupName of the resource + :type resource_group_name: str + :param resource_namespace: The resourceNamespace of the resource + :type resource_namespace: str + :param resource_type: The resourceType of the resource + :type resource_type: str + :param resource_name: The resourceType of the resource + :type resource_name: str + :param monitor_id: The monitorId of the resource (url encoded) + :type monitor_id: str + :param filter: list example: $filter=monitorName eq + 'logical-disks|C:|disk-free-space-mb'; history example: + $filter=isHeartbeat eq false + :type filter: str + :param expand: ex: $expand=evidence,configuration + :type expand: str + :param start_timestamp_utc: The start Timestamp for the desired + history + :type start_timestamp_utc: datetime + :param end_timestamp_utc: The end Timestamp for the desired history + :type end_timestamp_utc: datetime + :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 MonitorStateChange + :rtype: + ~azure.mgmt.workloadmonitor.models.MonitorStateChangePaged[~azure.mgmt.workloadmonitor.models.MonitorStateChange] + :raises: + :class:`DefaultErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_state_changes.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'monitorId': self._serialize.url("monitor_id", monitor_id, '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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if start_timestamp_utc is not None: + query_parameters['startTimestampUtc'] = self._serialize.query("start_timestamp_utc", start_timestamp_utc, 'iso-8601') + if end_timestamp_utc is not None: + query_parameters['endTimestampUtc'] = self._serialize.query("end_timestamp_utc", end_timestamp_utc, 'iso-8601') + + 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.DefaultErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MonitorStateChangePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_state_changes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}/history'} + + def get_state_change( + self, subscription_id, resource_group_name, resource_namespace, resource_type, resource_name, monitor_id, timestamp_unix, expand=None, custom_headers=None, raw=False, **operation_config): + """Get the status of a monitor at a specific timestamp in history. + + :param subscription_id: The subscriptionId of the resource + :type subscription_id: str + :param resource_group_name: The resourceGroupName of the resource + :type resource_group_name: str + :param resource_namespace: The resourceNamespace of the resource + :type resource_namespace: str + :param resource_type: The resourceType of the resource + :type resource_type: str + :param resource_name: The resourceType of the resource + :type resource_name: str + :param monitor_id: The monitorId of the resource (url encoded) + :type monitor_id: str + :param timestamp_unix: The timestamp of the state change (Unix format) + :type timestamp_unix: str + :param expand: ex: $expand=evidence,configuration + :type expand: 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: MonitorStateChange or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.workloadmonitor.models.MonitorStateChange or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DefaultErrorException` + """ + # Construct URL + url = self.get_state_change.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'monitorId': self._serialize.url("monitor_id", monitor_id, 'str'), + 'timestampUnix': self._serialize.url("timestamp_unix", timestamp_unix, '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') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, '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.DefaultErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MonitorStateChange', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_state_change.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}/history/{timestampUnix}'} diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_operations.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_operations.py new file mode 100644 index 000000000000..fc4cf5dc1736 --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/operations/_operations.py @@ -0,0 +1,100 @@ +# 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 Operations(object): + """Operations 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: The API version to use for this operation. Constant value: "2020-01-13-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-01-13-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of possible operations. + + :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 Operation + :rtype: + ~azure.mgmt.workloadmonitor.models.OperationPaged[~azure.mgmt.workloadmonitor.models.Operation] + :raises: + :class:`DefaultErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # 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.DefaultErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.WorkloadMonitor/operations'} diff --git a/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/version.py b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/version.py new file mode 100644 index 000000000000..d8e09829411a --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/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-13-preview" + diff --git a/sdk/azure-mgmt-workloadmonitor/sdk_packaging.toml b/sdk/azure-mgmt-workloadmonitor/sdk_packaging.toml new file mode 100644 index 000000000000..8fd36ae3ff0c --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-workloadmonitor" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/azure-mgmt-workloadmonitor/setup.cfg b/sdk/azure-mgmt-workloadmonitor/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/azure-mgmt-workloadmonitor/setup.py b/sdk/azure-mgmt-workloadmonitor/setup.py new file mode 100644 index 000000000000..d4a608c881ab --- /dev/null +++ b/sdk/azure-mgmt-workloadmonitor/setup.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-workloadmonitor" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +)