Skip to content

Commit

Permalink
[AutoPR billing/resource-manager] [Hub Generated] Review request for …
Browse files Browse the repository at this point in the history
…Microsoft.Billing to add version preview/2018-11-01-preview (#5778)

* Generated from 0cf3d3049b2c2fe52143981946a792cfac342bb3

removing CreatAzureSubscriptions request parameter as per feedback.

* Generated from f6c11061a7a800a0d91a044b48e9a9e81998552b

fixing model validation failure. skuid should be settable for creation requests.
  • Loading branch information
AutorestCI authored Jun 10, 2019
1 parent 4def6c8 commit 87ea734
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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_creation_request_py3 import InvoiceSectionCreationRequest
from .invoice_section_list_result_py3 import InvoiceSectionListResult
from .operation_status_py3 import OperationStatus
Expand Down Expand Up @@ -109,6 +110,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_creation_request import InvoiceSectionCreationRequest
from .invoice_section_list_result import InvoiceSectionListResult
from .operation_status import OperationStatus
Expand Down Expand Up @@ -203,6 +205,7 @@
'DepartmentListResult',
'EnrollmentAccountListResult',
'BillingProfileListResult',
'BillingProfileCreationParameters',
'InvoiceSectionCreationRequest',
'InvoiceSectionListResult',
'OperationStatus',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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]
"""

_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]'},
}

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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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]
"""

_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]'},
}

def __init__(self, *, display_name: str=None, po_number: str=None, address=None, invoice_email_opt_in: bool=None, enable_azure_sk_us=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
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ class EnabledAzureSKUs(Model):
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar sku_id: The sku id.
:vartype sku_id: str
:param sku_id: The sku id.
:type sku_id: str
:ivar sku_description: The sku description.
:vartype sku_description: str
"""

_validation = {
'sku_id': {'readonly': True},
'sku_description': {'readonly': True},
}

Expand All @@ -36,5 +35,5 @@ class EnabledAzureSKUs(Model):

def __init__(self, **kwargs):
super(EnabledAzureSKUs, self).__init__(**kwargs)
self.sku_id = None
self.sku_id = kwargs.get('sku_id', None)
self.sku_description = None
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ class EnabledAzureSKUs(Model):
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar sku_id: The sku id.
:vartype sku_id: str
:param sku_id: The sku id.
:type sku_id: str
:ivar sku_description: The sku description.
:vartype sku_description: str
"""

_validation = {
'sku_id': {'readonly': True},
'sku_description': {'readonly': True},
}

Expand All @@ -34,7 +33,7 @@ class EnabledAzureSKUs(Model):
'sku_description': {'key': 'skuDescription', 'type': 'str'},
}

def __init__(self, **kwargs) -> None:
def __init__(self, *, sku_id: str=None, **kwargs) -> None:
super(EnabledAzureSKUs, self).__init__(**kwargs)
self.sku_id = None
self.sku_id = sku_id
self.sku_description = None
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

0 comments on commit 87ea734

Please sign in to comment.