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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .version import VERSION
from .operations.billing_accounts_operations import BillingAccountsOperations
from .operations.payment_methods_operations import PaymentMethodsOperations
from .operations.billing_accounts_validate_address_operations import BillingAccountsValidateAddressOperations
from .operations.available_balances_operations import AvailableBalancesOperations
from .operations.billing_profiles_operations import BillingProfilesOperations
from .operations.invoice_sections_operations import InvoiceSectionsOperations
Expand Down Expand Up @@ -79,6 +80,8 @@ class BillingManagementClient(SDKClient):
:vartype billing_accounts: azure.mgmt.billing.operations.BillingAccountsOperations
:ivar payment_methods: PaymentMethods operations
:vartype payment_methods: azure.mgmt.billing.operations.PaymentMethodsOperations
:ivar billing_accounts_validate_address: BillingAccountsValidateAddress operations
:vartype billing_accounts_validate_address: azure.mgmt.billing.operations.BillingAccountsValidateAddressOperations
:ivar available_balances: AvailableBalances operations
:vartype available_balances: azure.mgmt.billing.operations.AvailableBalancesOperations
:ivar billing_profiles: BillingProfiles operations
Expand Down Expand Up @@ -141,6 +144,8 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.payment_methods = PaymentMethodsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.billing_accounts_validate_address = BillingAccountsValidateAddressOperations(
self._client, self.config, self._serialize, self._deserialize)
self.available_balances = AvailableBalancesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.billing_profiles = BillingProfilesOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

