-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AutoPR web/resource-manager] Adding BillingMeters API (#2271)
* Generated from 346651741dcafd1a91d0741d726aef7cdac29c4d Adding BillingMeters API * Generated from 2c9ced71b2b53f7039ec9ddbcbe4f23f05897e89 Adding reference to readme.md * Generated from 1723dbe3e971a273cd0d143700e69c20912f9bce Merge branch 'master' of https://github.com/andreyse/azure-rest-api-specs * Generated from 1723dbe3e971a273cd0d143700e69c20912f9bce Merge branch 'master' of https://github.com/andreyse/azure-rest-api-specs
- Loading branch information
1 parent
0a8ffbe
commit 749691a
Showing
6 changed files
with
213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 # 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
27
azure-mgmt-web/azure/mgmt/web/models/billing_meter_paged.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
azure-mgmt-web/azure/mgmt/web/operations/billing_meters_operations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters