Skip to content

Commit

Permalink
CodeGen from PR 13414 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Adding fixes made in 2019-10-01 to 2019-11-01 (Azure#13414)

The PR for adding new version 2019-11-01 took longer than expected to be
approved, so some fixes made in 10-01 were not included in 2019-11-01
version.

The missing changes were the following PRs:
Azure/azure-rest-api-specs#12777
Azure/azure-rest-api-specs#12555
Azure/azure-rest-api-specs#13039
Azure/azure-rest-api-specs#13097
Azure/azure-rest-api-specs#12822
Azure/azure-rest-api-specs#13280
Azure/azure-rest-api-specs#12942
Azure/azure-rest-api-specs#13248
Azure/azure-rest-api-specs#13378

This PR is to add those corrections to 2019-11-01 version
  • Loading branch information
SDKAuto committed Mar 16, 2021
1 parent cf42345 commit 20b1895
Show file tree
Hide file tree
Showing 46 changed files with 807 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-10-01"
self.api_version = "2019-11-01"
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 @@ -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-11-01",
"total_api_version_list": ["2019-11-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 @@ -45,7 +45,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-10-01"
self.api_version = "2019-11-01"
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 @@ -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 @@ -66,7 +66,7 @@ async def get_by_management_group(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -126,7 +126,7 @@ async def get_for_billing_period_by_management_group(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down 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 @@ -60,7 +60,7 @@ async def get_by_billing_account(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -118,7 +118,7 @@ async def get_for_billing_period_by_billing_account(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -159,7 +159,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down 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 Expand Up @@ -235,7 +235,7 @@ async def create_or_update(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -315,7 +315,7 @@ async def delete(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

def prepare_request(next_link=None):
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 All @@ -62,7 +64,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ async def get(
top: Optional[int] = None,
**kwargs
) -> "_models.PriceSheetResult":
"""Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only
for May 1, 2014 or later.
"""Gets the price sheet for a subscription. Price sheet is available via this API only for May 1,
2014 or later.
:param expand: May be used to expand the properties/meterDetails within a price sheet. By
default, these fields are not included when returning price sheet.
Expand All @@ -69,7 +69,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -142,7 +142,7 @@ async def get_by_billing_period(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def __init__(self, client, config, serializer, deserializer) -> None:

async def get(
self,
billing_scope: str,
scope: Union[str, "_models.Scope"],
scope: str,
scope1: Union[str, "_models.Scope"],
region: str,
term: Union[str, "_models.Term"],
look_back_period: Union[str, "_models.LookBackPeriod"],
Expand All @@ -52,15 +52,15 @@ async def get(
) -> Optional["_models.ReservationRecommendationDetailsModel"]:
"""Details of a reservation recommendation for what-if analysis of reserved instances.
:param billing_scope: The scope associated with reservation recommendation details operations.
This includes '/subscriptions/{subscriptionId}/' for subscription scope,
:param scope: The scope associated with reservation recommendation details operations. This
includes '/subscriptions/{subscriptionId}/' for subscription scope,
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope,
/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope, and
'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
for billingProfile scope.
:type billing_scope: str
:param scope: Scope of the reservation.
:type scope: str or ~azure.mgmt.consumption.models.Scope
:type scope: str
:param scope1: Scope of the reservation.
:type scope1: str or ~azure.mgmt.consumption.models.Scope
:param region: Used to select the region the recommendation should be generated for.
:type region: str
:param term: Specify length of reservation recommendation term.
Expand All @@ -81,20 +81,20 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

# Construct URL
url = self.get.metadata['url'] # type: ignore
path_format_arguments = {
'billingScope': self._serialize.url("billing_scope", billing_scope, 'str', skip_quote=True),
'scope': self._serialize.url("scope", scope, 'str', skip_quote=True),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
query_parameters['scope'] = self._serialize.query("scope", scope, 'str')
query_parameters['scope'] = self._serialize.query("scope1", scope1, 'str')
query_parameters['region'] = self._serialize.query("region", region, 'str')
query_parameters['term'] = self._serialize.query("term", term, 'str')
query_parameters['lookBackPeriod'] = self._serialize.query("look_back_period", look_back_period, 'str')
Expand All @@ -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 All @@ -121,4 +121,4 @@ async def get(
return cls(pipeline_response, deserialized, {})

return deserialized
get.metadata = {'url': '/{billingScope}/providers/Microsoft.Consumption/reservationRecommendationDetails'} # type: ignore
get.metadata = {'url': '/{scope}/providers/Microsoft.Consumption/reservationRecommendationDetails'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-10-01"
api_version = "2019-11-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Loading

0 comments on commit 20b1895

Please sign in to comment.