From 850a0465eeb5c803f852ed5e8c8ea3967e76eb01 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 3 Apr 2019 23:41:57 +0000 Subject: [PATCH] Generated from 2a236eb424b381bb392607c40a9ea40f0f7094f4 Added specs for Agreements API in version 2018-11-01-preview Added specs for Agreements API in version 2018-11-01-preview --- .../mgmt/billing/billing_management_client.py | 5 + .../azure/mgmt/billing/models/__init__.py | 9 + .../azure/mgmt/billing/models/agreement.py | 66 +++++++ .../billing/models/agreement_list_result.py | 40 +++++ .../models/agreement_list_result_py3.py | 40 +++++ .../mgmt/billing/models/agreement_py3.py | 66 +++++++ .../azure/mgmt/billing/models/participants.py | 45 +++++ .../mgmt/billing/models/participants_py3.py | 45 +++++ .../azure/mgmt/billing/operations/__init__.py | 2 + .../operations/agreements_operations.py | 162 ++++++++++++++++++ 10 files changed, 480 insertions(+) create mode 100644 azure-mgmt-billing/azure/mgmt/billing/models/agreement.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result_py3.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/models/agreement_py3.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/models/participants.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/models/participants_py3.py create mode 100644 azure-mgmt-billing/azure/mgmt/billing/operations/agreements_operations.py diff --git a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py index f2f582b55603..bbca6c5568d3 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py +++ b/azure-mgmt-billing/azure/mgmt/billing/billing_management_client.py @@ -58,6 +58,7 @@ from .operations.billing_account_billing_role_assignment_operations import BillingAccountBillingRoleAssignmentOperations from .operations.invoice_section_billing_role_assignment_operations import InvoiceSectionBillingRoleAssignmentOperations from .operations.billing_profile_billing_role_assignment_operations import BillingProfileBillingRoleAssignmentOperations +from .operations.agreements_operations import AgreementsOperations from . import models @@ -181,6 +182,8 @@ class BillingManagementClient(SDKClient): :vartype invoice_section_billing_role_assignment: azure.mgmt.billing.operations.InvoiceSectionBillingRoleAssignmentOperations :ivar billing_profile_billing_role_assignment: BillingProfileBillingRoleAssignment operations :vartype billing_profile_billing_role_assignment: azure.mgmt.billing.operations.BillingProfileBillingRoleAssignmentOperations + :ivar agreements: Agreements operations + :vartype agreements: azure.mgmt.billing.operations.AgreementsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -283,6 +286,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.billing_profile_billing_role_assignment = BillingProfileBillingRoleAssignmentOperations( self._client, self.config, self._serialize, self._deserialize) + self.agreements = AgreementsOperations( + self._client, self.config, self._serialize, self._deserialize) def update_auto_renew_for_billing_account( self, billing_account_name, product_name, auto_renew=None, custom_headers=None, raw=False, **operation_config): diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py index 1f3d0ce9efe6..df3bc8c9a5c1 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py @@ -68,6 +68,9 @@ from .billing_permissions_list_result_py3 import BillingPermissionsListResult from .billing_role_definition_py3 import BillingRoleDefinition from .billing_role_definition_list_result_py3 import BillingRoleDefinitionListResult + from .participants_py3 import Participants + from .agreement_py3 import Agreement + from .agreement_list_result_py3 import AgreementListResult except (SyntaxError, ImportError): from .initiate_transfer_request import InitiateTransferRequest from .product_details import ProductDetails @@ -127,6 +130,9 @@ from .billing_permissions_list_result import BillingPermissionsListResult from .billing_role_definition import BillingRoleDefinition from .billing_role_definition_list_result import BillingRoleDefinitionListResult + from .participants import Participants + from .agreement import Agreement + from .agreement_list_result import AgreementListResult from .payment_method_paged import PaymentMethodPaged from .billing_subscription_summary_paged import BillingSubscriptionSummaryPaged from .product_summary_paged import ProductSummaryPaged @@ -207,6 +213,9 @@ 'BillingPermissionsListResult', 'BillingRoleDefinition', 'BillingRoleDefinitionListResult', + 'Participants', + 'Agreement', + 'AgreementListResult', 'PaymentMethodPaged', 'BillingSubscriptionSummaryPaged', 'ProductSummaryPaged', diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/agreement.py b/azure-mgmt-billing/azure/mgmt/billing/models/agreement.py new file mode 100644 index 000000000000..a117306b8f54 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/agreement.py @@ -0,0 +1,66 @@ +# 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 .resource import Resource + + +class Agreement(Resource): + """An agreement resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar agreement_link: The link to the agreement. + :vartype agreement_link: str + :ivar effective_date: Effective date. + :vartype effective_date: datetime + :ivar expiration_date: Expiration date. + :vartype expiration_date: datetime + :param participants: Participants or signer of the agreement. + :type participants: list[~azure.mgmt.billing.models.Participants] + :ivar status: The agreement status + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'agreement_link': {'readonly': True}, + 'effective_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'agreement_link': {'key': 'properties.agreementLink', 'type': 'str'}, + 'effective_date': {'key': 'properties.effectiveDate', 'type': 'iso-8601'}, + 'expiration_date': {'key': 'properties.expirationDate', 'type': 'iso-8601'}, + 'participants': {'key': 'properties.participants', 'type': '[Participants]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Agreement, self).__init__(**kwargs) + self.agreement_link = None + self.effective_date = None + self.expiration_date = None + self.participants = kwargs.get('participants', None) + self.status = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result.py b/azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result.py new file mode 100644 index 000000000000..a6f6c98716a6 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result.py @@ -0,0 +1,40 @@ +# 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 AgreementListResult(Model): + """Result of listing agreements. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of agreements. + :vartype value: list[~azure.mgmt.billing.models.Agreement] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Agreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AgreementListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result_py3.py b/azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result_py3.py new file mode 100644 index 000000000000..901473f2cb25 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/agreement_list_result_py3.py @@ -0,0 +1,40 @@ +# 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 AgreementListResult(Model): + """Result of listing agreements. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of agreements. + :vartype value: list[~azure.mgmt.billing.models.Agreement] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Agreement]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AgreementListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/agreement_py3.py b/azure-mgmt-billing/azure/mgmt/billing/models/agreement_py3.py new file mode 100644 index 000000000000..d8728de106f1 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/agreement_py3.py @@ -0,0 +1,66 @@ +# 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 .resource_py3 import Resource + + +class Agreement(Resource): + """An agreement resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar agreement_link: The link to the agreement. + :vartype agreement_link: str + :ivar effective_date: Effective date. + :vartype effective_date: datetime + :ivar expiration_date: Expiration date. + :vartype expiration_date: datetime + :param participants: Participants or signer of the agreement. + :type participants: list[~azure.mgmt.billing.models.Participants] + :ivar status: The agreement status + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'agreement_link': {'readonly': True}, + 'effective_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'agreement_link': {'key': 'properties.agreementLink', 'type': 'str'}, + 'effective_date': {'key': 'properties.effectiveDate', 'type': 'iso-8601'}, + 'expiration_date': {'key': 'properties.expirationDate', 'type': 'iso-8601'}, + 'participants': {'key': 'properties.participants', 'type': '[Participants]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__(self, *, participants=None, **kwargs) -> None: + super(Agreement, self).__init__(**kwargs) + self.agreement_link = None + self.effective_date = None + self.expiration_date = None + self.participants = participants + self.status = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/participants.py b/azure-mgmt-billing/azure/mgmt/billing/models/participants.py new file mode 100644 index 000000000000..8377492ad1d6 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/participants.py @@ -0,0 +1,45 @@ +# 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 Participants(Model): + """Details about the participant or signer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The signing status + :vartype status: str + :ivar status_date: The date when status got changed. + :vartype status_date: datetime + :ivar email: The email address of the participant or signer. + :vartype email: str + """ + + _validation = { + 'status': {'readonly': True}, + 'status_date': {'readonly': True}, + 'email': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'status_date': {'key': 'statusDate', 'type': 'iso-8601'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Participants, self).__init__(**kwargs) + self.status = None + self.status_date = None + self.email = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/models/participants_py3.py b/azure-mgmt-billing/azure/mgmt/billing/models/participants_py3.py new file mode 100644 index 000000000000..53a2573b44c6 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/models/participants_py3.py @@ -0,0 +1,45 @@ +# 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 Participants(Model): + """Details about the participant or signer. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The signing status + :vartype status: str + :ivar status_date: The date when status got changed. + :vartype status_date: datetime + :ivar email: The email address of the participant or signer. + :vartype email: str + """ + + _validation = { + 'status': {'readonly': True}, + 'status_date': {'readonly': True}, + 'email': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'status_date': {'key': 'statusDate', 'type': 'iso-8601'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Participants, self).__init__(**kwargs) + self.status = None + self.status_date = None + self.email = None diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py index 7745128644cc..8955c7e83662 100644 --- a/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -50,6 +50,7 @@ from .billing_account_billing_role_assignment_operations import BillingAccountBillingRoleAssignmentOperations from .invoice_section_billing_role_assignment_operations import InvoiceSectionBillingRoleAssignmentOperations from .billing_profile_billing_role_assignment_operations import BillingProfileBillingRoleAssignmentOperations +from .agreements_operations import AgreementsOperations __all__ = [ 'BillingAccountsOperations', @@ -93,4 +94,5 @@ 'BillingAccountBillingRoleAssignmentOperations', 'InvoiceSectionBillingRoleAssignmentOperations', 'BillingProfileBillingRoleAssignmentOperations', + 'AgreementsOperations', ] diff --git a/azure-mgmt-billing/azure/mgmt/billing/operations/agreements_operations.py b/azure-mgmt-billing/azure/mgmt/billing/operations/agreements_operations.py new file mode 100644 index 000000000000..edab2766fb75 --- /dev/null +++ b/azure-mgmt-billing/azure/mgmt/billing/operations/agreements_operations.py @@ -0,0 +1,162 @@ +# 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 AgreementsOperations(object): + """AgreementsOperations 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 list_by_billing_account_name( + self, billing_account_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Lists all agreements for a billing account. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param expand: May be used to expand the participants. + :type expand: str + :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`. + :return: AgreementListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.AgreementListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_billing_account_name.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') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + 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: + 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 and send request + 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) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AgreementListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_billing_account_name.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements'} + + def get( + self, billing_account_name, agreement_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Get the agreement by name. + + :param billing_account_name: billing Account Id. + :type billing_account_name: str + :param agreement_name: Agreement Id. + :type agreement_name: str + :param expand: May be used to expand the participants. + :type expand: str + :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`. + :return: Agreement or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.billing.models.Agreement or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), + 'agreementName': self._serialize.url("agreement_name", agreement_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') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + 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: + 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 and send request + 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) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Agreement', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}'}