Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR billing/resource-manager] [Hub Generated] Review request for Microsoft.Billing to add version preview/2018-11-01-preview #5240

Closed
Closed
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
3 changes: 3 additions & 0 deletions azure-mgmt-billing/azure/mgmt/billing/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from .department_list_result_py3 import DepartmentListResult
from .enrollment_account_list_result_py3 import EnrollmentAccountListResult
from .billing_profile_list_result_py3 import BillingProfileListResult
from .billing_profile_creation_parameters_py3 import BillingProfileCreationParameters
from .invoice_section_list_result_py3 import InvoiceSectionListResult
from .operation_status_py3 import OperationStatus
from .download_url_py3 import DownloadUrl
Expand Down Expand Up @@ -99,6 +100,7 @@
from .department_list_result import DepartmentListResult
from .enrollment_account_list_result import EnrollmentAccountListResult
from .billing_profile_list_result import BillingProfileListResult
from .billing_profile_creation_parameters import BillingProfileCreationParameters
from .invoice_section_list_result import InvoiceSectionListResult
from .operation_status import OperationStatus
from .download_url import DownloadUrl
Expand Down Expand Up @@ -182,6 +184,7 @@
'DepartmentListResult',
'EnrollmentAccountListResult',
'BillingProfileListResult',
'BillingProfileCreationParameters',
'InvoiceSectionListResult',
'OperationStatus',
'DownloadUrl',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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 BillingProfileCreationParameters(Model):
"""The parameters for creating a new billing profile.

:param display_name: The billing profile name.
:type display_name: str
:param po_number: Purchase order number.
:type po_number: str
:param address: Billing address.
:type address: ~azure.mgmt.billing.models.Address
:param invoice_email_opt_in: If the billing profile is opted in to receive
invoices via email.
:type invoice_email_opt_in: bool
:param enable_azure_sk_us: Azure skus to enable for this billing profile..
:type enable_azure_sk_us:
list[~azure.mgmt.billing.models.EnabledAzureSKUs]
:param create_azure_subscriptions: Create azure subscriptions when
creating this billing profile.
:type create_azure_subscriptions: bool
"""

_attribute_map = {
'display_name': {'key': 'displayName', 'type': 'str'},
'po_number': {'key': 'poNumber', 'type': 'str'},
'address': {'key': 'address', 'type': 'Address'},
'invoice_email_opt_in': {'key': 'invoiceEmailOptIn', 'type': 'bool'},
'enable_azure_sk_us': {'key': 'enableAzureSKUs', 'type': '[EnabledAzureSKUs]'},
'create_azure_subscriptions': {'key': 'createAzureSubscriptions', 'type': 'bool'},
}

def __init__(self, **kwargs):
super(BillingProfileCreationParameters, self).__init__(**kwargs)
self.display_name = kwargs.get('display_name', None)
self.po_number = kwargs.get('po_number', None)
self.address = kwargs.get('address', None)
self.invoice_email_opt_in = kwargs.get('invoice_email_opt_in', None)
self.enable_azure_sk_us = kwargs.get('enable_azure_sk_us', None)
self.create_azure_subscriptions = kwargs.get('create_azure_subscriptions', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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 BillingProfileCreationParameters(Model):
"""The parameters for creating a new billing profile.

:param display_name: The billing profile name.
:type display_name: str
:param po_number: Purchase order number.
:type po_number: str
:param address: Billing address.
:type address: ~azure.mgmt.billing.models.Address
:param invoice_email_opt_in: If the billing profile is opted in to receive
invoices via email.
:type invoice_email_opt_in: bool
:param enable_azure_sk_us: Azure skus to enable for this billing profile..
:type enable_azure_sk_us:
list[~azure.mgmt.billing.models.EnabledAzureSKUs]
:param create_azure_subscriptions: Create azure subscriptions when
creating this billing profile.
:type create_azure_subscriptions: bool
"""

_attribute_map = {
'display_name': {'key': 'displayName', 'type': 'str'},
'po_number': {'key': 'poNumber', 'type': 'str'},
'address': {'key': 'address', 'type': 'Address'},
'invoice_email_opt_in': {'key': 'invoiceEmailOptIn', 'type': 'bool'},
'enable_azure_sk_us': {'key': 'enableAzureSKUs', 'type': '[EnabledAzureSKUs]'},
'create_azure_subscriptions': {'key': 'createAzureSubscriptions', 'type': 'bool'},
}

def __init__(self, *, display_name: str=None, po_number: str=None, address=None, invoice_email_opt_in: bool=None, enable_azure_sk_us=None, create_azure_subscriptions: bool=None, **kwargs) -> None:
super(BillingProfileCreationParameters, self).__init__(**kwargs)
self.display_name = display_name
self.po_number = po_number
self.address = address
self.invoice_email_opt_in = invoice_email_opt_in
self.enable_azure_sk_us = enable_azure_sk_us
self.create_azure_subscriptions = create_azure_subscriptions
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,115 @@ def list_by_billing_account_name(
return deserialized
list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles'}


def _create_initial(
self, billing_account_name, parameters, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create.metadata['url']
path_format_arguments = {
'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, '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'
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 body
body_content = self._serialize.body(parameters, 'BillingProfileCreationParameters')

# Construct and send request
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)

deserialized = None
header_dict = {}

if response.status_code == 200:
deserialized = self._deserialize('BillingProfile', response)
header_dict = {
'Location': 'str',
'Retry-After': 'int',
'Azure-AsyncOperation': 'str',
}

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

return deserialized

def create(
self, billing_account_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config):
"""The operation to create a BillingProfile.

:param billing_account_name: billing Account Id.
:type billing_account_name: str
:param parameters: Parameters supplied to the Create BillingProfile
operation.
:type parameters:
~azure.mgmt.billing.models.BillingProfileCreationParameters
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of LROPoller that returns BillingProfile or
ClientRawResponse<BillingProfile> if raw==True
:rtype:
~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.BillingProfile]
or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.BillingProfile]]
:raises:
:class:`ErrorResponseException<azure.mgmt.billing.models.ErrorResponseException>`
"""
raw_result = self._create_initial(
billing_account_name=billing_account_name,
parameters=parameters,
custom_headers=custom_headers,
raw=True,
**operation_config
)

def get_long_running_output(response):
header_dict = {
'Location': 'str',
'Retry-After': 'int',
'Azure-AsyncOperation': 'str',
}
deserialized = self._deserialize('BillingProfile', response)

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

return deserialized

lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
create.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles'}

def get(
self, billing_account_name, billing_profile_name, expand=None, custom_headers=None, raw=False, **operation_config):
"""Get the billing profile by id.
Expand Down