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 #5590

Merged
merged 1 commit into from
May 31, 2019
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 @@ -33,6 +33,7 @@
from .department_py3 import Department
from .billing_account_py3 import BillingAccount
from .billing_account_list_result_py3 import BillingAccountListResult
from .billing_account_update_properties_py3 import BillingAccountUpdateProperties
from .billing_property_py3 import BillingProperty
from .department_list_result_py3 import DepartmentListResult
from .enrollment_account_list_result_py3 import EnrollmentAccountListResult
Expand Down Expand Up @@ -97,6 +98,7 @@
from .department import Department
from .billing_account import BillingAccount
from .billing_account_list_result import BillingAccountListResult
from .billing_account_update_properties import BillingAccountUpdateProperties
from .billing_property import BillingProperty
from .department_list_result import DepartmentListResult
from .enrollment_account_list_result import EnrollmentAccountListResult
Expand Down Expand Up @@ -184,6 +186,7 @@
'Department',
'BillingAccount',
'BillingAccountListResult',
'BillingAccountUpdateProperties',
'BillingProperty',
'DepartmentListResult',
'EnrollmentAccountListResult',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 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 BillingAccountUpdateProperties(Model):
"""The properties of the billing account that can be updated.

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

:ivar display_name: The billing account name.
:vartype display_name: str
:ivar account_type: The billing account Type. Possible values include:
'Organization', 'Enrollment'
:vartype account_type: str or ~azure.mgmt.billing.models.enum
:param address: The address associated with billing account.
:type address: ~azure.mgmt.billing.models.Address
:ivar company: Company Name.
:vartype company: str
:ivar country: Country Name.
:vartype country: str
:param invoice_sections: The invoice sections associated to the billing
account. By default this is not populated, unless it's specified in
$expand.
:type invoice_sections: list[~azure.mgmt.billing.models.InvoiceSection]
:param billing_profiles: The billing profiles associated to the billing
account. By default this is not populated, unless it's specified in
$expand.
:type billing_profiles: list[~azure.mgmt.billing.models.BillingProfile]
:ivar enrollment_details: The details about the associated legacy
enrollment. By default this is not populated, unless it's specified in
$expand.
:vartype enrollment_details: ~azure.mgmt.billing.models.Enrollment
:param departments: The departments associated to the enrollment.
:type departments: list[~azure.mgmt.billing.models.Department]
:param enrollment_accounts: The accounts associated to the enrollment.
:type enrollment_accounts:
list[~azure.mgmt.billing.models.EnrollmentAccount]
:ivar has_read_access: Specifies whether the user has read access on
billing account.
:vartype has_read_access: bool
"""

_validation = {
'display_name': {'readonly': True},
'account_type': {'readonly': True},
'company': {'readonly': True},
'country': {'readonly': True},
'enrollment_details': {'readonly': True},
'has_read_access': {'readonly': True},
}

_attribute_map = {
'display_name': {'key': 'properties.displayName', 'type': 'str'},
'account_type': {'key': 'properties.accountType', 'type': 'str'},
'address': {'key': 'properties.address', 'type': 'Address'},
'company': {'key': 'properties.company', 'type': 'str'},
'country': {'key': 'properties.country', 'type': 'str'},
'invoice_sections': {'key': 'properties.invoiceSections', 'type': '[InvoiceSection]'},
'billing_profiles': {'key': 'properties.billingProfiles', 'type': '[BillingProfile]'},
'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'},
'departments': {'key': 'properties.departments', 'type': '[Department]'},
'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'},
'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'},
}

