Skip to content

Commit

Permalink
CodeGen from PR 13039 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 96b8123aab536028980b8969df64408c64109d9e into 45c7ae9
  • Loading branch information
SDKAuto committed Feb 22, 2021
1 parent 9f1a27b commit da180bb
Show file tree
Hide file tree
Showing 18 changed files with 513 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.usage_details = UsageDetailsOperations(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"chosen_version": "2019-10-01",
"total_api_version_list": ["2019-10-01"],
"client": {
"name": "ConsumptionManagementClient",
"filename": "_consumption_management_client",
"description": "Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": false,
"client_side_validation": true
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "Azure Subscription ID.",
"docstring_type": "str",
"required": true
}
},
"async": {
"credential": {
"signature": "credential, # type: \"AsyncTokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "Azure Subscription ID.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id"
},
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null
},
"operation_groups": {
"usage_details": "UsageDetailsOperations",
"marketplaces": "MarketplacesOperations",
"budgets": "BudgetsOperations",
"tags": "TagsOperations",
"charges": "ChargesOperations",
"balances": "BalancesOperations",
"reservations_summaries": "ReservationsSummariesOperations",
"reservations_details": "ReservationsDetailsOperations",
"reservation_recommendations": "ReservationRecommendationsOperations",
"reservation_recommendation_details": "ReservationRecommendationDetailsOperations",
"reservation_transactions": "ReservationTransactionsOperations",
"price_sheet": "PriceSheetOperations",
"forecasts": "ForecastsOperations",
"operations": "Operations",
"aggregated_cost": "AggregatedCostOperations",
"events": "EventsOperations",
"lots": "LotsOperations",
"credits": "CreditsOperations"
},
"operation_mixins": {
},
"sync_imports": "None",
"async_imports": "None"
}
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 = "8.0.0"
VERSION = "2.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.usage_details = UsageDetailsOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ async def get_for_billing_period_by_management_group(
return cls(pipeline_response, deserialized, {})

return deserialized
get_for_billing_period_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedcost'} # type: ignore
get_for_billing_period_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedCost'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ async def create_or_update(
parameters: "_models.Budget",
**kwargs
) -> "_models.Budget":
"""The operation to create or update a budget. Update operation requires latest eTag to be set in
the request mandatorily. You may obtain the latest eTag by performing a get operation. Create
operation does not require eTag.
"""The operation to create or update a budget. You can optionally provide an eTag if desired as a
form of concurrency control. To obtain the latest eTag for a given budget, perform a get
operation prior to your put operation.
:param scope: The scope associated with budget operations. This includes
'/subscriptions/{subscriptionId}/' for subscription scope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def list(
filter: Optional[str] = None,
**kwargs
) -> AsyncIterable["_models.ForecastsListResult"]:
"""Lists the forecast charges by subscriptionId.
"""Lists the forecast charges for scope defined. Please note that this API is no longer actively
under development. We recommend using our new Forecast API moving forward:
https://docs.microsoft.com/en-us/rest/api/cost-management/forecast/usage.
:param filter: May be used to filter forecasts by properties/usageDate (Utc time),
properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def get(

if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(_models.ErrorResponse, response)
error = self._deserialize(_models.HighCasedErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def get(
self,
scope: str,
**kwargs
) -> "_models.TagsResult":
) -> Optional["_models.TagsResult"]:
"""Get all available tag keys for the defined scope.
:param scope: The scope associated with tags operations. This includes
Expand All @@ -60,10 +60,10 @@ async def get(
:type scope: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: TagsResult, or the result of cls(response)
:rtype: ~azure.mgmt.consumption.models.TagsResult
:rtype: ~azure.mgmt.consumption.models.TagsResult or None
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResult"]
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TagsResult"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand All @@ -90,12 +90,14 @@ async def get(
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(_models.ErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('TagsResult', pipeline_response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('TagsResult', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from ._models_py3 import Forecast
from ._models_py3 import ForecastPropertiesConfidenceLevelsItem
from ._models_py3 import ForecastsListResult
from ._models_py3 import HighCasedErrorDetails
from ._models_py3 import HighCasedErrorResponse
from ._models_py3 import LegacyChargeSummary
from ._models_py3 import LegacyReservationRecommendation
from ._models_py3 import LegacyReservationTransaction
Expand Down Expand Up @@ -96,6 +98,8 @@
from ._models import Forecast # type: ignore
from ._models import ForecastPropertiesConfidenceLevelsItem # type: ignore
from ._models import ForecastsListResult # type: ignore
from ._models import HighCasedErrorDetails # type: ignore
from ._models import HighCasedErrorResponse # type: ignore
from ._models import LegacyChargeSummary # type: ignore
from ._models import LegacyReservationRecommendation # type: ignore
from ._models import LegacyReservationTransaction # type: ignore
Expand Down Expand Up @@ -186,6 +190,8 @@
'Forecast',
'ForecastPropertiesConfidenceLevelsItem',
'ForecastsListResult',
'HighCasedErrorDetails',
'HighCasedErrorResponse',
'LegacyChargeSummary',
'LegacyReservationRecommendation',
'LegacyReservationTransaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class EventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
NEW_CREDIT = "NewCredit"

class Grain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
"""The granularity of forecast.
"""The granularity of forecast. Please note that Yearly is not currently supported in this API.
The API will provide responses in the Monthly grain if Yearly is selected. To get yearly grain
data, please use our newer Forecast API.
"""

DAILY = "Daily"
Expand Down
Loading

0 comments on commit da180bb

Please sign in to comment.