-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AutoPR consumption/resource-manager] Introducing UsageDetails and Ag…
…gregated Cost by Managment Group Scope. Also updated some existing examples to include missing billingperiod in billingPeriodId Property. (#3085) * Generated from 12751061e78dc5b2f8eeef917245068f094e5d14 Introducing UsageDetails and Aggregated Cost by Managment Group Scope. Also updated some existing examples to include missing "billingperiod" in "billingPeriodId" Property. * Generated from f7e522f1bd3b5937cf127b68da80d85c60631b2b Addressed comments from review * Generated from 0dc16e7f2fcf746f4c39a977d4a04c862b47dd26 Added location parameter to managementgroupId and also added Get To method name of AggregatedCost
- Loading branch information
1 parent
faf478f
commit 86b7fd4
Showing
18 changed files
with
649 additions
and
139 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
78 changes: 78 additions & 0 deletions
78
...mgmt-consumption/azure/mgmt/consumption/models/management_group_aggregated_cost_result.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,78 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .resource import Resource | ||
|
||
|
||
class ManagementGroupAggregatedCostResult(Resource): | ||
"""A management group aggregated cost resource. | ||
Variables are only populated by the server, and will be ignored when | ||
sending a request. | ||
:ivar id: Resource Id. | ||
:vartype id: str | ||
:ivar name: Resource name. | ||
:vartype name: str | ||
:ivar type: Resource type. | ||
:vartype type: str | ||
:ivar tags: Resource tags. | ||
:vartype tags: dict[str, str] | ||
:ivar billing_period_id: The id of the billing period resource that the | ||
aggregated cost belongs to. | ||
:vartype billing_period_id: str | ||
:ivar azure_charges: Azure Charges. | ||
:vartype azure_charges: decimal.Decimal | ||
:ivar marketplace_charges: Marketplace Charges. | ||
:vartype marketplace_charges: decimal.Decimal | ||
:ivar charges_billed_separately: Charges Billed Separately. | ||
:vartype charges_billed_separately: decimal.Decimal | ||
:ivar currency: The ISO currency in which the meter is charged, for | ||
example, USD. | ||
:vartype currency: str | ||
:param children: Children of a management group | ||
:type children: | ||
list[~azure.mgmt.consumption.models.ManagementGroupAggregatedCostResult] | ||
""" | ||
|
||
_validation = { | ||
'id': {'readonly': True}, | ||
'name': {'readonly': True}, | ||
'type': {'readonly': True}, | ||
'tags': {'readonly': True}, | ||
'billing_period_id': {'readonly': True}, | ||
'azure_charges': {'readonly': True}, | ||
'marketplace_charges': {'readonly': True}, | ||
'charges_billed_separately': {'readonly': True}, | ||
'currency': {'readonly': True}, | ||
} | ||
|
||
_attribute_map = { | ||
'id': {'key': 'id', 'type': 'str'}, | ||
'name': {'key': 'name', 'type': 'str'}, | ||
'type': {'key': 'type', 'type': 'str'}, | ||
'tags': {'key': 'tags', 'type': '{str}'}, | ||
'billing_period_id': {'key': 'properties.billingPeriodId', 'type': 'str'}, | ||
'azure_charges': {'key': 'properties.azureCharges', 'type': 'decimal'}, | ||
'marketplace_charges': {'key': 'properties.marketplaceCharges', 'type': 'decimal'}, | ||
'charges_billed_separately': {'key': 'properties.chargesBilledSeparately', 'type': 'decimal'}, | ||
'currency': {'key': 'properties.currency', 'type': 'str'}, | ||
'children': {'key': 'properties.children', 'type': '[ManagementGroupAggregatedCostResult]'}, | ||
} | ||
|
||
def __init__(self, **kwargs): | ||
super(ManagementGroupAggregatedCostResult, self).__init__(**kwargs) | ||
self.billing_period_id = None | ||
self.azure_charges = None | ||
self.marketplace_charges = None | ||
self.charges_billed_separately = None | ||
self.currency = None | ||
self.children = kwargs.get('children', None) |
78 changes: 78 additions & 0 deletions
78
...-consumption/azure/mgmt/consumption/models/management_group_aggregated_cost_result_py3.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,78 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .resource_py3 import Resource | ||
|
||
|
||
class ManagementGroupAggregatedCostResult(Resource): | ||
"""A management group aggregated cost resource. | ||
Variables are only populated by the server, and will be ignored when | ||
sending a request. | ||
:ivar id: Resource Id. | ||
:vartype id: str | ||
:ivar name: Resource name. | ||
:vartype name: str | ||
:ivar type: Resource type. | ||
:vartype type: str | ||
:ivar tags: Resource tags. | ||
:vartype tags: dict[str, str] | ||
:ivar billing_period_id: The id of the billing period resource that the | ||
aggregated cost belongs to. | ||
:vartype billing_period_id: str | ||
:ivar azure_charges: Azure Charges. | ||
:vartype azure_charges: decimal.Decimal | ||
:ivar marketplace_charges: Marketplace Charges. | ||
:vartype marketplace_charges: decimal.Decimal | ||
:ivar charges_billed_separately: Charges Billed Separately. | ||
:vartype charges_billed_separately: decimal.Decimal | ||
:ivar currency: The ISO currency in which the meter is charged, for | ||
example, USD. | ||
:vartype currency: str | ||
:param children: Children of a management group | ||
:type children: | ||
list[~azure.mgmt.consumption.models.ManagementGroupAggregatedCostResult] | ||
""" | ||
|
||
_validation = { | ||
'id': {'readonly': True}, | ||
'name': {'readonly': True}, | ||
'type': {'readonly': True}, | ||
'tags': {'readonly': True}, | ||
'billing_period_id': {'readonly': True}, | ||
'azure_charges': {'readonly': True}, | ||
'marketplace_charges': {'readonly': True}, | ||
'charges_billed_separately': {'readonly': True}, | ||
'currency': {'readonly': True}, | ||
} | ||
|
||
_attribute_map = { | ||
'id': {'key': 'id', 'type': 'str'}, | ||
'name': {'key': 'name', 'type': 'str'}, | ||
'type': {'key': 'type', 'type': 'str'}, | ||
'tags': {'key': 'tags', 'type': '{str}'}, | ||
'billing_period_id': {'key': 'properties.billingPeriodId', 'type': 'str'}, | ||
'azure_charges': {'key': 'properties.azureCharges', 'type': 'decimal'}, | ||
'marketplace_charges': {'key': 'properties.marketplaceCharges', 'type': 'decimal'}, | ||
'charges_billed_separately': {'key': 'properties.chargesBilledSeparately', 'type': 'decimal'}, | ||
'currency': {'key': 'properties.currency', 'type': 'str'}, | ||
'children': {'key': 'properties.children', 'type': '[ManagementGroupAggregatedCostResult]'}, | ||
} | ||
|
||
def __init__(self, *, children=None, **kwargs) -> None: | ||
super(ManagementGroupAggregatedCostResult, self).__init__(**kwargs) | ||
self.billing_period_id = None | ||
self.azure_charges = None | ||
self.marketplace_charges = None | ||
self.charges_billed_separately = None | ||
self.currency = None | ||
self.children = children |
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
160 changes: 160 additions & 0 deletions
160
azure-mgmt-consumption/azure/mgmt/consumption/operations/aggregated_cost_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,160 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
import uuid | ||
from msrest.pipeline import ClientRawResponse | ||
|
||
from .. import models | ||
|
||
|
||
class AggregatedCostOperations(object): | ||
"""AggregatedCostOperations operations. | ||
:param client: Client for service requests. | ||
:param config: Configuration of service client. | ||
:param serializer: An object model serializer. | ||
:param deserializer: An object model deserializer. | ||
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-06-30. Constant value: "2018-06-30". | ||
""" | ||
|
||
models = models | ||
|
||
def __init__(self, client, config, serializer, deserializer): | ||
|
||
self._client = client | ||
self._serialize = serializer | ||
self._deserialize = deserializer | ||
self.api_version = "2018-06-30" | ||
|
||
self.config = config | ||
|
||
def get_by_management_group( | ||
self, management_group_id, custom_headers=None, raw=False, **operation_config): | ||
"""Provides the aggregate cost of a management group and all child | ||
management groups by current billing period. | ||
:param management_group_id: Azure Management Group ID. | ||
:type management_group_id: 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: ManagementGroupAggregatedCostResult or ClientRawResponse if | ||
raw=true | ||
:rtype: | ||
~azure.mgmt.consumption.models.ManagementGroupAggregatedCostResult or | ||
~msrest.pipeline.ClientRawResponse | ||
:raises: | ||
:class:`ErrorResponseException<azure.mgmt.consumption.models.ErrorResponseException>` | ||
""" | ||
# Construct URL | ||
url = self.get_by_management_group.metadata['url'] | ||
path_format_arguments = { | ||
'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str') | ||
} | ||
url = self._client.format_url(url, **path_format_arguments) | ||
|
||
# Construct parameters | ||
query_parameters = {} | ||
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') | ||
|
||
# Construct headers | ||
header_parameters = {} | ||
header_parameters['Accept'] = 'application/json' | ||
if self.config.generate_client_request_id: | ||
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) | ||
if custom_headers: | ||
header_parameters.update(custom_headers) | ||
if self.config.accept_language is not None: | ||
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') | ||
|
||
# Construct and send request | ||
request = self._client.get(url, query_parameters, header_parameters) | ||
response = self._client.send(request, stream=False, **operation_config) | ||
|
||
if response.status_code not in [200]: | ||
raise models.ErrorResponseException(self._deserialize, response) | ||
|
||
deserialized = None | ||
|
||
if response.status_code == 200: | ||
deserialized = self._deserialize('ManagementGroupAggregatedCostResult', response) | ||
|
||
if raw: | ||
client_raw_response = ClientRawResponse(deserialized, response) | ||
return client_raw_response | ||
|
||
return deserialized | ||
get_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost'} | ||
|
||
def get_for_billing_period_by_management_group( | ||
self, management_group_id, billing_period_name, custom_headers=None, raw=False, **operation_config): | ||
"""Provides the aggregate cost of a management group and all child | ||
management groups by specified billing period. | ||
:param management_group_id: Azure Management Group ID. | ||
:type management_group_id: str | ||
:param billing_period_name: Billing Period Name. | ||
:type billing_period_name: 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: ManagementGroupAggregatedCostResult or ClientRawResponse if | ||
raw=true | ||
:rtype: | ||
~azure.mgmt.consumption.models.ManagementGroupAggregatedCostResult or | ||
~msrest.pipeline.ClientRawResponse | ||
:raises: | ||
:class:`ErrorResponseException<azure.mgmt.consumption.models.ErrorResponseException>` | ||
""" | ||
# Construct URL | ||
url = self.get_for_billing_period_by_management_group.metadata['url'] | ||
path_format_arguments = { | ||
'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str'), | ||
'billingPeriodName': self._serialize.url("billing_period_name", billing_period_name, 'str') | ||
} | ||
url = self._client.format_url(url, **path_format_arguments) | ||
|
||
# Construct parameters | ||
query_parameters = {} | ||
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') | ||
|
||
# Construct headers | ||
header_parameters = {} | ||
header_parameters['Accept'] = 'application/json' | ||
if self.config.generate_client_request_id: | ||
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) | ||
if custom_headers: | ||
header_parameters.update(custom_headers) | ||
if self.config.accept_language is not None: | ||
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') | ||
|
||
# Construct and send request | ||
request = self._client.get(url, query_parameters, header_parameters) | ||
response = self._client.send(request, stream=False, **operation_config) | ||
|
||
if response.status_code not in [200]: | ||
raise models.ErrorResponseException(self._deserialize, response) | ||
|
||
deserialized = None | ||
|
||
if response.status_code == 200: | ||
deserialized = self._deserialize('ManagementGroupAggregatedCostResult', response) | ||
|
||
if raw: | ||
client_raw_response = ClientRawResponse(deserialized, response) | ||
return client_raw_response | ||
|
||
return deserialized | ||
get_for_billing_period_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedcost'} |
Oops, something went wrong.