Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .canceled_subscription_id_py3 import CanceledSubscriptionId
from .renamed_subscription_id_py3 import RenamedSubscriptionId
from .enabled_subscription_id_py3 import EnabledSubscriptionId
from .subscription_name_py3 import SubscriptionName
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
Expand All @@ -25,6 +26,7 @@
from .error_response import ErrorResponse, ErrorResponseException
from .canceled_subscription_id import CanceledSubscriptionId
from .renamed_subscription_id import RenamedSubscriptionId
from .enabled_subscription_id import EnabledSubscriptionId
from .subscription_name import SubscriptionName
from .operation_display import OperationDisplay
from .operation import Operation
Expand All @@ -45,6 +47,7 @@
'ErrorResponse', 'ErrorResponseException',
'CanceledSubscriptionId',
'RenamedSubscriptionId',
'EnabledSubscriptionId',
'SubscriptionName',
'OperationDisplay',
'Operation',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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 EnabledSubscriptionId(Model):
"""Enabled Subscription Id.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar value: Enabled Subscription Id
:vartype value: str
"""

_validation = {
'value': {'readonly': True},
}

_attribute_map = {
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, **kwargs):
super(EnabledSubscriptionId, self).__init__(**kwargs)
self.value = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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 EnabledSubscriptionId(Model):
"""Enabled Subscription Id.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar value: Enabled Subscription Id
:vartype value: str
"""

_validation = {
'value': {'readonly': True},
}

_attribute_map = {
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, **kwargs) -> None:
super(EnabledSubscriptionId, self).__init__(**kwargs)
self.value = None
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,65 @@ def rename(
return deserialized
rename.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename'}

def enable(
self, subscription_id, custom_headers=None, raw=False, **operation_config):
"""Enables the subscription.

:param subscription_id: Subscription Id.
:type subscription_id: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: EnabledSubscriptionId or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.subscription.models.EnabledSubscriptionId or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.subscription.models.ErrorResponseException>`
"""
api_version = "2019-03-01-preview"

# Construct URL
url = self.enable.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("api_version", 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.ErrorResponseException(self._deserialize, response)

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('EnabledSubscriptionId', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
enable.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable'}

def list_locations(
self, subscription_id, custom_headers=None, raw=False, **operation_config):
"""Gets all available geo-locations.
Expand Down