Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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 .resource import Resource
class GatewayResource(Resource):
"""Data model for an arm gateway resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Manager Resource ID.
:vartype id: str
:ivar type: Resource Manager Resource Type.
:vartype type: str
:ivar name: Resource Manager Resource Name.
:vartype name: str
:ivar location: Resource Manager Resource Location.
:vartype location: str
:param tags: Resource Manager Resource Tags.
:type tags: dict[str, str]
:param etag:
# 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 .resource import Resource
class SessionResource(Resource):
"""The session object.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Manager Resource ID.
:vartype id: str
:ivar type: Resource Manager Resource Type.
:vartype type: str
:ivar name: Resource Manager Resource Name.
:vartype name: str
:ivar location: Resource Manager Resource Location.
:vartype location: str
:param tags: Resource Manager Resource Tags.
:type tags: dict[str, str]
:param etag:
# 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 .resource import Resource
class PowerShellCommandStatus(Resource):
"""Result status from invoking a PowerShell command.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Manager Resource ID.
:vartype id: str
:ivar type: Resource Manager Resource Type.
:vartype type: str
:ivar name: Resource Manager Resource Name.
:vartype name: str
:ivar location: Resource Manager Resource Location.
:vartype location: str
:param tags: Resource Manager Resource Tags.
:type tags: dict[str, str]
:param etag:
# 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 .resource import Resource
class PowerShellSessionResource(Resource):
"""A PowerShell session resource (practically equivalent to a runspace
instance).
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Manager Resource ID.
:vartype id: str
:ivar type: Resource Manager Resource Type.
:vartype type: str
:ivar name: Resource Manager Resource Name.
:vartype name: str
:ivar location: Resource Manager Resource Location.
:vartype location: str
:param tags: Resource Manager Resource Tags.
:type tags: dict[str, str]
def __init__(self, **kwargs):
super(Resource, self).__init__(**kwargs)
self.id = None
self.type = None
self.name = None
self.location = None
self.tags = kwargs.get('tags', None)
self.etag = kwargs.get('etag', None)
# 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 .resource import Resource
class NodeResource(Resource):
"""A Node Resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Manager Resource ID.
:vartype id: str
:ivar type: Resource Manager Resource Type.
:vartype type: str
:ivar name: Resource Manager Resource Name.
:vartype name: str
:ivar location: Resource Manager Resource Location.
:vartype location: str
:param tags: Resource Manager Resource Tags.
:type tags: dict[str, str]
:param etag:
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
if response.status_code not in [200, 204]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'}
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(session_parameters, 'SessionParameters')
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
if response.status_code not in [200, 201, 202]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('SessionResource', response)
if response.status_code == 201:
deserialized = self._deserialize('SessionResource', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('SessionResource', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}'}
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = ServerManagementConfiguration(credentials, subscription_id, base_url)
super(ServerManagement, 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 = '2016-07-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.gateway = GatewayOperations(
self._client, self.config, self._serialize, self._deserialize)
self.node = NodeOperations(
self._client, self.config, self._serialize, self._deserialize)
self.session = SessionOperations(
self._client, self.config, self._serialize, self._deserialize)
self.power_shell = PowerShellOperations(
self._client, self.config, self._serialize, self._deserialize)