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
4 changes: 3 additions & 1 deletion azure-mgmt-subscription/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include *.rst
include azure_bdist_wheel.py
include azure/__init__.py
include azure/mgmt/__init__.py

8 changes: 4 additions & 4 deletions azure-mgmt-subscription/README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure Subscription Management Client Library.
This is the Microsoft Azure MyService Management 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 and 3.6.
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 <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
Expand Down Expand Up @@ -36,8 +36,8 @@ If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
Usage
=====

For code examples, see `Subscription Management
<https://docs.microsoft.com/python/azure/>`__
For code examples, see `MyService Management
<https://docs.microsoft.com/python/api/overview/azure/>`__
on docs.microsoft.com.


Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-subscription/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
2 changes: 1 addition & 1 deletion azure-mgmt-subscription/azure/mgmt/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from .subscription_paged import SubscriptionPaged
from .tenant_id_description_paged import TenantIdDescriptionPaged
from .subscription_client_enums import (
OfferType,
SubscriptionState,
SpendingLimit,
)
Expand All @@ -63,7 +62,6 @@
'LocationPaged',
'SubscriptionPaged',
'TenantIdDescriptionPaged',
'OfferType',
'SubscriptionState',
'SpendingLimit',
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
from enum import Enum


class OfferType(str, Enum):

ms_azr_0017_p = "MS-AZR-0017P"
ms_azr_0148_p = "MS-AZR-0148P"


class SubscriptionState(str, Enum):

enabled = "Enabled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,33 @@ class SubscriptionCreationParameters(Model):

:param display_name: The display name of the subscription.
:type display_name: str
:param owners: The list of principals that should be granted Owner access
on the subscription. Principals should be of type User, Service Principal
or Security Group.
:type owners: list[~azure.mgmt.subscription.models.AdPrincipal]
:param offer_type: The offer type of the subscription. For example,
MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement
devTest) are available. Only valid when creating a subscription in a
enrollment account scope. Possible values include: 'MS-AZR-0017P',
'MS-AZR-0148P'
:type offer_type: str or ~azure.mgmt.subscription.models.OfferType
:param billing_profile_id: The ARM id of the billing profile.
:type billing_profile_id: str
:param sku_id: The commerce id of the sku.
:type sku_id: str
:param cost_center: optional customer cost center
:type cost_center: str
:param owner: rbac owner of the subscription
:type owner: ~azure.mgmt.subscription.models.AdPrincipal
:param additional_parameters: Additional, untyped parameters to support
custom subscription creation scenarios.
:type additional_parameters: dict[str, object]
"""

_attribute_map = {
'display_name': {'key': 'displayName', 'type': 'str'},
'owners': {'key': 'owners', 'type': '[AdPrincipal]'},
'offer_type': {'key': 'offerType', 'type': 'str'},
'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'},
'sku_id': {'key': 'skuId', 'type': 'str'},
'cost_center': {'key': 'costCenter', 'type': 'str'},
'owner': {'key': 'owner', 'type': 'AdPrincipal'},
'additional_parameters': {'key': 'additionalParameters', 'type': '{object}'},
}

def __init__(self, **kwargs):
super(SubscriptionCreationParameters, self).__init__(**kwargs)
self.display_name = kwargs.get('display_name', None)
self.owners = kwargs.get('owners', None)
self.offer_type = kwargs.get('offer_type', None)
self.billing_profile_id = kwargs.get('billing_profile_id', None)
self.sku_id = kwargs.get('sku_id', None)
self.cost_center = kwargs.get('cost_center', None)
self.owner = kwargs.get('owner', None)
self.additional_parameters = kwargs.get('additional_parameters', None)
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,33 @@ class SubscriptionCreationParameters(Model):

:param display_name: The display name of the subscription.
:type display_name: str
:param owners: The list of principals that should be granted Owner access
on the subscription. Principals should be of type User, Service Principal
or Security Group.
:type owners: list[~azure.mgmt.subscription.models.AdPrincipal]
:param offer_type: The offer type of the subscription. For example,
MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement
devTest) are available. Only valid when creating a subscription in a
enrollment account scope. Possible values include: 'MS-AZR-0017P',
'MS-AZR-0148P'
:type offer_type: str or ~azure.mgmt.subscription.models.OfferType
:param billing_profile_id: The ARM id of the billing profile.
:type billing_profile_id: str
:param sku_id: The commerce id of the sku.
:type sku_id: str
:param cost_center: optional customer cost center
:type cost_center: str
:param owner: rbac owner of the subscription
:type owner: ~azure.mgmt.subscription.models.AdPrincipal
:param additional_parameters: Additional, untyped parameters to support
custom subscription creation scenarios.
:type additional_parameters: dict[str, object]
"""

_attribute_map = {
'display_name': {'key': 'displayName', 'type': 'str'},
'owners': {'key': 'owners', 'type': '[AdPrincipal]'},
'offer_type': {'key': 'offerType', 'type': 'str'},
'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'},
'sku_id': {'key': 'skuId', 'type': 'str'},
'cost_center': {'key': 'costCenter', 'type': 'str'},
'owner': {'key': 'owner', 'type': 'AdPrincipal'},
'additional_parameters': {'key': 'additionalParameters', 'type': '{object}'},
}

