get_cost_categories
¶
get_cost_categories(
time_period: DateInterval,
*,
config_overrides: Optional[CostExplorerClientConfig] = None,
search_string: Optional[SearchString] = None,
cost_category_name: Optional[CostCategoryName] = None,
filter: Optional[Expression] = None,
sort_by: Optional[SortDefinitions] = None,
billing_view_arn: Optional[BillingViewArn] = None,
max_results: Optional[MaxResults] = None,
next_page_token: Optional[NextPageToken] = None,
) -> GetCostCategoriesResponse
Retrieves an array of cost category names and values incurred cost.
If some cost category names and values are not associated with any cost, they will not be returned by this API.
Parameters:
-
search_string(Optional[SearchString], default:None) –The value that you want to search the filter values for.
If you don't specify a
CostCategoryName,SearchStringis used to filter cost category names that match theSearchStringpattern. If you specify aCostCategoryName,SearchStringis used to filter cost category values that match theSearchStringpattern. -
sort_by(Optional[SortDefinitions], default:None) –The value that you sort the data by.
The key represents the cost and usage metrics. The following values are supported:
-
BlendedCost -
UnblendedCost -
AmortizedCost -
NetAmortizedCost -
NetUnblendedCost -
UsageQuantity -
NormalizedUsageAmount
The supported key values for the
SortOrdervalue areASCENDINGandDESCENDING.When you use the
SortByvalue, theNextPageTokenandSearchStringkey values aren't supported. -
-
billing_view_arn(Optional[BillingViewArn], default:None) –The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
-
max_results(Optional[MaxResults], default:None) –This field is only used when the
SortByvalue is provided in the request.The maximum number of objects that are returned for this request. If
MaxResultsisn't specified with theSortByvalue, the request returns 1000 results as the default value for this parameter.For
GetCostCategories, MaxResults has an upper quota of 1000. -
next_page_token(Optional[NextPageToken], default:None) –If the number of objects that are still available for retrieval exceeds the quota, Amazon Web Services returns a NextPageToken value in the response. To retrieve the next batch of objects, provide the NextPageToken from the previous call in your next request.
Raises:
-
BillExpirationException–The requested report expired. Update the date interval and try again.
-
BillingViewHealthStatusException–The billing view status must be
HEALTHYto perform this action. Try again when the status isHEALTHY. -
DataUnavailableException–The requested data is unavailable.
-
InvalidNextTokenException–The pagination token is invalid. Try again without a pagination token.
-
LimitExceededException–You made too many calls in a short period of time. Try again later.
-
RequestChangedException–Your request parameters changed between pages. Try again with the old parameters or without a pagination token.
-
ResourceNotFoundException–The specified ARN in the request doesn't exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cost_explorer/_services/cost_explorer.py
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 | |