From f3df994aaf3d8bf7d0046a642e16c582101274f9 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 1 Sep 2020 07:18:31 +0000 Subject: [PATCH] Generated from 9b73a1788fb607a0c10c37960acb506aed2d59e7 multiapi for commerce --- sdk/commerce/azure-mgmt-commerce/README.md | 30 +- .../azure/mgmt/commerce/__init__.py | 7 +- .../azure/mgmt/commerce/_configuration.py | 50 +++ ..._client.py => _usage_management_client.py} | 48 +- .../azure/mgmt/commerce/models/__init__.py | 48 +- .../azure/mgmt/commerce/models/_models.py | 425 ++++++++++++++++++ .../azure/mgmt/commerce/models/_models_py3.py | 425 ++++++++++++++++++ ..._aggregation_paged.py => _paged_models.py} | 0 ...s.py => _usage_management_client_enums.py} | 2 +- .../mgmt/commerce/models/error_response.py | 45 -- .../azure/mgmt/commerce/models/info_field.py | 29 -- .../azure/mgmt/commerce/models/meter_info.py | 72 --- .../commerce/models/monetary_commitment.py | 48 -- .../mgmt/commerce/models/monetary_credit.py | 46 -- .../mgmt/commerce/models/offer_term_info.py | 44 -- .../models/rate_card_query_parameters.py | 53 --- .../mgmt/commerce/models/recurring_charge.py | 41 -- .../models/resource_rate_card_info.py | 45 -- .../mgmt/commerce/models/usage_aggregation.py | 90 ---- .../mgmt/commerce/operations/__init__.py | 4 +- ...operations.py => _rate_card_operations.py} | 9 +- ...ons.py => _usage_aggregates_operations.py} | 23 +- sdk/commerce/azure-mgmt-commerce/setup.py | 6 +- 23 files changed, 977 insertions(+), 613 deletions(-) create mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/_configuration.py rename sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/{usage_management_client.py => _usage_management_client.py} (54%) create mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models.py create mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models_py3.py rename sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/{usage_aggregation_paged.py => _paged_models.py} (100%) rename sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/{usage_management_client_enums.py => _usage_management_client_enums.py} (92%) delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/error_response.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/info_field.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/meter_info.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_commitment.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_credit.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/offer_term_info.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/rate_card_query_parameters.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/recurring_charge.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/resource_rate_card_info.py delete mode 100644 sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_aggregation.py rename sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/{rate_card_operations.py => _rate_card_operations.py} (92%) rename sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/{usage_aggregates_operations.py => _usage_aggregates_operations.py} (90%) diff --git a/sdk/commerce/azure-mgmt-commerce/README.md b/sdk/commerce/azure-mgmt-commerce/README.md index df5163404716..ef0b4f7ba7e9 100644 --- a/sdk/commerce/azure-mgmt-commerce/README.md +++ b/sdk/commerce/azure-mgmt-commerce/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure Commerce Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). -Azure Resource Manager (ARM) is the next generation of management APIs -that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. +# Usage -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. - -For a more complete set of Azure libraries, see the -[azure sdk python release](https://aka.ms/azsdk/python/all). - -## Usage - -For code examples, see -[Commerce](https://docs.microsoft.com/python/api/overview/azure/commerce) +For code examples, see [Commerce](https://docs.microsoft.com/python/api/overview/azure/commerce) on docs.microsoft.com. -## Provide Feedback -If you encounter any bugs or have suggestions, please file an issue in -the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-commerce%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-commerce%2FREADME.png) diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/__init__.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/__init__.py index 36419467796a..e23f02a932db 100644 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/__init__.py +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .usage_management_client import UsageManagementClient -from .version import VERSION +from ._configuration import UsageManagementClientConfiguration +from ._usage_management_client import UsageManagementClient +__all__ = ['UsageManagementClient', 'UsageManagementClientConfiguration'] -__all__ = ['UsageManagementClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/_configuration.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/_configuration.py new file mode 100644 index 000000000000..2b807288c003 --- /dev/null +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/_configuration.py @@ -0,0 +1,50 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class UsageManagementClientConfiguration(AzureConfiguration): + """Configuration for UsageManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: It uniquely identifies Microsoft Azure + subscription. The subscription ID forms part of the URI for every service + call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(UsageManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-commerce/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/usage_management_client.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/_usage_management_client.py similarity index 54% rename from sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/usage_management_client.py rename to sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/_usage_management_client.py index a117c423de7a..57da90190915 100644 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/usage_management_client.py +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/_usage_management_client.py @@ -9,50 +9,16 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import ServiceClient +from msrest.service_client import SDKClient from msrest import Serializer, Deserializer -from msrestazure import AzureConfiguration -from .version import VERSION -from .operations.usage_aggregates_operations import UsageAggregatesOperations -from .operations.rate_card_operations import RateCardOperations -from . import models - - -class UsageManagementClientConfiguration(AzureConfiguration): - """Configuration for UsageManagementClient - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: It uniquely identifies Microsoft Azure - subscription. The subscription ID forms part of the URI for every service - call. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(UsageManagementClientConfiguration, self).__init__(base_url) - self.add_user_agent('azure-mgmt-commerce/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials - self.subscription_id = subscription_id +from ._configuration import UsageManagementClientConfiguration +from .operations import UsageAggregatesOperations +from .operations import RateCardOperations +from . import models -class UsageManagementClient(object): +class UsageManagementClient(SDKClient): """UsageManagementClient :ivar config: Configuration for client. @@ -77,7 +43,7 @@ def __init__( self, credentials, subscription_id, base_url=None): self.config = UsageManagementClientConfiguration(credentials, subscription_id, base_url) - self._client = ServiceClient(self.config.credentials, self.config) + super(UsageManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self.api_version = '2015-06-01-preview' diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/__init__.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/__init__.py index 8d9f381d77d1..d199f1227ab7 100644 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/__init__.py +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/__init__.py @@ -9,32 +9,44 @@ # regenerated. # -------------------------------------------------------------------------- -from .info_field import InfoField -from .usage_aggregation import UsageAggregation -from .rate_card_query_parameters import RateCardQueryParameters -from .offer_term_info import OfferTermInfo -from .meter_info import MeterInfo -from .resource_rate_card_info import ResourceRateCardInfo -from .monetary_credit import MonetaryCredit -from .monetary_commitment import MonetaryCommitment -from .recurring_charge import RecurringCharge -from .error_response import ErrorResponse, ErrorResponseException -from .usage_aggregation_paged import UsageAggregationPaged -from .usage_management_client_enums import ( +try: + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import InfoField + from ._models_py3 import MeterInfo + from ._models_py3 import MonetaryCommitment + from ._models_py3 import MonetaryCredit + from ._models_py3 import OfferTermInfo + from ._models_py3 import RateCardQueryParameters + from ._models_py3 import RecurringCharge + from ._models_py3 import ResourceRateCardInfo + from ._models_py3 import UsageAggregation +except (SyntaxError, ImportError): + from ._models import ErrorResponse, ErrorResponseException + from ._models import InfoField + from ._models import MeterInfo + from ._models import MonetaryCommitment + from ._models import MonetaryCredit + from ._models import OfferTermInfo + from ._models import RateCardQueryParameters + from ._models import RecurringCharge + from ._models import ResourceRateCardInfo + from ._models import UsageAggregation +from ._paged_models import UsageAggregationPaged +from ._usage_management_client_enums import ( AggregationGranularity, ) __all__ = [ + 'ErrorResponse', 'ErrorResponseException', 'InfoField', - 'UsageAggregation', - 'RateCardQueryParameters', - 'OfferTermInfo', 'MeterInfo', - 'ResourceRateCardInfo', - 'MonetaryCredit', 'MonetaryCommitment', + 'MonetaryCredit', + 'OfferTermInfo', + 'RateCardQueryParameters', 'RecurringCharge', - 'ErrorResponse', 'ErrorResponseException', + 'ResourceRateCardInfo', + 'UsageAggregation', 'UsageAggregationPaged', 'AggregationGranularity', ] diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models.py new file mode 100644 index 000000000000..a6055850936d --- /dev/null +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models.py @@ -0,0 +1,425 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class InfoField(Model): + """Key-value pairs of instance details in the legacy format. + + :param project: Identifies the name of the instance provisioned by the + user. + :type project: str + """ + + _attribute_map = { + 'project': {'key': 'project', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InfoField, self).__init__(**kwargs) + self.project = kwargs.get('project', None) + + +class MeterInfo(Model): + """Detailed information about the meter. + + :param meter_id: The unique identifier of the resource. + :type meter_id: str + :param meter_name: The name of the meter, within the given meter category + :type meter_name: str + :param meter_category: The category of the meter, e.g., 'Cloud services', + 'Networking', etc.. + :type meter_category: str + :param meter_sub_category: The subcategory of the meter, e.g., 'A6 Cloud + services', 'ExpressRoute (IXP)', etc.. + :type meter_sub_category: str + :param unit: The unit in which the meter consumption is charged, e.g., + 'Hours', 'GB', etc. + :type unit: str + :param meter_tags: Provides additional meter data. 'Third Party' indicates + a meter with no discount. Blanks indicate First Party. + :type meter_tags: list[str] + :param meter_region: The region in which the Azure service is available. + :type meter_region: str + :param meter_rates: The list of key/value pairs for the meter rates, in + the format 'key':'value' where key = the meter quantity, and value = the + corresponding price + :type meter_rates: dict[str, float] + :param effective_date: Indicates the date from which the meter rate is + effective. + :type effective_date: datetime + :param included_quantity: The resource quantity that is included in the + offer at no cost. Consumption beyond this quantity will be charged. + :type included_quantity: float + """ + + _attribute_map = { + 'meter_id': {'key': 'MeterId', 'type': 'str'}, + 'meter_name': {'key': 'MeterName', 'type': 'str'}, + 'meter_category': {'key': 'MeterCategory', 'type': 'str'}, + 'meter_sub_category': {'key': 'MeterSubCategory', 'type': 'str'}, + 'unit': {'key': 'Unit', 'type': 'str'}, + 'meter_tags': {'key': 'MeterTags', 'type': '[str]'}, + 'meter_region': {'key': 'MeterRegion', 'type': 'str'}, + 'meter_rates': {'key': 'MeterRates', 'type': '{float}'}, + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'included_quantity': {'key': 'IncludedQuantity', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(MeterInfo, self).__init__(**kwargs) + self.meter_id = kwargs.get('meter_id', None) + self.meter_name = kwargs.get('meter_name', None) + self.meter_category = kwargs.get('meter_category', None) + self.meter_sub_category = kwargs.get('meter_sub_category', None) + self.unit = kwargs.get('unit', None) + self.meter_tags = kwargs.get('meter_tags', None) + self.meter_region = kwargs.get('meter_region', None) + self.meter_rates = kwargs.get('meter_rates', None) + self.effective_date = kwargs.get('effective_date', None) + self.included_quantity = kwargs.get('included_quantity', None) + + +class OfferTermInfo(Model): + """Describes the offer term. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MonetaryCredit, MonetaryCommitment, RecurringCharge + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + } + + _subtype_map = { + 'name': {'Monetary Credit': 'MonetaryCredit', 'Monetary Commitment': 'MonetaryCommitment', 'Recurring Charge': 'RecurringCharge'} + } + + def __init__(self, **kwargs): + super(OfferTermInfo, self).__init__(**kwargs) + self.effective_date = kwargs.get('effective_date', None) + self.name = None + + +class MonetaryCommitment(OfferTermInfo): + """Indicates that a monetary commitment is required for this offer. + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + :param tiered_discount: The list of key/value pairs for the tiered meter + rates, in the format 'key':'value' where key = price, and value = the + corresponding discount percentage. This field is used only by offer terms + of type 'Monetary Commitment'. + :type tiered_discount: dict[str, decimal.Decimal] + :param excluded_meter_ids: An array of meter ids that are excluded from + the given offer terms. + :type excluded_meter_ids: list[str] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + 'tiered_discount': {'key': 'TieredDiscount', 'type': '{decimal}'}, + 'excluded_meter_ids': {'key': 'ExcludedMeterIds', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MonetaryCommitment, self).__init__(**kwargs) + self.tiered_discount = kwargs.get('tiered_discount', None) + self.excluded_meter_ids = kwargs.get('excluded_meter_ids', None) + self.name = 'Monetary Commitment' + + +class MonetaryCredit(OfferTermInfo): + """Indicates that this is a monetary credit offer. + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + :param credit: The amount of credit provided under the terms of the given + offer level. + :type credit: decimal.Decimal + :param excluded_meter_ids: An array of meter ids that are excluded from + the given offer terms. + :type excluded_meter_ids: list[str] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + 'credit': {'key': 'Credit', 'type': 'decimal'}, + 'excluded_meter_ids': {'key': 'ExcludedMeterIds', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MonetaryCredit, self).__init__(**kwargs) + self.credit = kwargs.get('credit', None) + self.excluded_meter_ids = kwargs.get('excluded_meter_ids', None) + self.name = 'Monetary Credit' + + +class RateCardQueryParameters(Model): + """Parameters that are used in the odata $filter query parameter for providing + RateCard information. + + All required parameters must be populated in order to send to Azure. + + :param offer_durable_id: Required. The Offer ID parameter consists of the + 'MS-AZR-' prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See + https://azure.microsoft.com/en-us/support/legal/offer-details/ for more + information on the list of available Offer IDs, country/region + availability, and billing currency. + :type offer_durable_id: str + :param currency: Required. The currency in which the rates need to be + provided. + :type currency: str + :param locale: Required. The culture in which the resource metadata needs + to be localized. + :type locale: str + :param region_info: Required. 2 letter ISO code where the offer was + purchased. + :type region_info: str + """ + + _validation = { + 'offer_durable_id': {'required': True, 'pattern': r'^MS-AZR-\d{4}P(-\d{4}P)*$'}, + 'currency': {'required': True}, + 'locale': {'required': True}, + 'region_info': {'required': True}, + } + + _attribute_map = { + 'offer_durable_id': {'key': 'OfferDurableId', 'type': 'str'}, + 'currency': {'key': 'Currency', 'type': 'str'}, + 'locale': {'key': 'Locale', 'type': 'str'}, + 'region_info': {'key': 'RegionInfo', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RateCardQueryParameters, self).__init__(**kwargs) + self.offer_durable_id = kwargs.get('offer_durable_id', None) + self.currency = kwargs.get('currency', None) + self.locale = kwargs.get('locale', None) + self.region_info = kwargs.get('region_info', None) + + +class RecurringCharge(OfferTermInfo): + """Indicates a recurring charge is present for this offer. + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + :param recurring_charge: The amount of recurring charge as per the offer + term. + :type recurring_charge: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + 'recurring_charge': {'key': 'RecurringCharge', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RecurringCharge, self).__init__(**kwargs) + self.recurring_charge = kwargs.get('recurring_charge', None) + self.name = 'Recurring Charge' + + +class ResourceRateCardInfo(Model): + """Price and Metadata information for resources. + + :param currency: The currency in which the rates are provided. + :type currency: str + :param locale: The culture in which the resource information is localized. + :type locale: str + :param is_tax_included: All rates are pretax, so this will always be + returned as 'false'. + :type is_tax_included: bool + :param offer_terms: A list of offer terms. + :type offer_terms: list[~azure.mgmt.commerce.models.OfferTermInfo] + :param meters: A list of meters. + :type meters: list[~azure.mgmt.commerce.models.MeterInfo] + """ + + _attribute_map = { + 'currency': {'key': 'Currency', 'type': 'str'}, + 'locale': {'key': 'Locale', 'type': 'str'}, + 'is_tax_included': {'key': 'IsTaxIncluded', 'type': 'bool'}, + 'offer_terms': {'key': 'OfferTerms', 'type': '[OfferTermInfo]'}, + 'meters': {'key': 'Meters', 'type': '[MeterInfo]'}, + } + + def __init__(self, **kwargs): + super(ResourceRateCardInfo, self).__init__(**kwargs) + self.currency = kwargs.get('currency', None) + self.locale = kwargs.get('locale', None) + self.is_tax_included = kwargs.get('is_tax_included', None) + self.offer_terms = kwargs.get('offer_terms', None) + self.meters = kwargs.get('meters', None) + + +class UsageAggregation(Model): + """Describes the usageAggregation. + + :param id: Unique Id for the usage aggregate. + :type id: str + :param name: Name of the usage aggregate. + :type name: str + :param type: Type of the resource being returned. + :type type: str + :param subscription_id: The subscription identifier for the Azure user. + :type subscription_id: str + :param meter_id: Unique ID for the resource that was consumed (aka + ResourceID). + :type meter_id: str + :param usage_start_time: UTC start time for the usage bucket to which this + usage aggregate belongs. + :type usage_start_time: datetime + :param usage_end_time: UTC end time for the usage bucket to which this + usage aggregate belongs. + :type usage_end_time: datetime + :param quantity: The amount of the resource consumption that occurred in + this time frame. + :type quantity: float + :param unit: The unit in which the usage for this resource is being + counted, e.g. Hours, GB. + :type unit: str + :param meter_name: Friendly name of the resource being consumed. + :type meter_name: str + :param meter_category: Category of the consumed resource. + :type meter_category: str + :param meter_sub_category: Sub-category of the consumed resource. + :type meter_sub_category: str + :param meter_region: Region of the meterId used for billing purposes + :type meter_region: str + :param info_fields: Key-value pairs of instance details (legacy format). + :type info_fields: ~azure.mgmt.commerce.models.InfoField + :param instance_data: Key-value pairs of instance details represented as a + string. + :type instance_data: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'meter_id': {'key': 'properties.meterId', 'type': 'str'}, + 'usage_start_time': {'key': 'properties.usageStartTime', 'type': 'iso-8601'}, + 'usage_end_time': {'key': 'properties.usageEndTime', 'type': 'iso-8601'}, + 'quantity': {'key': 'properties.quantity', 'type': 'float'}, + 'unit': {'key': 'properties.unit', 'type': 'str'}, + 'meter_name': {'key': 'properties.meterName', 'type': 'str'}, + 'meter_category': {'key': 'properties.meterCategory', 'type': 'str'}, + 'meter_sub_category': {'key': 'properties.meterSubCategory', 'type': 'str'}, + 'meter_region': {'key': 'properties.meterRegion', 'type': 'str'}, + 'info_fields': {'key': 'properties.infoFields', 'type': 'InfoField'}, + 'instance_data': {'key': 'properties.instanceData', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UsageAggregation, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.subscription_id = kwargs.get('subscription_id', None) + self.meter_id = kwargs.get('meter_id', None) + self.usage_start_time = kwargs.get('usage_start_time', None) + self.usage_end_time = kwargs.get('usage_end_time', None) + self.quantity = kwargs.get('quantity', None) + self.unit = kwargs.get('unit', None) + self.meter_name = kwargs.get('meter_name', None) + self.meter_category = kwargs.get('meter_category', None) + self.meter_sub_category = kwargs.get('meter_sub_category', None) + self.meter_region = kwargs.get('meter_region', None) + self.info_fields = kwargs.get('info_fields', None) + self.instance_data = kwargs.get('instance_data', None) diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models_py3.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models_py3.py new file mode 100644 index 000000000000..b7aeba57c033 --- /dev/null +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_models_py3.py @@ -0,0 +1,425 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class InfoField(Model): + """Key-value pairs of instance details in the legacy format. + + :param project: Identifies the name of the instance provisioned by the + user. + :type project: str + """ + + _attribute_map = { + 'project': {'key': 'project', 'type': 'str'}, + } + + def __init__(self, *, project: str=None, **kwargs) -> None: + super(InfoField, self).__init__(**kwargs) + self.project = project + + +class MeterInfo(Model): + """Detailed information about the meter. + + :param meter_id: The unique identifier of the resource. + :type meter_id: str + :param meter_name: The name of the meter, within the given meter category + :type meter_name: str + :param meter_category: The category of the meter, e.g., 'Cloud services', + 'Networking', etc.. + :type meter_category: str + :param meter_sub_category: The subcategory of the meter, e.g., 'A6 Cloud + services', 'ExpressRoute (IXP)', etc.. + :type meter_sub_category: str + :param unit: The unit in which the meter consumption is charged, e.g., + 'Hours', 'GB', etc. + :type unit: str + :param meter_tags: Provides additional meter data. 'Third Party' indicates + a meter with no discount. Blanks indicate First Party. + :type meter_tags: list[str] + :param meter_region: The region in which the Azure service is available. + :type meter_region: str + :param meter_rates: The list of key/value pairs for the meter rates, in + the format 'key':'value' where key = the meter quantity, and value = the + corresponding price + :type meter_rates: dict[str, float] + :param effective_date: Indicates the date from which the meter rate is + effective. + :type effective_date: datetime + :param included_quantity: The resource quantity that is included in the + offer at no cost. Consumption beyond this quantity will be charged. + :type included_quantity: float + """ + + _attribute_map = { + 'meter_id': {'key': 'MeterId', 'type': 'str'}, + 'meter_name': {'key': 'MeterName', 'type': 'str'}, + 'meter_category': {'key': 'MeterCategory', 'type': 'str'}, + 'meter_sub_category': {'key': 'MeterSubCategory', 'type': 'str'}, + 'unit': {'key': 'Unit', 'type': 'str'}, + 'meter_tags': {'key': 'MeterTags', 'type': '[str]'}, + 'meter_region': {'key': 'MeterRegion', 'type': 'str'}, + 'meter_rates': {'key': 'MeterRates', 'type': '{float}'}, + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'included_quantity': {'key': 'IncludedQuantity', 'type': 'float'}, + } + + def __init__(self, *, meter_id: str=None, meter_name: str=None, meter_category: str=None, meter_sub_category: str=None, unit: str=None, meter_tags=None, meter_region: str=None, meter_rates=None, effective_date=None, included_quantity: float=None, **kwargs) -> None: + super(MeterInfo, self).__init__(**kwargs) + self.meter_id = meter_id + self.meter_name = meter_name + self.meter_category = meter_category + self.meter_sub_category = meter_sub_category + self.unit = unit + self.meter_tags = meter_tags + self.meter_region = meter_region + self.meter_rates = meter_rates + self.effective_date = effective_date + self.included_quantity = included_quantity + + +class OfferTermInfo(Model): + """Describes the offer term. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MonetaryCredit, MonetaryCommitment, RecurringCharge + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + } + + _subtype_map = { + 'name': {'Monetary Credit': 'MonetaryCredit', 'Monetary Commitment': 'MonetaryCommitment', 'Recurring Charge': 'RecurringCharge'} + } + + def __init__(self, *, effective_date=None, **kwargs) -> None: + super(OfferTermInfo, self).__init__(**kwargs) + self.effective_date = effective_date + self.name = None + + +class MonetaryCommitment(OfferTermInfo): + """Indicates that a monetary commitment is required for this offer. + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + :param tiered_discount: The list of key/value pairs for the tiered meter + rates, in the format 'key':'value' where key = price, and value = the + corresponding discount percentage. This field is used only by offer terms + of type 'Monetary Commitment'. + :type tiered_discount: dict[str, decimal.Decimal] + :param excluded_meter_ids: An array of meter ids that are excluded from + the given offer terms. + :type excluded_meter_ids: list[str] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + 'tiered_discount': {'key': 'TieredDiscount', 'type': '{decimal}'}, + 'excluded_meter_ids': {'key': 'ExcludedMeterIds', 'type': '[str]'}, + } + + def __init__(self, *, effective_date=None, tiered_discount=None, excluded_meter_ids=None, **kwargs) -> None: + super(MonetaryCommitment, self).__init__(effective_date=effective_date, **kwargs) + self.tiered_discount = tiered_discount + self.excluded_meter_ids = excluded_meter_ids + self.name = 'Monetary Commitment' + + +class MonetaryCredit(OfferTermInfo): + """Indicates that this is a monetary credit offer. + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + :param credit: The amount of credit provided under the terms of the given + offer level. + :type credit: decimal.Decimal + :param excluded_meter_ids: An array of meter ids that are excluded from + the given offer terms. + :type excluded_meter_ids: list[str] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + 'credit': {'key': 'Credit', 'type': 'decimal'}, + 'excluded_meter_ids': {'key': 'ExcludedMeterIds', 'type': '[str]'}, + } + + def __init__(self, *, effective_date=None, credit=None, excluded_meter_ids=None, **kwargs) -> None: + super(MonetaryCredit, self).__init__(effective_date=effective_date, **kwargs) + self.credit = credit + self.excluded_meter_ids = excluded_meter_ids + self.name = 'Monetary Credit' + + +class RateCardQueryParameters(Model): + """Parameters that are used in the odata $filter query parameter for providing + RateCard information. + + All required parameters must be populated in order to send to Azure. + + :param offer_durable_id: Required. The Offer ID parameter consists of the + 'MS-AZR-' prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See + https://azure.microsoft.com/en-us/support/legal/offer-details/ for more + information on the list of available Offer IDs, country/region + availability, and billing currency. + :type offer_durable_id: str + :param currency: Required. The currency in which the rates need to be + provided. + :type currency: str + :param locale: Required. The culture in which the resource metadata needs + to be localized. + :type locale: str + :param region_info: Required. 2 letter ISO code where the offer was + purchased. + :type region_info: str + """ + + _validation = { + 'offer_durable_id': {'required': True, 'pattern': r'^MS-AZR-\d{4}P(-\d{4}P)*$'}, + 'currency': {'required': True}, + 'locale': {'required': True}, + 'region_info': {'required': True}, + } + + _attribute_map = { + 'offer_durable_id': {'key': 'OfferDurableId', 'type': 'str'}, + 'currency': {'key': 'Currency', 'type': 'str'}, + 'locale': {'key': 'Locale', 'type': 'str'}, + 'region_info': {'key': 'RegionInfo', 'type': 'str'}, + } + + def __init__(self, *, offer_durable_id: str, currency: str, locale: str, region_info: str, **kwargs) -> None: + super(RateCardQueryParameters, self).__init__(**kwargs) + self.offer_durable_id = offer_durable_id + self.currency = currency + self.locale = locale + self.region_info = region_info + + +class RecurringCharge(OfferTermInfo): + """Indicates a recurring charge is present for this offer. + + All required parameters must be populated in order to send to Azure. + + :param effective_date: Indicates the date from which the offer term is + effective. + :type effective_date: datetime + :param name: Required. Constant filled by server. + :type name: str + :param recurring_charge: The amount of recurring charge as per the offer + term. + :type recurring_charge: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, + 'name': {'key': 'Name', 'type': 'str'}, + 'recurring_charge': {'key': 'RecurringCharge', 'type': 'int'}, + } + + def __init__(self, *, effective_date=None, recurring_charge: int=None, **kwargs) -> None: + super(RecurringCharge, self).__init__(effective_date=effective_date, **kwargs) + self.recurring_charge = recurring_charge + self.name = 'Recurring Charge' + + +class ResourceRateCardInfo(Model): + """Price and Metadata information for resources. + + :param currency: The currency in which the rates are provided. + :type currency: str + :param locale: The culture in which the resource information is localized. + :type locale: str + :param is_tax_included: All rates are pretax, so this will always be + returned as 'false'. + :type is_tax_included: bool + :param offer_terms: A list of offer terms. + :type offer_terms: list[~azure.mgmt.commerce.models.OfferTermInfo] + :param meters: A list of meters. + :type meters: list[~azure.mgmt.commerce.models.MeterInfo] + """ + + _attribute_map = { + 'currency': {'key': 'Currency', 'type': 'str'}, + 'locale': {'key': 'Locale', 'type': 'str'}, + 'is_tax_included': {'key': 'IsTaxIncluded', 'type': 'bool'}, + 'offer_terms': {'key': 'OfferTerms', 'type': '[OfferTermInfo]'}, + 'meters': {'key': 'Meters', 'type': '[MeterInfo]'}, + } + + def __init__(self, *, currency: str=None, locale: str=None, is_tax_included: bool=None, offer_terms=None, meters=None, **kwargs) -> None: + super(ResourceRateCardInfo, self).__init__(**kwargs) + self.currency = currency + self.locale = locale + self.is_tax_included = is_tax_included + self.offer_terms = offer_terms + self.meters = meters + + +class UsageAggregation(Model): + """Describes the usageAggregation. + + :param id: Unique Id for the usage aggregate. + :type id: str + :param name: Name of the usage aggregate. + :type name: str + :param type: Type of the resource being returned. + :type type: str + :param subscription_id: The subscription identifier for the Azure user. + :type subscription_id: str + :param meter_id: Unique ID for the resource that was consumed (aka + ResourceID). + :type meter_id: str + :param usage_start_time: UTC start time for the usage bucket to which this + usage aggregate belongs. + :type usage_start_time: datetime + :param usage_end_time: UTC end time for the usage bucket to which this + usage aggregate belongs. + :type usage_end_time: datetime + :param quantity: The amount of the resource consumption that occurred in + this time frame. + :type quantity: float + :param unit: The unit in which the usage for this resource is being + counted, e.g. Hours, GB. + :type unit: str + :param meter_name: Friendly name of the resource being consumed. + :type meter_name: str + :param meter_category: Category of the consumed resource. + :type meter_category: str + :param meter_sub_category: Sub-category of the consumed resource. + :type meter_sub_category: str + :param meter_region: Region of the meterId used for billing purposes + :type meter_region: str + :param info_fields: Key-value pairs of instance details (legacy format). + :type info_fields: ~azure.mgmt.commerce.models.InfoField + :param instance_data: Key-value pairs of instance details represented as a + string. + :type instance_data: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'meter_id': {'key': 'properties.meterId', 'type': 'str'}, + 'usage_start_time': {'key': 'properties.usageStartTime', 'type': 'iso-8601'}, + 'usage_end_time': {'key': 'properties.usageEndTime', 'type': 'iso-8601'}, + 'quantity': {'key': 'properties.quantity', 'type': 'float'}, + 'unit': {'key': 'properties.unit', 'type': 'str'}, + 'meter_name': {'key': 'properties.meterName', 'type': 'str'}, + 'meter_category': {'key': 'properties.meterCategory', 'type': 'str'}, + 'meter_sub_category': {'key': 'properties.meterSubCategory', 'type': 'str'}, + 'meter_region': {'key': 'properties.meterRegion', 'type': 'str'}, + 'info_fields': {'key': 'properties.infoFields', 'type': 'InfoField'}, + 'instance_data': {'key': 'properties.instanceData', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, name: str=None, type: str=None, subscription_id: str=None, meter_id: str=None, usage_start_time=None, usage_end_time=None, quantity: float=None, unit: str=None, meter_name: str=None, meter_category: str=None, meter_sub_category: str=None, meter_region: str=None, info_fields=None, instance_data: str=None, **kwargs) -> None: + super(UsageAggregation, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.subscription_id = subscription_id + self.meter_id = meter_id + self.usage_start_time = usage_start_time + self.usage_end_time = usage_end_time + self.quantity = quantity + self.unit = unit + self.meter_name = meter_name + self.meter_category = meter_category + self.meter_sub_category = meter_sub_category + self.meter_region = meter_region + self.info_fields = info_fields + self.instance_data = instance_data diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_aggregation_paged.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_paged_models.py similarity index 100% rename from sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_aggregation_paged.py rename to sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_paged_models.py diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_management_client_enums.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_usage_management_client_enums.py similarity index 92% rename from sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_management_client_enums.py rename to sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_usage_management_client_enums.py index 201ee1411134..22f193d44bf8 100644 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_management_client_enums.py +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/_usage_management_client_enums.py @@ -12,7 +12,7 @@ from enum import Enum -class AggregationGranularity(Enum): +class AggregationGranularity(str, Enum): daily = "Daily" hourly = "Hourly" diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/error_response.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/error_response.py deleted file mode 100644 index 1a399569811b..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/error_response.py +++ /dev/null @@ -1,45 +0,0 @@ -# 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 -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Model): - """Describes the format of Error response. - - :param code: Error code - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__(self, code=None, message=None): - super(ErrorResponse, self).__init__() - self.code = code - self.message = message - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/info_field.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/info_field.py deleted file mode 100644 index b398d24322c6..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/info_field.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 InfoField(Model): - """Key-value pairs of instance details in the legacy format. - - :param project: Identifies the name of the instance provisioned by the - user. - :type project: str - """ - - _attribute_map = { - 'project': {'key': 'project', 'type': 'str'}, - } - - def __init__(self, project=None): - super(InfoField, self).__init__() - self.project = project diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/meter_info.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/meter_info.py deleted file mode 100644 index c2f760ba3de7..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/meter_info.py +++ /dev/null @@ -1,72 +0,0 @@ -# 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 MeterInfo(Model): - """Detailed information about the meter. - - :param meter_id: The unique identifier of the resource. - :type meter_id: str - :param meter_name: The name of the meter, within the given meter category - :type meter_name: str - :param meter_category: The category of the meter, e.g., 'Cloud services', - 'Networking', etc.. - :type meter_category: str - :param meter_sub_category: The subcategory of the meter, e.g., 'A6 Cloud - services', 'ExpressRoute (IXP)', etc.. - :type meter_sub_category: str - :param unit: The unit in which the meter consumption is charged, e.g., - 'Hours', 'GB', etc. - :type unit: str - :param meter_tags: Provides additional meter data. 'Third Party' indicates - a meter with no discount. Blanks indicate First Party. - :type meter_tags: list[str] - :param meter_region: The region in which the Azure service is available. - :type meter_region: str - :param meter_rates: The list of key/value pairs for the meter rates, in - the format 'key':'value' where key = the meter quantity, and value = the - corresponding price - :type meter_rates: dict[str, float] - :param effective_date: Indicates the date from which the meter rate is - effective. - :type effective_date: datetime - :param included_quantity: The resource quantity that is included in the - offer at no cost. Consumption beyond this quantity will be charged. - :type included_quantity: float - """ - - _attribute_map = { - 'meter_id': {'key': 'MeterId', 'type': 'str'}, - 'meter_name': {'key': 'MeterName', 'type': 'str'}, - 'meter_category': {'key': 'MeterCategory', 'type': 'str'}, - 'meter_sub_category': {'key': 'MeterSubCategory', 'type': 'str'}, - 'unit': {'key': 'Unit', 'type': 'str'}, - 'meter_tags': {'key': 'MeterTags', 'type': '[str]'}, - 'meter_region': {'key': 'MeterRegion', 'type': 'str'}, - 'meter_rates': {'key': 'MeterRates', 'type': '{float}'}, - 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, - 'included_quantity': {'key': 'IncludedQuantity', 'type': 'float'}, - } - - def __init__(self, meter_id=None, meter_name=None, meter_category=None, meter_sub_category=None, unit=None, meter_tags=None, meter_region=None, meter_rates=None, effective_date=None, included_quantity=None): - super(MeterInfo, self).__init__() - self.meter_id = meter_id - self.meter_name = meter_name - self.meter_category = meter_category - self.meter_sub_category = meter_sub_category - self.unit = unit - self.meter_tags = meter_tags - self.meter_region = meter_region - self.meter_rates = meter_rates - self.effective_date = effective_date - self.included_quantity = included_quantity diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_commitment.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_commitment.py deleted file mode 100644 index c844b4a0775b..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_commitment.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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 .offer_term_info import OfferTermInfo - - -class MonetaryCommitment(OfferTermInfo): - """Indicates that a monetary commitment is required for this offer. - - :param effective_date: Indicates the date from which the offer term is - effective. - :type effective_date: datetime - :param name: Constant filled by server. - :type name: str - :param tiered_discount: The list of key/value pairs for the tiered meter - rates, in the format 'key':'value' where key = price, and value = the - corresponding discount percentage. This field is used only by offer terms - of type 'Monetary Commitment'. - :type tiered_discount: dict[str, decimal.Decimal] - :param excluded_meter_ids: An array of meter ids that are excluded from - the given offer terms. - :type excluded_meter_ids: list[str] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, - 'name': {'key': 'Name', 'type': 'str'}, - 'tiered_discount': {'key': 'TieredDiscount', 'type': '{decimal}'}, - 'excluded_meter_ids': {'key': 'ExcludedMeterIds', 'type': '[str]'}, - } - - def __init__(self, effective_date=None, tiered_discount=None, excluded_meter_ids=None): - super(MonetaryCommitment, self).__init__(effective_date=effective_date) - self.tiered_discount = tiered_discount - self.excluded_meter_ids = excluded_meter_ids - self.name = 'Monetary Commitment' diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_credit.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_credit.py deleted file mode 100644 index a13a1bc2bd4b..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/monetary_credit.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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 .offer_term_info import OfferTermInfo - - -class MonetaryCredit(OfferTermInfo): - """Indicates that this is a monetary credit offer. - - :param effective_date: Indicates the date from which the offer term is - effective. - :type effective_date: datetime - :param name: Constant filled by server. - :type name: str - :param credit: The amount of credit provided under the terms of the given - offer level. - :type credit: decimal.Decimal - :param excluded_meter_ids: An array of meter ids that are excluded from - the given offer terms. - :type excluded_meter_ids: list[str] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, - 'name': {'key': 'Name', 'type': 'str'}, - 'credit': {'key': 'Credit', 'type': 'decimal'}, - 'excluded_meter_ids': {'key': 'ExcludedMeterIds', 'type': '[str]'}, - } - - def __init__(self, effective_date=None, credit=None, excluded_meter_ids=None): - super(MonetaryCredit, self).__init__(effective_date=effective_date) - self.credit = credit - self.excluded_meter_ids = excluded_meter_ids - self.name = 'Monetary Credit' diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/offer_term_info.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/offer_term_info.py deleted file mode 100644 index 108ffbc1035f..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/offer_term_info.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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 OfferTermInfo(Model): - """Describes the offer term. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MonetaryCredit, MonetaryCommitment, RecurringCharge - - :param effective_date: Indicates the date from which the offer term is - effective. - :type effective_date: datetime - :param name: Constant filled by server. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, - 'name': {'key': 'Name', 'type': 'str'}, - } - - _subtype_map = { - 'name': {'Monetary Credit': 'MonetaryCredit', 'Monetary Commitment': 'MonetaryCommitment', 'Recurring Charge': 'RecurringCharge'} - } - - def __init__(self, effective_date=None): - super(OfferTermInfo, self).__init__() - self.effective_date = effective_date - self.name = None diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/rate_card_query_parameters.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/rate_card_query_parameters.py deleted file mode 100644 index 022a8ae045ea..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/rate_card_query_parameters.py +++ /dev/null @@ -1,53 +0,0 @@ -# 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 RateCardQueryParameters(Model): - """Parameters that are used in the odata $filter query parameter for providing - RateCard information. - - :param offer_durable_id: The Offer ID parameter consists of the 'MS-AZR-' - prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See - https://azure.microsoft.com/en-us/support/legal/offer-details/ for more - information on the list of available Offer IDs, country/region - availability, and billing currency. - :type offer_durable_id: str - :param currency: The currency in which the rates need to be provided. - :type currency: str - :param locale: The culture in which the resource metadata needs to be - localized. - :type locale: str - :param region_info: 2 letter ISO code where the offer was purchased. - :type region_info: str - """ - - _validation = { - 'offer_durable_id': {'required': True, 'pattern': r'^MS-AZR-\d{4}P(-\d{4}P)*$'}, - 'currency': {'required': True}, - 'locale': {'required': True}, - 'region_info': {'required': True}, - } - - _attribute_map = { - 'offer_durable_id': {'key': 'OfferDurableId', 'type': 'str'}, - 'currency': {'key': 'Currency', 'type': 'str'}, - 'locale': {'key': 'Locale', 'type': 'str'}, - 'region_info': {'key': 'RegionInfo', 'type': 'str'}, - } - - def __init__(self, offer_durable_id, currency, locale, region_info): - super(RateCardQueryParameters, self).__init__() - self.offer_durable_id = offer_durable_id - self.currency = currency - self.locale = locale - self.region_info = region_info diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/recurring_charge.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/recurring_charge.py deleted file mode 100644 index e649610ec043..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/recurring_charge.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 .offer_term_info import OfferTermInfo - - -class RecurringCharge(OfferTermInfo): - """Indicates a recurring charge is present for this offer. - - :param effective_date: Indicates the date from which the offer term is - effective. - :type effective_date: datetime - :param name: Constant filled by server. - :type name: str - :param recurring_charge: The amount of recurring charge as per the offer - term. - :type recurring_charge: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'effective_date': {'key': 'EffectiveDate', 'type': 'iso-8601'}, - 'name': {'key': 'Name', 'type': 'str'}, - 'recurring_charge': {'key': 'RecurringCharge', 'type': 'int'}, - } - - def __init__(self, effective_date=None, recurring_charge=None): - super(RecurringCharge, self).__init__(effective_date=effective_date) - self.recurring_charge = recurring_charge - self.name = 'Recurring Charge' diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/resource_rate_card_info.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/resource_rate_card_info.py deleted file mode 100644 index b9d52778392e..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/resource_rate_card_info.py +++ /dev/null @@ -1,45 +0,0 @@ -# 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 ResourceRateCardInfo(Model): - """Price and Metadata information for resources. - - :param currency: The currency in which the rates are provided. - :type currency: str - :param locale: The culture in which the resource information is localized. - :type locale: str - :param is_tax_included: All rates are pretax, so this will always be - returned as 'false'. - :type is_tax_included: bool - :param offer_terms: A list of offer terms. - :type offer_terms: list[~azure.mgmt.commerce.models.OfferTermInfo] - :param meters: A list of meters. - :type meters: list[~azure.mgmt.commerce.models.MeterInfo] - """ - - _attribute_map = { - 'currency': {'key': 'Currency', 'type': 'str'}, - 'locale': {'key': 'Locale', 'type': 'str'}, - 'is_tax_included': {'key': 'IsTaxIncluded', 'type': 'bool'}, - 'offer_terms': {'key': 'OfferTerms', 'type': '[OfferTermInfo]'}, - 'meters': {'key': 'Meters', 'type': '[MeterInfo]'}, - } - - def __init__(self, currency=None, locale=None, is_tax_included=None, offer_terms=None, meters=None): - super(ResourceRateCardInfo, self).__init__() - self.currency = currency - self.locale = locale - self.is_tax_included = is_tax_included - self.offer_terms = offer_terms - self.meters = meters diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_aggregation.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_aggregation.py deleted file mode 100644 index b79c1341dcff..000000000000 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/models/usage_aggregation.py +++ /dev/null @@ -1,90 +0,0 @@ -# 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 UsageAggregation(Model): - """Describes the usageAggregation. - - :param id: Unique Id for the usage aggregate. - :type id: str - :param name: Name of the usage aggregate. - :type name: str - :param type: Type of the resource being returned. - :type type: str - :param subscription_id: The subscription identifier for the Azure user. - :type subscription_id: str - :param meter_id: Unique ID for the resource that was consumed (aka - ResourceID). - :type meter_id: str - :param usage_start_time: UTC start time for the usage bucket to which this - usage aggregate belongs. - :type usage_start_time: datetime - :param usage_end_time: UTC end time for the usage bucket to which this - usage aggregate belongs. - :type usage_end_time: datetime - :param quantity: The amount of the resource consumption that occurred in - this time frame. - :type quantity: float - :param unit: The unit in which the usage for this resource is being - counted, e.g. Hours, GB. - :type unit: str - :param meter_name: Friendly name of the resource being consumed. - :type meter_name: str - :param meter_category: Category of the consumed resource. - :type meter_category: str - :param meter_sub_category: Sub-category of the consumed resource. - :type meter_sub_category: str - :param meter_region: Region of the meterId used for billing purposes - :type meter_region: str - :param info_fields: Key-value pairs of instance details (legacy format). - :type info_fields: ~azure.mgmt.commerce.models.InfoField - :param instance_data: Key-value pairs of instance details represented as a - string. - :type instance_data: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, - 'meter_id': {'key': 'properties.meterId', 'type': 'str'}, - 'usage_start_time': {'key': 'properties.usageStartTime', 'type': 'iso-8601'}, - 'usage_end_time': {'key': 'properties.usageEndTime', 'type': 'iso-8601'}, - 'quantity': {'key': 'properties.quantity', 'type': 'float'}, - 'unit': {'key': 'properties.unit', 'type': 'str'}, - 'meter_name': {'key': 'properties.meterName', 'type': 'str'}, - 'meter_category': {'key': 'properties.meterCategory', 'type': 'str'}, - 'meter_sub_category': {'key': 'properties.meterSubCategory', 'type': 'str'}, - 'meter_region': {'key': 'properties.meterRegion', 'type': 'str'}, - 'info_fields': {'key': 'properties.infoFields', 'type': 'InfoField'}, - 'instance_data': {'key': 'properties.instanceData', 'type': 'str'}, - } - - def __init__(self, id=None, name=None, type=None, subscription_id=None, meter_id=None, usage_start_time=None, usage_end_time=None, quantity=None, unit=None, meter_name=None, meter_category=None, meter_sub_category=None, meter_region=None, info_fields=None, instance_data=None): - super(UsageAggregation, self).__init__() - self.id = id - self.name = name - self.type = type - self.subscription_id = subscription_id - self.meter_id = meter_id - self.usage_start_time = usage_start_time - self.usage_end_time = usage_end_time - self.quantity = quantity - self.unit = unit - self.meter_name = meter_name - self.meter_category = meter_category - self.meter_sub_category = meter_sub_category - self.meter_region = meter_region - self.info_fields = info_fields - self.instance_data = instance_data diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/__init__.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/__init__.py index 9d3f1040c469..eb9afae9e105 100644 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/__init__.py +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/__init__.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from .usage_aggregates_operations import UsageAggregatesOperations -from .rate_card_operations import RateCardOperations +from ._usage_aggregates_operations import UsageAggregatesOperations +from ._rate_card_operations import RateCardOperations __all__ = [ 'UsageAggregatesOperations', diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/rate_card_operations.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/_rate_card_operations.py similarity index 92% rename from sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/rate_card_operations.py rename to sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/_rate_card_operations.py index a9aa2528717f..edeb1da8e545 100644 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/rate_card_operations.py +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/_rate_card_operations.py @@ -18,6 +18,8 @@ class RateCardOperations(object): """RateCardOperations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -78,7 +80,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -87,14 +89,13 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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('ResourceRateCardInfo', response) diff --git a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/usage_aggregates_operations.py b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/_usage_aggregates_operations.py similarity index 90% rename from sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/usage_aggregates_operations.py rename to sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/_usage_aggregates_operations.py index cd263e6e16d9..13c741d7a356 100644 --- a/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/usage_aggregates_operations.py +++ b/sdk/commerce/azure-mgmt-commerce/azure/mgmt/commerce/operations/_usage_aggregates_operations.py @@ -18,6 +18,8 @@ class UsageAggregatesOperations(object): """UsageAggregatesOperations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -75,8 +77,7 @@ def list( :raises: :class:`ErrorResponseException` """ - def internal_paging(next_link=None, raw=False): - + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] @@ -103,7 +104,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -112,9 +113,13 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) @@ -122,12 +127,10 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.UsageAggregationPaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.UsageAggregationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.UsageAggregationPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates'} diff --git a/sdk/commerce/azure-mgmt-commerce/setup.py b/sdk/commerce/azure-mgmt-commerce/setup.py index 2ce2376a2640..aec9f3de9d65 100644 --- a/sdk/commerce/azure-mgmt-commerce/setup.py +++ b/sdk/commerce/azure-mgmt-commerce/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -64,10 +66,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False,