def __init__(self, *, display_name: str=None, owners=None, offer_type=None, additional_parameters=None, **kwargs) -> None:
def __init__(self, *, display_name: str=None, billing_profile_id: str=None, sku_id: str=None, cost_center: str=None, owner=None, additional_parameters=None, **kwargs) -> None:
super(SubscriptionCreationParameters, self).__init__(**kwargs)
self.display_name = display_name
self.owners = owners
self.offer_type = offer_type
self.billing_profile_id = billing_profile_id
self.sku_id = sku_id
self.cost_center = cost_center
self.owner = owner
self.additional_parameters = additional_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# --------------------------------------------------------------------------

from .operations import Operations
from .subscription_operations import SubscriptionOperations
from .subscription_operation_operations import SubscriptionOperationOperations
from .subscription_factory_operations import SubscriptionFactoryOperations
from .subscriptions_operations import SubscriptionsOperations
from .tenants_operations import TenantsOperations

__all__ = [
'Operations',
'SubscriptionOperations',
'SubscriptionOperationOperations',
'SubscriptionFactoryOperations',
'SubscriptionsOperations',
'TenantsOperations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Operations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. Current version is 2015-06-01. Constant value: "2018-03-01-preview".
:ivar api_version: Version of the API to be used with the client request. Current version is 2015-06-01. Constant value: "2018-11-01-preview".
"""

models = models
Expand All @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-03-01-preview"
self.api_version = "2018-11-01-preview"

self.config = config

Expand Down Expand Up @@ -60,7 +60,7 @@ def list(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -69,8 +69,8 @@ def list(
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)
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.ErrorResponseException(self._deserialize, response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SubscriptionFactoryOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. Current version is 2015-06-01. Constant value: "2018-03-01-preview".
:ivar api_version: Version of the API to be used with the client request. Current version is 2015-06-01. Constant value: "2018-11-01-preview".
"""

models = models
Expand All @@ -34,17 +34,18 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-03-01-preview"
self.api_version = "2018-11-01-preview"

self.config = config


def _create_subscription_in_enrollment_account_initial(
self, enrollment_account_name, body, custom_headers=None, raw=False, **operation_config):
def _create_subscription_initial(
self, billing_account_name, invoice_section_name, body, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create_subscription_in_enrollment_account.metadata['url']
url = self.create_subscription.metadata['url']
path_format_arguments = {
'enrollmentAccountName': self._serialize.url("enrollment_account_name", enrollment_account_name, 'str')
'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'),
'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

Expand All @@ -54,6 +55,7 @@ def _create_subscription_in_enrollment_account_initial(

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
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())
Expand All @@ -66,9 +68,8 @@ def _create_subscription_in_enrollment_account_initial(
body_content = self._serialize.body(body, 'SubscriptionCreationParameters')

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200, 202]:
raise models.ErrorResponseException(self._deserialize, response)
Expand All @@ -80,7 +81,7 @@ def _create_subscription_in_enrollment_account_initial(
deserialized = self._deserialize('SubscriptionCreationResult', response)
header_dict = {
'Location': 'str',
'Retry-After': 'str',
'Retry-After': 'int',
}

if raw:
Expand All @@ -90,13 +91,15 @@ def _create_subscription_in_enrollment_account_initial(

return deserialized

def create_subscription_in_enrollment_account(
self, enrollment_account_name, body, custom_headers=None, raw=False, polling=True, **operation_config):
def create_subscription(
self, billing_account_name, invoice_section_name, body, custom_headers=None, raw=False, polling=True, **operation_config):
"""Creates an Azure subscription.

:param enrollment_account_name: The name of the enrollment account to
which the subscription will be billed.
:type enrollment_account_name: str
:param billing_account_name: The name of the commerce root billing
account.
:type billing_account_name: str
:param invoice_section_name: The name of the invoice section.
:type invoice_section_name: str
:param body: The subscription creation parameters.
:type body:
~azure.mgmt.subscription.models.SubscriptionCreationParameters
Expand All @@ -115,8 +118,9 @@ def create_subscription_in_enrollment_account(
:raises:
:class:`ErrorResponseException<azure.mgmt.subscription.models.ErrorResponseException>`
"""
raw_result = self._create_subscription_in_enrollment_account_initial(
enrollment_account_name=enrollment_account_name,
raw_result = self._create_subscription_initial(
billing_account_name=billing_account_name,
invoice_section_name=invoice_section_name,
body=body,
custom_headers=custom_headers,
raw=True,
Expand All @@ -126,7 +130,7 @@ def create_subscription_in_enrollment_account(
def get_long_running_output(response):
header_dict = {
'Location': 'str',
'Retry-After': 'str',
'Retry-After': 'int',
}
deserialized = self._deserialize('SubscriptionCreationResult', response)

Expand All @@ -144,4 +148,4 @@ def get_long_running_output(response):
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
create_subscription_in_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription'}
create_subscription.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription'}
Loading