Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR web/resource-manager] Adding BillingMeters API #2271

Merged
merged 5 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions azure-mgmt-web/azure/mgmt/web/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -446,6 +448,7 @@
'Recommendation',
'RecommendationRule',
'ResourceHealthMetadata',
'BillingMeter',
'CsmMoveResourceEnvelope',
'GeoRegion',
'HostingEnvironmentDeploymentInfo',
Expand Down Expand Up @@ -554,6 +557,7 @@
'GeoRegionPaged',
'IdentifierPaged',
'PremierAddOnOfferPaged',
'BillingMeterPaged',
'SitePaged',
'BackupItemPaged',
'SiteConfigResourcePaged',
Expand Down
66 changes: 66 additions & 0 deletions azure-mgmt-web/azure/mgmt/web/models/billing_meter.py
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions azure-mgmt-web/azure/mgmt/web/models/billing_meter_paged.py
Original file line number Diff line number Diff line change
@@ -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 <azure.mgmt.web.models.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)
2 changes: 2 additions & 0 deletions azure-mgmt-web/azure/mgmt/web/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,6 +37,7 @@
'ProviderOperations',
'RecommendationsOperations',
'ResourceHealthMetadataOperations',
'BillingMetersOperations',
'WebAppsOperations',
'AppServiceEnvironmentsOperations',
'AppServicePlansOperations',
Expand Down
109 changes: 109 additions & 0 deletions azure-mgmt-web/azure/mgmt/web/operations/billing_meters_operations.py
Original file line number Diff line number Diff line change
@@ -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<msrest:optionsforoperations>`.
:return: An iterator like instance of BillingMeter
:rtype:
~azure.mgmt.web.models.BillingMeterPaged[~azure.mgmt.web.models.BillingMeter]
:raises: :class:`CloudError<msrestazure.azure_exceptions.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'}
5 changes: 5 additions & 0 deletions azure-mgmt-web/azure/mgmt/web/web_site_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down