Skip to content

Commit

Permalink
CodeGen from PR 12347 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge dbfa861cb8fb60af39883e6dbe1c55eb10c5afd6 into d4bad53
  • Loading branch information
SDKAuto committed Jan 15, 2021
1 parent ab7d89e commit 1605d1d
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 46 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 @@ -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 @@ -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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class Budget(ProxyResource):
Future start date should not be more than twelve months. Past start date should be selected
within the timegrain period. There are no restrictions on the end date.
:type time_period: ~azure.mgmt.consumption.models.BudgetTimePeriod
:param filter: May be used to filter budgets by resource group, resource, or meter.
:param filter: May be used to filter budgets by user-specified dimensions and/or tags.
:type filter: ~azure.mgmt.consumption.models.BudgetFilter
:ivar current_spend: The current amount of cost which is being tracked for a budget.
:vartype current_spend: ~azure.mgmt.consumption.models.CurrentSpend
Expand Down Expand Up @@ -897,8 +897,10 @@ class Forecast(Resource):
:vartype tags: dict[str, str]
:ivar usage_date: The usage date of the forecast.
:vartype usage_date: str
:param grain: The granularity of forecast. Possible values include: "Daily", "Monthly",
"Yearly".
:param grain: 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. Possible values include: "Daily",
"Monthly", "Yearly".
:type grain: str or ~azure.mgmt.consumption.models.Grain
:ivar charge: The amount of charge.
:vartype charge: float
Expand Down Expand Up @@ -1210,7 +1212,7 @@ class LegacyReservationRecommendation(ReservationRecommendation):
:ivar look_back_period: The number of days of usage to look back for recommendation.
:vartype look_back_period: str
:ivar instance_flexibility_ratio: The instance Flexibility Ratio.
:vartype instance_flexibility_ratio: int
:vartype instance_flexibility_ratio: float
:ivar instance_flexibility_group: The instance Flexibility Group.
:vartype instance_flexibility_group: str
:ivar normalized_size: The normalized Size.
Expand Down Expand Up @@ -1270,7 +1272,7 @@ class LegacyReservationRecommendation(ReservationRecommendation):
'tags': {'key': 'tags', 'type': '{str}'},
'kind': {'key': 'kind', 'type': 'str'},
'look_back_period': {'key': 'properties.lookBackPeriod', 'type': 'str'},
'instance_flexibility_ratio': {'key': 'properties.instanceFlexibilityRatio', 'type': 'int'},
'instance_flexibility_ratio': {'key': 'properties.instanceFlexibilityRatio', 'type': 'float'},
'instance_flexibility_group': {'key': 'properties.instanceFlexibilityGroup', 'type': 'str'},
'normalized_size': {'key': 'properties.normalizedSize', 'type': 'str'},
'recommended_quantity_normalized': {'key': 'properties.recommendedQuantityNormalized', 'type': 'float'},
Expand Down Expand Up @@ -2546,7 +2548,7 @@ class ModernReservationRecommendation(ReservationRecommendation):
:ivar look_back_period: The number of days of usage to look back for recommendation.
:vartype look_back_period: str
:ivar instance_flexibility_ratio: The instance Flexibility Ratio.
:vartype instance_flexibility_ratio: int
:vartype instance_flexibility_ratio: float
:ivar instance_flexibility_group: The instance Flexibility Group.
:vartype instance_flexibility_group: str
:ivar normalized_size: The normalized Size.
Expand Down Expand Up @@ -2606,7 +2608,7 @@ class ModernReservationRecommendation(ReservationRecommendation):
'tags': {'key': 'tags', 'type': '{str}'},
'kind': {'key': 'kind', 'type': 'str'},
'look_back_period': {'key': 'properties.lookBackPeriod', 'type': 'str'},
'instance_flexibility_ratio': {'key': 'properties.instanceFlexibilityRatio', 'type': 'int'},
'instance_flexibility_ratio': {'key': 'properties.instanceFlexibilityRatio', 'type': 'float'},
'instance_flexibility_group': {'key': 'properties.instanceFlexibilityGroup', 'type': 'str'},
'normalized_size': {'key': 'properties.normalizedSize', 'type': 'str'},
'recommended_quantity_normalized': {'key': 'properties.recommendedQuantityNormalized', 'type': 'float'},
Expand Down Expand Up @@ -3242,23 +3244,26 @@ class Notification(msrest.serialization.Model):
1000.
:type threshold: float
:param contact_emails: Required. Email addresses to send the budget notification to when the
threshold is exceeded.
threshold is exceeded. Must have at least one contact email or contact group specified at the
Subscription or Resource Group scopes. All other scopes must have at least one contact email
specified.
:type contact_emails: list[str]
:param contact_roles: Contact roles to send the budget notification to when the threshold is
exceeded.
:type contact_roles: list[str]
:param contact_groups: Action groups to send the budget notification to when the threshold is
exceeded.
exceeded. Only supported at Subscription or Resource Group scopes.
:type contact_groups: list[str]
:param threshold_type: The type of threshold. Possible values include: "Actual".
:param threshold_type: The type of threshold. Possible values include: "Actual". Default value:
"Actual".
:type threshold_type: str or ~azure.mgmt.consumption.models.ThresholdType
"""

_validation = {
'enabled': {'required': True},
'operator': {'required': True},
'threshold': {'required': True},
'contact_emails': {'required': True, 'max_items': 50, 'min_items': 1},
'contact_emails': {'required': True, 'max_items': 50, 'min_items': 0},
'contact_groups': {'max_items': 50, 'min_items': 0},
}

Expand All @@ -3283,7 +3288,7 @@ def __init__(
self.contact_emails = kwargs['contact_emails']
self.contact_roles = kwargs.get('contact_roles', None)
self.contact_groups = kwargs.get('contact_groups', None)
self.threshold_type = kwargs.get('threshold_type', None)
self.threshold_type = kwargs.get('threshold_type', "Actual")


class Operation(msrest.serialization.Model):
Expand Down Expand Up @@ -4184,12 +4189,18 @@ class TagsResult(ProxyResource):
:type e_tag: str
:param tags: A set of tags. A list of Tag.
:type tags: list[~azure.mgmt.consumption.models.Tag]
:ivar next_link: The link (url) to the next page of results.
:vartype next_link: str
:ivar previous_link: The link (url) to the previous page of results.
:vartype previous_link: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'next_link': {'readonly': True},
'previous_link': {'readonly': True},
}

_attribute_map = {
Expand All @@ -4198,6 +4209,8 @@ class TagsResult(ProxyResource):
'type': {'key': 'type', 'type': 'str'},
'e_tag': {'key': 'eTag', 'type': 'str'},
'tags': {'key': 'properties.tags', 'type': '[Tag]'},
'next_link': {'key': 'properties.nextLink', 'type': 'str'},
'previous_link': {'key': 'properties.previousLink', 'type': 'str'},
}

def __init__(
Expand All @@ -4206,6 +4219,8 @@ def __init__(
):
super(TagsResult, self).__init__(**kwargs)
self.tags = kwargs.get('tags', None)
self.next_link = None
self.previous_link = None


class UsageDetailsListResult(msrest.serialization.Model):
Expand Down
Loading

0 comments on commit 1605d1d

Please sign in to comment.