try:
from .initiate_transfer_request_py3 import InitiateTransferRequest
from .address_py3 import Address
from .validate_address_response_py3 import ValidateAddressResponse
from .product_details_py3 import ProductDetails
from .accept_transfer_request_py3 import AcceptTransferRequest
from .error_py3 import Error
Expand All @@ -22,7 +24,6 @@
from .transfer_billing_subscription_request_properties_py3 import TransferBillingSubscriptionRequestProperties
from .transfer_billing_subscription_request_py3 import TransferBillingSubscriptionRequest
from .update_auto_renew_operation_summary_py3 import UpdateAutoRenewOperationSummary
from .address_py3 import Address
from .enabled_azure_sk_us_py3 import EnabledAzureSKUs
from .billing_profile_py3 import BillingProfile
from .invoice_section_properties_py3 import InvoiceSectionProperties
Expand Down Expand Up @@ -73,6 +74,8 @@
from .agreement_list_result_py3 import AgreementListResult
except (SyntaxError, ImportError):
from .initiate_transfer_request import InitiateTransferRequest
from .address import Address
from .validate_address_response import ValidateAddressResponse
from .product_details import ProductDetails
from .accept_transfer_request import AcceptTransferRequest
from .error import Error
Expand All @@ -84,7 +87,6 @@
from .transfer_billing_subscription_request_properties import TransferBillingSubscriptionRequestProperties
from .transfer_billing_subscription_request import TransferBillingSubscriptionRequest
from .update_auto_renew_operation_summary import UpdateAutoRenewOperationSummary
from .address import Address
from .enabled_azure_sk_us import EnabledAzureSKUs
from .billing_profile import BillingProfile
from .invoice_section_properties import InvoiceSectionProperties
Expand Down Expand Up @@ -141,6 +143,7 @@
from .recipient_transfer_details_paged import RecipientTransferDetailsPaged
from .operation_paged import OperationPaged
from .billing_management_client_enums import (
AddressValidationStatus,
ProductType,
TransferStatus,
ProductTransferStatus,
Expand All @@ -156,6 +159,8 @@

__all__ = [
'InitiateTransferRequest',
'Address',
'ValidateAddressResponse',
'ProductDetails',
'AcceptTransferRequest',
'Error',
Expand All @@ -167,7 +172,6 @@
'TransferBillingSubscriptionRequestProperties',
'TransferBillingSubscriptionRequest',
'UpdateAutoRenewOperationSummary',
'Address',
'EnabledAzureSKUs',
'BillingProfile',
'InvoiceSectionProperties',
Expand Down Expand Up @@ -223,6 +227,7 @@
'TransferDetailsPaged',
'RecipientTransferDetailsPaged',
'OperationPaged',
'AddressValidationStatus',
'ProductType',
'TransferStatus',
'ProductTransferStatus',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
from enum import Enum


class AddressValidationStatus(str, Enum):

valid = "Valid"
invalid = "Invalid"


class ProductType(str, Enum):

azure_subscription = "AzureSubscription"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 ValidateAddressResponse(Model):
"""Result of the address validation.

:param status: status of the address validation. Possible values include:
'Valid', 'Invalid'
:type status: str or ~azure.mgmt.billing.models.AddressValidationStatus
:param suggested_addresses: list of suggested addresses.
:type suggested_addresses: list[~azure.mgmt.billing.models.Address]
:param validation_message: Validation error message.
:type validation_message: str
"""

_attribute_map = {
'status': {'key': 'status', 'type': 'str'},
'suggested_addresses': {'key': 'suggestedAddresses', 'type': '[Address]'},
'validation_message': {'key': 'validationMessage', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ValidateAddressResponse, self).__init__(**kwargs)
self.status = kwargs.get('status', None)
self.suggested_addresses = kwargs.get('suggested_addresses', None)
self.validation_message = kwargs.get('validation_message', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 ValidateAddressResponse(Model):
"""Result of the address validation.

:param status: status of the address validation. Possible values include:
'Valid', 'Invalid'
:type status: str or ~azure.mgmt.billing.models.AddressValidationStatus
:param suggested_addresses: list of suggested addresses.
:type suggested_addresses: list[~azure.mgmt.billing.models.Address]
:param validation_message: Validation error message.
:type validation_message: str
"""

_attribute_map = {
'status': {'key': 'status', 'type': 'str'},
'suggested_addresses': {'key': 'suggestedAddresses', 'type': '[Address]'},
'validation_message': {'key': 'validationMessage', 'type': 'str'},
}

def __init__(self, *, status=None, suggested_addresses=None, validation_message: str=None, **kwargs) -> None:
super(ValidateAddressResponse, self).__init__(**kwargs)
self.status = status
self.suggested_addresses = suggested_addresses
self.validation_message = validation_message
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from .billing_accounts_operations import BillingAccountsOperations
from .payment_methods_operations import PaymentMethodsOperations
from .billing_accounts_validate_address_operations import BillingAccountsValidateAddressOperations
from .available_balances_operations import AvailableBalancesOperations
from .billing_profiles_operations import BillingProfilesOperations
from .invoice_sections_operations import InvoiceSectionsOperations
Expand All @@ -34,6 +35,7 @@
__all__ = [
'BillingAccountsOperations',
'PaymentMethodsOperations',
'BillingAccountsValidateAddressOperations',
'AvailableBalancesOperations',
'BillingProfilesOperations',
'InvoiceSectionsOperations',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 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.
# --------------------------------------------------------------------------

import uuid
from msrest.pipeline import ClientRawResponse

from .. import models


class BillingAccountsValidateAddressOperations(object):
"""BillingAccountsValidateAddressOperations operations.

:param client: Client for service requests.
: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. The current version is 2018-11-01-preview. Constant value: "2018-11-01-preview".
"""

models = models

def __init__(self, client, config, serializer, deserializer):

self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-11-01-preview"

self.config = config

def post(
self, billing_account_name, address, custom_headers=None, raw=False, **operation_config):
"""Validates the address.

:param billing_account_name: billing Account Id.
:type billing_account_name: str
:param address:
:type address: ~azure.mgmt.billing.models.Address
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: ValidateAddressResponse or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.billing.models.ValidateAddressResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.billing.models.ErrorResponseException>`
"""
# Construct URL
url = self.post.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(address, 'Address')

# 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]:
raise models.ErrorResponseException(self._deserialize, response)

deserialized = None

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

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

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