diff --git a/azure-mgmt-serialconsole/HISTORY.rst b/azure-mgmt-serialconsole/HISTORY.rst new file mode 100644 index 000000000000..8924d5d6c445 --- /dev/null +++ b/azure-mgmt-serialconsole/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (1970-01-01) +++++++++++++++++++ + +* Initial Release diff --git a/azure-mgmt-serialconsole/MANIFEST.in b/azure-mgmt-serialconsole/MANIFEST.in new file mode 100644 index 000000000000..9ecaeb15de50 --- /dev/null +++ b/azure-mgmt-serialconsole/MANIFEST.in @@ -0,0 +1,2 @@ +include *.rst +include azure_bdist_wheel.py \ No newline at end of file diff --git a/azure-mgmt-serialconsole/README.rst b/azure-mgmt-serialconsole/README.rst new file mode 100644 index 000000000000..39eebdd2cce5 --- /dev/null +++ b/azure-mgmt-serialconsole/README.rst @@ -0,0 +1,49 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure SerialConsole Client Library. + +Azure Resource Manager (ARM) is the next generation of management APIs that +replace the old Azure Service Management (ASM). + +This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `azure `__ bundle package. + + +Compatibility +============= + +**IMPORTANT**: If you have an earlier version of the azure package +(version < 1.0), you should uninstall it before installing this package. + +You can check the version using pip: + +.. code:: shell + + pip freeze + +If you see azure==0.11.0 (or any version below 1.0), uninstall it first: + +.. code:: shell + + pip uninstall azure + + +Usage +===== + +For code examples, see `SerialConsole +`__ +on docs.microsoft.com. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. diff --git a/azure-mgmt-serialconsole/azure/__init__.py b/azure-mgmt-serialconsole/azure/__init__.py new file mode 100644 index 000000000000..849489fca33c --- /dev/null +++ b/azure-mgmt-serialconsole/azure/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-serialconsole/azure/mgmt/__init__.py b/azure-mgmt-serialconsole/azure/mgmt/__init__.py new file mode 100644 index 000000000000..849489fca33c --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/__init__.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/__init__.py new file mode 100644 index 000000000000..990c1acb90b2 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/__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 .microsoft_serial_console_client import MicrosoftSerialConsoleClient +from .version import VERSION + +__all__ = ['MicrosoftSerialConsoleClient'] + +__version__ = VERSION + diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/microsoft_serial_console_client.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/microsoft_serial_console_client.py new file mode 100644 index 000000000000..51a47232645c --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/microsoft_serial_console_client.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.list_operations import ListOperations +from .operations.list_console_operations import ListConsoleOperations +from .operations.console_operations import ConsoleOperations +from . import models + + +class MicrosoftSerialConsoleClientConfiguration(AzureConfiguration): + """Configuration for MicrosoftSerialConsoleClient + 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 subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(MicrosoftSerialConsoleClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-serialconsole/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class MicrosoftSerialConsoleClient(SDKClient): + """Azure Virtual Machine Serial Console allows you to access serial console of a Virtual Machine + + :ivar config: Configuration for client. + :vartype config: MicrosoftSerialConsoleClientConfiguration + + :ivar list: List operations + :vartype list: azure.mgmt.serialconsole.operations.ListOperations + :ivar list_console: ListConsole operations + :vartype list_console: azure.mgmt.serialconsole.operations.ListConsoleOperations + :ivar console: Console operations + :vartype console: azure.mgmt.serialconsole.operations.ConsoleOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = MicrosoftSerialConsoleClientConfiguration(credentials, subscription_id, base_url) + super(MicrosoftSerialConsoleClient, 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 = '2018-05-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.list = ListOperations( + self._client, self.config, self._serialize, self._deserialize) + self.list_console = ListConsoleOperations( + self._client, self.config, self._serialize, self._deserialize) + self.console = ConsoleOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/__init__.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/__init__.py new file mode 100644 index 000000000000..793c2e2fe05b --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/__init__.py @@ -0,0 +1,31 @@ +# 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 .serial_console_get_result_py3 import SerialConsoleGetResult + from .get_disabled_result_py3 import GetDisabledResult + from .set_disabled_result_py3 import SetDisabledResult + from .deployment_validate_result_py3 import DeploymentValidateResult, DeploymentValidateResultException + from .serial_console_operations_py3 import SerialConsoleOperations +except (SyntaxError, ImportError): + from .serial_console_get_result import SerialConsoleGetResult + from .get_disabled_result import GetDisabledResult + from .set_disabled_result import SetDisabledResult + from .deployment_validate_result import DeploymentValidateResult, DeploymentValidateResultException + from .serial_console_operations import SerialConsoleOperations + +__all__ = [ + 'SerialConsoleGetResult', + 'GetDisabledResult', + 'SetDisabledResult', + 'DeploymentValidateResult', 'DeploymentValidateResultException', + 'SerialConsoleOperations', +] diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/deployment_validate_result.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/deployment_validate_result.py new file mode 100644 index 000000000000..836055f68dc2 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/deployment_validate_result.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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class DeploymentValidateResult(Model): + """Details on Failure. + + Details on Failure. + + :param error_message: Error message + :type error_message: str + """ + + _attribute_map = { + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error_message = kwargs.get('error_message', None) + + +class DeploymentValidateResultException(HttpOperationError): + """Server responsed with exception of type: 'DeploymentValidateResult'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DeploymentValidateResultException, self).__init__(deserialize, response, 'DeploymentValidateResult', *args) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/deployment_validate_result_py3.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/deployment_validate_result_py3.py new file mode 100644 index 000000000000..3b79f288ffee --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/deployment_validate_result_py3.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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class DeploymentValidateResult(Model): + """Details on Failure. + + Details on Failure. + + :param error_message: Error message + :type error_message: str + """ + + _attribute_map = { + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__(self, *, error_message: str=None, **kwargs) -> None: + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error_message = error_message + + +class DeploymentValidateResultException(HttpOperationError): + """Server responsed with exception of type: 'DeploymentValidateResult'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(DeploymentValidateResultException, self).__init__(deserialize, response, 'DeploymentValidateResult', *args) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/get_disabled_result.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/get_disabled_result.py new file mode 100644 index 000000000000..c69c47234ec3 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/get_disabled_result.py @@ -0,0 +1,31 @@ +# 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 + + +class GetDisabledResult(Model): + """Get Disabled result. + + Returns whether or not Serial Console is disabled for this given + subscription. + + :param disabled: Disabled result + :type disabled: bool + """ + + _attribute_map = { + 'disabled': {'key': 'disabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(GetDisabledResult, self).__init__(**kwargs) + self.disabled = kwargs.get('disabled', None) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/get_disabled_result_py3.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/get_disabled_result_py3.py new file mode 100644 index 000000000000..f85cfd2104ec --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/get_disabled_result_py3.py @@ -0,0 +1,31 @@ +# 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 + + +class GetDisabledResult(Model): + """Get Disabled result. + + Returns whether or not Serial Console is disabled for this given + subscription. + + :param disabled: Disabled result + :type disabled: bool + """ + + _attribute_map = { + 'disabled': {'key': 'disabled', 'type': 'bool'}, + } + + def __init__(self, *, disabled: bool=None, **kwargs) -> None: + super(GetDisabledResult, self).__init__(**kwargs) + self.disabled = disabled diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_get_result.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_get_result.py new file mode 100644 index 000000000000..341766f24ed0 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_get_result.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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SerialConsoleGetResult(Model): + """Serial Console GET Result. + + Returns whether or not Serial Console is disabled. + + :param value: Whether or not Serial Console is disabled. + :type value: bool + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(SerialConsoleGetResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_get_result_py3.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_get_result_py3.py new file mode 100644 index 000000000000..f04e7e788305 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_get_result_py3.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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SerialConsoleGetResult(Model): + """Serial Console GET Result. + + Returns whether or not Serial Console is disabled. + + :param value: Whether or not Serial Console is disabled. + :type value: bool + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'bool'}, + } + + def __init__(self, *, value: bool=None, **kwargs) -> None: + super(SerialConsoleGetResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_operations.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_operations.py new file mode 100644 index 000000000000..d10dc90ca5ad --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_operations.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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SerialConsoleOperations(Model): + """Serial Console operations. + + Serial Console operations. + + :param value: Serial Console operations + :type value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SerialConsoleOperations, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_operations_py3.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_operations_py3.py new file mode 100644 index 000000000000..e8646a046ead --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/serial_console_operations_py3.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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SerialConsoleOperations(Model): + """Serial Console operations. + + Serial Console operations. + + :param value: Serial Console operations + :type value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, value: str=None, **kwargs) -> None: + super(SerialConsoleOperations, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/set_disabled_result.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/set_disabled_result.py new file mode 100644 index 000000000000..3117105e7cd4 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/set_disabled_result.py @@ -0,0 +1,31 @@ +# 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 + + +class SetDisabledResult(Model): + """Set Disabled result. + + Sets disable status and returns whether or not Serial Console is now + disabled for this given subscription. + + :param disabled: Disabled result + :type disabled: bool + """ + + _attribute_map = { + 'disabled': {'key': 'disabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(SetDisabledResult, self).__init__(**kwargs) + self.disabled = kwargs.get('disabled', None) diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/set_disabled_result_py3.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/set_disabled_result_py3.py new file mode 100644 index 000000000000..97dab865915e --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/models/set_disabled_result_py3.py @@ -0,0 +1,31 @@ +# 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 + + +class SetDisabledResult(Model): + """Set Disabled result. + + Sets disable status and returns whether or not Serial Console is now + disabled for this given subscription. + + :param disabled: Disabled result + :type disabled: bool + """ + + _attribute_map = { + 'disabled': {'key': 'disabled', 'type': 'bool'}, + } + + def __init__(self, *, disabled: bool=None, **kwargs) -> None: + super(SetDisabledResult, self).__init__(**kwargs) + self.disabled = disabled diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/__init__.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/__init__.py new file mode 100644 index 000000000000..be2504c5c37b --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/__init__.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 .list_operations import ListOperations +from .list_console_operations import ListConsoleOperations +from .console_operations import ConsoleOperations + +__all__ = [ + 'ListOperations', + 'ListConsoleOperations', + 'ConsoleOperations', +] diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/console_operations.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/console_operations.py new file mode 100644 index 000000000000..207e6ce9f922 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/console_operations.py @@ -0,0 +1,151 @@ +# 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 ConsoleOperations(object): + """ConsoleOperations operations. + + :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: "2018-05-01". + :ivar default: Default string modeled as parameter for URL to work correctly. Constant value: "default". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01" + self.default = "default" + + self.config = config + + def enable_console( + self, custom_headers=None, raw=False, **operation_config): + """Enables Serial Console for a VM. + + :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: SetDisabledResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.serialconsole.models.SetDisabledResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentValidateResultException` + """ + # Construct URL + url = self.enable_console.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'default': self._serialize.url("self.default", self.default, '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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.DeploymentValidateResultException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SetDisabledResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + enable_console.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/providers/consoleServices/{default}/enableConsole'} + + def disable_console( + self, custom_headers=None, raw=False, **operation_config): + """Disables Serial Console for a VM. + + :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: SetDisabledResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.serialconsole.models.SetDisabledResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentValidateResultException` + """ + # Construct URL + url = self.disable_console.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'default': self._serialize.url("self.default", self.default, '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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.DeploymentValidateResultException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SetDisabledResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + disable_console.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/providers/consoleServices/{default}/disableConsole'} diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/list_console_operations.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/list_console_operations.py new file mode 100644 index 000000000000..abd0da85b32d --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/list_console_operations.py @@ -0,0 +1,95 @@ +# 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 ListConsoleOperations(object): + """ListConsoleOperations operations. + + :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: "2018-05-01". + :ivar default: Default string modeled as parameter for URL to work correctly. Constant value: "default". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01" + self.default = "default" + + self.config = config + + def disabled( + self, custom_headers=None, raw=False, **operation_config): + """Gets if Serial Console is disabled for a subscription. + + :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: GetDisabledResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.serialconsole.models.GetDisabledResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DeploymentValidateResultException` + """ + # Construct URL + url = self.disabled.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'default': self._serialize.url("self.default", self.default, '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.DeploymentValidateResultException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GetDisabledResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + disabled.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}'} diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/list_operations.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/list_operations.py new file mode 100644 index 000000000000..adae5854c192 --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/operations/list_operations.py @@ -0,0 +1,94 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ListOperations(object): + """ListOperations operations. + + :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: "2018-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01" + + self.config = config + + def operations( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of Serial Console API 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: SerialConsoleOperations or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.serialconsole.models.SerialConsoleOperations or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.operations.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_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') + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SerialConsoleOperations', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + operations.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/operations'} diff --git a/azure-mgmt-serialconsole/azure/mgmt/serialconsole/version.py b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/version.py new file mode 100644 index 000000000000..e0ec669828cb --- /dev/null +++ b/azure-mgmt-serialconsole/azure/mgmt/serialconsole/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 = "0.1.0" + diff --git a/azure-mgmt-serialconsole/azure_bdist_wheel.py b/azure-mgmt-serialconsole/azure_bdist_wheel.py new file mode 100644 index 000000000000..8a81d1b61775 --- /dev/null +++ b/azure-mgmt-serialconsole/azure_bdist_wheel.py @@ -0,0 +1,54 @@ +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from distutils import log as logger +import os.path + +from wheel.bdist_wheel import bdist_wheel +class azure_bdist_wheel(bdist_wheel): + """The purpose of this class is to build wheel a little differently than the sdist, + without requiring to build the wheel from the sdist (i.e. you can build the wheel + directly from source). + """ + + description = "Create an Azure wheel distribution" + + user_options = bdist_wheel.user_options + \ + [('azure-namespace-package=', None, + "Name of the deepest nspkg used")] + + def initialize_options(self): + bdist_wheel.initialize_options(self) + self.azure_namespace_package = None + + def finalize_options(self): + bdist_wheel.finalize_options(self) + if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): + raise ValueError("azure_namespace_package must finish by -nspkg") + + def run(self): + if not self.distribution.install_requires: + self.distribution.install_requires = [] + self.distribution.install_requires.append( + "{}>=2.0.0".format(self.azure_namespace_package)) + bdist_wheel.run(self) + + def write_record(self, bdist_dir, distinfo_dir): + if self.azure_namespace_package: + # Split and remove last part, assuming it's "nspkg" + subparts = self.azure_namespace_package.split('-')[0:-1] + folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] + for azure_sub_package in folder_with_init: + init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') + if os.path.isfile(init_file): + logger.info("manually remove {} while building the wheel".format(init_file)) + os.remove(init_file) + else: + raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) + bdist_wheel.write_record(self, bdist_dir, distinfo_dir) +cmdclass = { + 'bdist_wheel': azure_bdist_wheel, +} diff --git a/azure-mgmt-serialconsole/sdk_packaging.toml b/azure-mgmt-serialconsole/sdk_packaging.toml new file mode 100644 index 000000000000..81e85242d4a3 --- /dev/null +++ b/azure-mgmt-serialconsole/sdk_packaging.toml @@ -0,0 +1,6 @@ +[packaging] +package_name = "azure-mgmt-serialconsole" +package_pprint_name = "SerialConsole" +package_doc_id = "" +is_stable = false +is_arm = true diff --git a/azure-mgmt-serialconsole/setup.cfg b/azure-mgmt-serialconsole/setup.cfg new file mode 100644 index 000000000000..856f4164982c --- /dev/null +++ b/azure-mgmt-serialconsole/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal=1 +azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-serialconsole/setup.py b/azure-mgmt-serialconsole/setup.py new file mode 100644 index 000000000000..335fc62f2ebb --- /dev/null +++ b/azure-mgmt-serialconsole/setup.py @@ -0,0 +1,86 @@ +#!/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 +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + cmdclass = {} + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-serialconsole" +PACKAGE_PPRINT_NAME = "SerialConsole" + +# 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'), '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.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + 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.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=["tests"]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + cmdclass=cmdclass +)