Skip to content

Commit

Permalink
CodeGen from PR 18174 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.Consumption to add version stable/2021-10-01 (Azure#18174)

* Adding details about access and Report Schema for reservation report

* MISC

* Missing errors

* fixing model error

* MISC

* MISC

* MISC

* MSIC

* MISC

* Removing Etag to fix the S360 item

* Fixing Routing issue

* MISC

* MISC

* MISC

* MISC
  • Loading branch information
SDKAuto committed Apr 27, 2022
1 parent ffdee53 commit 3bc7bfd
Show file tree
Hide file tree
Showing 42 changed files with 1,478 additions and 757 deletions.
6 changes: 3 additions & 3 deletions sdk/consumption/azure-mgmt-consumption/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/python@5.12.0",
"@autorest/python@5.13.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "87c075973362d149fd8e23b31b061692d8c6dd45",
"commit": "731678aa0923415ebcb5fcead877a10244c2c629",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/consumption/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"autorest_command": "autorest specification/consumption/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/consumption/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from azure.core.credentials import TokenCredential


class ConsumptionManagementClientConfiguration(Configuration):
class ConsumptionManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for ConsumptionManagementClient.
Note that all parameters used to create this instance are saved as instance
Expand All @@ -29,6 +29,9 @@ class ConsumptionManagementClientConfiguration(Configuration):
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
Expand All @@ -38,14 +41,16 @@ def __init__(
**kwargs: Any
) -> None:
super(ConsumptionManagementClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2021-10-01") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-10-01"
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-consumption/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, Optional, TYPE_CHECKING
from typing import Any, TYPE_CHECKING

from msrest import Deserializer, Serializer

from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

from . import models
from ._configuration import ConsumptionManagementClientConfiguration
Expand All @@ -21,8 +22,9 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential

class ConsumptionManagementClient:
"""Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions.
class ConsumptionManagementClient: # pylint: disable=too-many-instance-attributes
"""Consumption management client provides access to consumption resources for Azure Enterprise
Subscriptions.
:ivar usage_details: UsageDetailsOperations operations
:vartype usage_details: azure.mgmt.consumption.operations.UsageDetailsOperations
Expand Down Expand Up @@ -66,8 +68,11 @@ class ConsumptionManagementClient:
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param base_url: Service URL. Default value is 'https://management.azure.com'.
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
Expand Down Expand Up @@ -105,7 +110,7 @@ def __init__(

def _send_request(
self,
request, # type: HttpRequest
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
"""Runs the network request through the client's chained policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"azure_arm": true,
"has_lro_operations": false,
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ConsumptionManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ConsumptionManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ConsumptionManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ConsumptionManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
},
"global_parameters": {
"sync": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "9.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from azure.core.credentials_async import AsyncTokenCredential


class ConsumptionManagementClientConfiguration(Configuration):
class ConsumptionManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for ConsumptionManagementClient.
Note that all parameters used to create this instance are saved as instance
Expand All @@ -29,6 +29,9 @@ class ConsumptionManagementClientConfiguration(Configuration):
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
Expand All @@ -38,14 +41,16 @@ def __init__(
**kwargs: Any
) -> None:
super(ConsumptionManagementClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2021-10-01") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-10-01"
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-consumption/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, Awaitable, Optional, TYPE_CHECKING
from typing import Any, Awaitable, TYPE_CHECKING

from msrest import Deserializer, Serializer

from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

from .. import models
from ._configuration import ConsumptionManagementClientConfiguration
Expand All @@ -21,8 +22,9 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

class ConsumptionManagementClient:
"""Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions.
class ConsumptionManagementClient: # pylint: disable=too-many-instance-attributes
"""Consumption management client provides access to consumption resources for Azure Enterprise
Subscriptions.
:ivar usage_details: UsageDetailsOperations operations
:vartype usage_details: azure.mgmt.consumption.aio.operations.UsageDetailsOperations
Expand Down Expand Up @@ -67,8 +69,11 @@ class ConsumptionManagementClient:
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param base_url: Service URL. Default value is 'https://management.azure.com'.
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# pylint: disable=too-many-lines
# 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 functools
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
Expand Down Expand Up @@ -59,7 +58,7 @@ async def get_by_management_group(
:param filter: May be used to filter aggregated cost by properties/usageStart (Utc time),
properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It
does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where
key and value is separated by a colon (:).
key and value is separated by a colon (:). Default value is None.
:type filter: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ManagementGroupAggregatedCostResult, or the result of cls(response)
Expand All @@ -72,16 +71,23 @@ async def get_by_management_group(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2021-10-01") # type: str


request = build_get_by_management_group_request(
management_group_id=management_group_id,
api_version=api_version,
filter=filter,
template_url=self.get_by_management_group.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand All @@ -96,7 +102,7 @@ async def get_by_management_group(

return deserialized

get_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost'} # type: ignore
get_by_management_group.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost"} # type: ignore


@distributed_trace_async
Expand Down Expand Up @@ -124,16 +130,23 @@ async def get_for_billing_period_by_management_group(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2021-10-01") # type: str


request = build_get_for_billing_period_by_management_group_request(
management_group_id=management_group_id,
billing_period_name=billing_period_name,
api_version=api_version,
template_url=self.get_for_billing_period_by_management_group.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand All @@ -148,5 +161,5 @@ async def get_for_billing_period_by_management_group(

return deserialized

get_for_billing_period_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/aggregatedCost'} # type: ignore
get_for_billing_period_by_management_group.metadata = {'url': "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/aggregatedCost"} # type: ignore

Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# pylint: disable=too-many-lines
# 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 functools
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
Expand Down Expand Up @@ -66,15 +65,22 @@ async def get_by_billing_account(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2021-10-01") # type: str


request = build_get_by_billing_account_request(
billing_account_id=billing_account_id,
api_version=api_version,
template_url=self.get_by_billing_account.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand All @@ -89,7 +95,7 @@ async def get_by_billing_account(

return deserialized

get_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances'} # type: ignore
get_by_billing_account.metadata = {'url': "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances"} # type: ignore


@distributed_trace_async
Expand Down Expand Up @@ -117,16 +123,23 @@ async def get_for_billing_period_by_billing_account(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2021-10-01") # type: str


request = build_get_for_billing_period_by_billing_account_request(
billing_account_id=billing_account_id,
billing_period_name=billing_period_name,
api_version=api_version,
template_url=self.get_for_billing_period_by_billing_account.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
Expand All @@ -141,5 +154,5 @@ async def get_for_billing_period_by_billing_account(

return deserialized

get_for_billing_period_by_billing_account.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances'} # type: ignore
get_for_billing_period_by_billing_account.metadata = {'url': "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances"} # type: ignore

Loading

0 comments on commit 3bc7bfd

Please sign in to comment.