def __init__(self, **kwargs):
super(BillingAccountUpdateProperties, self).__init__(**kwargs)
self.display_name = None
self.account_type = None
self.address = kwargs.get('address', None)
self.company = None
self.country = None
self.invoice_sections = kwargs.get('invoice_sections', None)
self.billing_profiles = kwargs.get('billing_profiles', None)
self.enrollment_details = None
self.departments = kwargs.get('departments', None)
self.enrollment_accounts = kwargs.get('enrollment_accounts', None)
self.has_read_access = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 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 BillingAccountUpdateProperties(Model):
"""The properties of the billing account that can be updated.

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

:ivar display_name: The billing account name.
:vartype display_name: str
:ivar account_type: The billing account Type. Possible values include:
'Organization', 'Enrollment'
:vartype account_type: str or ~azure.mgmt.billing.models.enum
:param address: The address associated with billing account.
:type address: ~azure.mgmt.billing.models.Address
:ivar company: Company Name.
:vartype company: str
:ivar country: Country Name.
:vartype country: str
:param invoice_sections: The invoice sections associated to the billing
account. By default this is not populated, unless it's specified in
$expand.
:type invoice_sections: list[~azure.mgmt.billing.models.InvoiceSection]
:param billing_profiles: The billing profiles associated to the billing
account. By default this is not populated, unless it's specified in
$expand.
:type billing_profiles: list[~azure.mgmt.billing.models.BillingProfile]
:ivar enrollment_details: The details about the associated legacy
enrollment. By default this is not populated, unless it's specified in
$expand.
:vartype enrollment_details: ~azure.mgmt.billing.models.Enrollment
:param departments: The departments associated to the enrollment.
:type departments: list[~azure.mgmt.billing.models.Department]
:param enrollment_accounts: The accounts associated to the enrollment.
:type enrollment_accounts:
list[~azure.mgmt.billing.models.EnrollmentAccount]
:ivar has_read_access: Specifies whether the user has read access on
billing account.
:vartype has_read_access: bool
"""

_validation = {
'display_name': {'readonly': True},
'account_type': {'readonly': True},
'company': {'readonly': True},
'country': {'readonly': True},
'enrollment_details': {'readonly': True},
'has_read_access': {'readonly': True},
}

_attribute_map = {
'display_name': {'key': 'properties.displayName', 'type': 'str'},
'account_type': {'key': 'properties.accountType', 'type': 'str'},
'address': {'key': 'properties.address', 'type': 'Address'},
'company': {'key': 'properties.company', 'type': 'str'},
'country': {'key': 'properties.country', 'type': 'str'},
'invoice_sections': {'key': 'properties.invoiceSections', 'type': '[InvoiceSection]'},
'billing_profiles': {'key': 'properties.billingProfiles', 'type': '[BillingProfile]'},
'enrollment_details': {'key': 'properties.enrollmentDetails', 'type': 'Enrollment'},
'departments': {'key': 'properties.departments', 'type': '[Department]'},
'enrollment_accounts': {'key': 'properties.enrollmentAccounts', 'type': '[EnrollmentAccount]'},
'has_read_access': {'key': 'properties.hasReadAccess', 'type': 'bool'},
}

def __init__(self, *, address=None, invoice_sections=None, billing_profiles=None, departments=None, enrollment_accounts=None, **kwargs) -> None:
super(BillingAccountUpdateProperties, self).__init__(**kwargs)
self.display_name = None
self.account_type = None
self.address = address
self.company = None
self.country = None
self.invoice_sections = invoice_sections
self.billing_profiles = billing_profiles
self.enrollment_details = None
self.departments = departments
self.enrollment_accounts = enrollment_accounts
self.has_read_access = None
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import uuid
from msrest.pipeline import ClientRawResponse
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling

from .. import models

Expand Down Expand Up @@ -153,3 +155,99 @@ def get(

return deserialized
get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}'}


def _update_initial(
self, billing_account_name, parameters, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.update.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, 'BillingAccountUpdateProperties')

# Construct and send request
request = self._client.patch(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

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

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

return deserialized

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

:param billing_account_name: billing Account Id.
:type billing_account_name: str
:param parameters: Parameters supplied to the update billing account
operation.
:type parameters:
~azure.mgmt.billing.models.BillingAccountUpdateProperties
: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 BillingAccount or
ClientRawResponse<BillingAccount> if raw==True
:rtype:
~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.billing.models.BillingAccount]
or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.billing.models.BillingAccount]]
:raises:
:class:`ErrorResponseException<azure.mgmt.billing.models.ErrorResponseException>`
"""
raw_result = self._update_initial(
billing_account_name=billing_account_name,
parameters=parameters,
custom_headers=custom_headers,
raw=True,
**operation_config
)

def get_long_running_output(response):
deserialized = self._deserialize('BillingAccount', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
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)
update.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}'}