diff --git a/azure-mgmt-web/azure/mgmt/web/models/__init__.py b/azure-mgmt-web/azure/mgmt/web/models/__init__.py index aad8d9bfc2fe..5807858a38b6 100644 --- a/azure-mgmt-web/azure/mgmt/web/models/__init__.py +++ b/azure-mgmt-web/azure/mgmt/web/models/__init__.py @@ -127,6 +127,7 @@ from .recommendation import Recommendation from .recommendation_rule import RecommendationRule from .resource_health_metadata import ResourceHealthMetadata +from .billing_meter import BillingMeter from .csm_move_resource_envelope import CsmMoveResourceEnvelope from .geo_region import GeoRegion from .hosting_environment_deployment_info import HostingEnvironmentDeploymentInfo @@ -235,6 +236,7 @@ from .geo_region_paged import GeoRegionPaged from .identifier_paged import IdentifierPaged from .premier_add_on_offer_paged import PremierAddOnOfferPaged +from .billing_meter_paged import BillingMeterPaged from .site_paged import SitePaged from .backup_item_paged import BackupItemPaged from .site_config_resource_paged import SiteConfigResourcePaged @@ -446,6 +448,7 @@ 'Recommendation', 'RecommendationRule', 'ResourceHealthMetadata', + 'BillingMeter', 'CsmMoveResourceEnvelope', 'GeoRegion', 'HostingEnvironmentDeploymentInfo', @@ -554,6 +557,7 @@ 'GeoRegionPaged', 'IdentifierPaged', 'PremierAddOnOfferPaged', + 'BillingMeterPaged', 'SitePaged', 'BackupItemPaged', 'SiteConfigResourcePaged', diff --git a/azure-mgmt-web/azure/mgmt/web/models/billing_meter.py b/azure-mgmt-web/azure/mgmt/web/models/billing_meter.py new file mode 100644 index 000000000000..cad0a62ae07d --- /dev/null +++ b/azure-mgmt-web/azure/mgmt/web/models/billing_meter.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 .proxy_only_resource import ProxyOnlyResource + + +class BillingMeter(ProxyOnlyResource): + """App Service billing entity that contains information about meter which the + Azure billing system utilizes to charge users for services. + + 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 + :param kind: Kind of resource. + :type kind: str + :ivar type: Resource type. + :vartype type: str + :param meter_id: Meter GUID onboarded in Commerce + :type meter_id: str + :param billing_location: Azure Location of billable resource + :type billing_location: str + :param short_name: Short Name from App Service Azure pricing Page + :type short_name: str + :param friendly_name: Friendly name of the meter + :type friendly_name: str + :param resource_type: App Service resource type meter used for + :type resource_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'meter_id': {'key': 'properties.meterId', 'type': 'str'}, + 'billing_location': {'key': 'properties.billingLocation', 'type': 'str'}, + 'short_name': {'key': 'properties.shortName', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + } + + def __init__(self, kind=None, meter_id=None, billing_location=None, short_name=None, friendly_name=None, resource_type=None): + super(BillingMeter, self).__init__(kind=kind) + self.meter_id = meter_id + self.billing_location = billing_location + self.short_name = short_name + self.friendly_name = friendly_name + self.resource_type = resource_type diff --git a/azure-mgmt-web/azure/mgmt/web/models/billing_meter_paged.py b/azure-mgmt-web/azure/mgmt/web/models/billing_meter_paged.py new file mode 100644 index 000000000000..cb7b9103b59d --- /dev/null +++ b/azure-mgmt-web/azure/mgmt/web/models/billing_meter_paged.py @@ -0,0 +1,27 @@ +# 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.paging import Paged + + +class BillingMeterPaged(Paged): + """ + A paging container for iterating over a list of :class:`BillingMeter ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BillingMeter]'} + } + + def __init__(self, *args, **kwargs): + + super(BillingMeterPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-web/azure/mgmt/web/operations/__init__.py b/azure-mgmt-web/azure/mgmt/web/operations/__init__.py index 55c58c4be3bb..5ceaac0d94eb 100644 --- a/azure-mgmt-web/azure/mgmt/web/operations/__init__.py +++ b/azure-mgmt-web/azure/mgmt/web/operations/__init__.py @@ -20,6 +20,7 @@ from .provider_operations import ProviderOperations from .recommendations_operations import RecommendationsOperations from .resource_health_metadata_operations import ResourceHealthMetadataOperations +from .billing_meters_operations import BillingMetersOperations from .web_apps_operations import WebAppsOperations from .app_service_environments_operations import AppServiceEnvironmentsOperations from .app_service_plans_operations import AppServicePlansOperations @@ -36,6 +37,7 @@ 'ProviderOperations', 'RecommendationsOperations', 'ResourceHealthMetadataOperations', + 'BillingMetersOperations', 'WebAppsOperations', 'AppServiceEnvironmentsOperations', 'AppServicePlansOperations', diff --git a/azure-mgmt-web/azure/mgmt/web/operations/billing_meters_operations.py b/azure-mgmt-web/azure/mgmt/web/operations/billing_meters_operations.py new file mode 100644 index 000000000000..1fd793c46673 --- /dev/null +++ b/azure-mgmt-web/azure/mgmt/web/operations/billing_meters_operations.py @@ -0,0 +1,109 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class BillingMetersOperations(object): + """BillingMetersOperations 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: API Version. Constant value: "2016-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-03-01" + + self.config = config + + def list( + self, billing_location=None, custom_headers=None, raw=False, **operation_config): + """Gets a list of meters for a given location. + + Gets a list of meters for a given location. + + :param billing_location: Azure Location of billable resource + :type billing_location: 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: An iterator like instance of BillingMeter + :rtype: + ~azure.mgmt.web.models.BillingMeterPaged[~azure.mgmt.web.models.BillingMeter] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if billing_location is not None: + query_parameters['billingLocation'] = self._serialize.query("billing_location", billing_location, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.BillingMeterPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BillingMeterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters'} diff --git a/azure-mgmt-web/azure/mgmt/web/web_site_management_client.py b/azure-mgmt-web/azure/mgmt/web/web_site_management_client.py index 48e5cff90861..a3891b93bd46 100644 --- a/azure-mgmt-web/azure/mgmt/web/web_site_management_client.py +++ b/azure-mgmt-web/azure/mgmt/web/web_site_management_client.py @@ -28,6 +28,7 @@ from .operations.provider_operations import ProviderOperations from .operations.recommendations_operations import RecommendationsOperations from .operations.resource_health_metadata_operations import ResourceHealthMetadataOperations +from .operations.billing_meters_operations import BillingMetersOperations from .operations.web_apps_operations import WebAppsOperations from .operations.app_service_environments_operations import AppServiceEnvironmentsOperations from .operations.app_service_plans_operations import AppServicePlansOperations @@ -95,6 +96,8 @@ class WebSiteManagementClient(object): :vartype recommendations: azure.mgmt.web.operations.RecommendationsOperations :ivar resource_health_metadata: ResourceHealthMetadata operations :vartype resource_health_metadata: azure.mgmt.web.operations.ResourceHealthMetadataOperations + :ivar billing_meters: BillingMeters operations + :vartype billing_meters: azure.mgmt.web.operations.BillingMetersOperations :ivar web_apps: WebApps operations :vartype web_apps: azure.mgmt.web.operations.WebAppsOperations :ivar app_service_environments: AppServiceEnvironments operations @@ -143,6 +146,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.resource_health_metadata = ResourceHealthMetadataOperations( self._client, self.config, self._serialize, self._deserialize) + self.billing_meters = BillingMetersOperations( + self._client, self.config, self._serialize, self._deserialize) self.web_apps = WebAppsOperations( self._client, self.config, self._serialize, self._deserialize) self.app_service_environments = AppServiceEnvironmentsOperations(