Skip to content

Commit

Permalink
[AutoPR] subscription/resource-manager (#5468)
Browse files Browse the repository at this point in the history
* Generated from 555ef685658c54b026392ec09e31b26c8baa71f6 (#5467)

Make subscription a method parameter

* Update version.py

* Update HISTORY.rst
  • Loading branch information
AutorestCI authored and lmazuel committed May 24, 2019
1 parent 2a99c7b commit 6e5ba1b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
7 changes: 7 additions & 0 deletions sdk/subscription/azure-mgmt-subscription/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Release History
===============

0.4.1 (2019-05-24)
++++++++++++++++++

**Bug fix**

- Remove subscription_id as a client required parameter

0.4.0 (2019-05-21)
++++++++++++++++++

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def cancel(
self, custom_headers=None, raw=False, **operation_config):
self, subscription_id, custom_headers=None, raw=False, **operation_config):
"""Cancels 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
Expand All @@ -55,7 +57,7 @@ def cancel(
# Construct URL
url = self.cancel.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down Expand Up @@ -93,9 +95,11 @@ def cancel(
cancel.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel'}

def rename(
self, subscription_name=None, custom_headers=None, raw=False, **operation_config):
self, subscription_id, subscription_name=None, custom_headers=None, raw=False, **operation_config):
"""Renames the subscription.
:param subscription_id: Subscription Id.
:type subscription_id: str
:param subscription_name: New subscription name
:type subscription_name: str
:param dict custom_headers: headers that will be added to the request
Expand All @@ -116,7 +120,7 @@ def rename(
# Construct URL
url = self.rename.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ class SubscriptionClientConfiguration(AzureConfiguration):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription Id.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, 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'

Expand All @@ -48,7 +44,6 @@ def __init__(
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class SubscriptionClient(SDKClient):
Expand All @@ -67,15 +62,13 @@ class SubscriptionClient(SDKClient):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription Id.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, base_url=None):

self.config = SubscriptionClientConfiguration(credentials, subscription_id, base_url)
self.config = SubscriptionClientConfiguration(credentials, base_url)
super(SubscriptionClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.4.0"
VERSION = "0.4.1"

0 comments on commit 6e5ba1b

Please sign in to comment.