Skip to content

get_savings_plans_utilization_details

get_savings_plans_utilization_details(
    time_period: DateInterval,
    *,
    config_overrides: Optional[CostExplorerClientConfig] = None,
    filter: Optional[Expression] = None,
    data_type: Optional[SavingsPlansDataTypes] = None,
    next_token: Optional[NextPageToken] = None,
    max_results: Optional[MaxResults] = None,
    sort_by: Optional[SortDefinition] = None,
) -> GetSavingsPlansUtilizationDetailsResponse

Retrieves attribute data along with aggregate utilization and savings data for a given time period. This doesn't support granular or grouped data (daily/monthly) in response. You can't retrieve data by dates in a single response similar to GetSavingsPlanUtilization, but you have the option to make multiple calls to GetSavingsPlanUtilizationDetails by providing individual dates. You can use GetDimensionValues in SAVINGS_PLANS to determine the possible dimension values.

GetSavingsPlanUtilizationDetails internally groups data by SavingsPlansArn.

Parameters:

  • time_period (DateInterval) –

    The time period that you want the usage and costs for. The Start date must be within 13 months. The End date must be after the Start date.

    The End date is exclusive. If utilization data isn't complete for the whole period, Cost Explorer moves End earlier to the first day without complete data, unless DataType is only ATTRIBUTES. The response TimePeriod shows the period used.

  • filter (Optional[Expression], default: None ) –

    Filters Savings Plans utilization coverage data for active Savings Plans dimensions. You can filter data with the following dimensions:

    • LINKED_ACCOUNT

    • SAVINGS_PLAN_ARN

    • SAVINGS_PLANS_TYPE

    • REGION

    • PAYMENT_OPTION

    • INSTANCE_TYPE_FAMILY

    GetSavingsPlansUtilizationDetails uses the same Expression object as the other operations. The filter must have one of the following shapes:

    • A Dimensions expression.

    • A Not expression that contains one Dimensions expression.

    • An And expression with two or more operands, where each operand has one of the two shapes above.

    Or, Tags, and CostCategories expressions aren't supported. An And expression can't contain another And, and a Not expression can't contain an And or another Not.

    Each dimension can appear only once in the filter, including inside Not. To filter on several values of a dimension, put all of the values in one expression. Cost Explorer combines the values in one expression with OR.

  • data_type (Optional[SavingsPlansDataTypes], default: None ) –

    The data type.

  • next_token (Optional[NextPageToken], default: None ) –

    The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

  • max_results (Optional[MaxResults], default: None ) –

    The number of items to be returned in a response. The default is 20, with a minimum value of 1.

  • sort_by (Optional[SortDefinition], default: None ) –

    The value that you want to sort the data by.

    The following values are supported for Key:

    • UtilizationPercentage

    • TotalCommitment

    • UsedCommitment

    • UnusedCommitment

    • NetSavings

    • AmortizedRecurringCommitment

    • AmortizedUpfrontCommitment

    The supported values for SortOrder are ASCENDING and DESCENDING.

Raises:

Source code in docs_src/capo_cost_explorer/_services/cost_explorer.py
def get_savings_plans_utilization_details(
    self,
    time_period: "capo_cost_explorer.types.date_interval.DateInterval",
    *,
    config_overrides: Optional[CostExplorerClientConfig] = None,
    filter: Optional["capo_cost_explorer.types.expression.Expression"] = None,
    data_type: Optional[
        "capo_cost_explorer.types.savings_plans_data_types.SavingsPlansDataTypes"
    ] = None,
    next_token: Optional[
        "capo_cost_explorer.types.next_page_token.NextPageToken"
    ] = None,
    max_results: Optional["capo_cost_explorer.types.max_results.MaxResults"] = None,
    sort_by: Optional[
        "capo_cost_explorer.types.sort_definition.SortDefinition"
    ] = None,
) -> "capo_cost_explorer.types.get_savings_plans_utilization_details_response.GetSavingsPlansUtilizationDetailsResponse":
    """<p>Retrieves attribute data along with aggregate utilization and savings data for a given time period. This doesn't support granular or grouped data (daily/monthly) in response. You can't retrieve data by dates in a single response similar to <code>GetSavingsPlanUtilization</code>, but you have the option to make multiple calls to <code>GetSavingsPlanUtilizationDetails</code> by providing individual dates. You can use <code>GetDimensionValues</code> in <code>SAVINGS_PLANS</code> to determine the possible dimension values.</p> <note> <p> <code>GetSavingsPlanUtilizationDetails</code> internally groups data by <code>SavingsPlansArn</code>.</p> </note>

    Args:
        time_period: <p>The time period that you want the usage and costs for. The <code>Start</code> date must be within 13 months. The <code>End</code> date must be after the <code>Start</code> date.</p> <p>The <code>End</code> date is exclusive. If utilization data isn't complete for the whole period, Cost Explorer moves <code>End</code> earlier to the first day without complete data, unless <code>DataType</code> is only <code>ATTRIBUTES</code>. The response <code>TimePeriod</code> shows the period used.</p>
        filter: <p>Filters Savings Plans utilization coverage data for active Savings Plans dimensions. You can filter data with the following dimensions:</p> <ul> <li> <p> <code>LINKED_ACCOUNT</code> </p> </li> <li> <p> <code>SAVINGS_PLAN_ARN</code> </p> </li> <li> <p> <code>SAVINGS_PLANS_TYPE</code> </p> </li> <li> <p> <code>REGION</code> </p> </li> <li> <p> <code>PAYMENT_OPTION</code> </p> </li> <li> <p> <code>INSTANCE_TYPE_FAMILY</code> </p> </li> </ul> <p> <code>GetSavingsPlansUtilizationDetails</code> uses the same <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html">Expression</a> object as the other operations. The filter must have one of the following shapes:</p> <ul> <li> <p>A <code>Dimensions</code> expression.</p> </li> <li> <p>A <code>Not</code> expression that contains one <code>Dimensions</code> expression.</p> </li> <li> <p>An <code>And</code> expression with two or more operands, where each operand has one of the two shapes above.</p> </li> </ul> <p> <code>Or</code>, <code>Tags</code>, and <code>CostCategories</code> expressions aren't supported. An <code>And</code> expression can't contain another <code>And</code>, and a <code>Not</code> expression can't contain an <code>And</code> or another <code>Not</code>.</p> <p>Each dimension can appear only once in the filter, including inside <code>Not</code>. To filter on several values of a dimension, put all of the values in one expression. Cost Explorer combines the values in one expression with OR.</p>
        data_type: <p>The data type.</p>
        next_token: <p>The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.</p>
        max_results: <p>The number of items to be returned in a response. The default is <code>20</code>, with a minimum value of <code>1</code>.</p>
        sort_by: <p>The value that you want to sort the data by.</p> <p>The following values are supported for <code>Key</code>:</p> <ul> <li> <p> <code>UtilizationPercentage</code> </p> </li> <li> <p> <code>TotalCommitment</code> </p> </li> <li> <p> <code>UsedCommitment</code> </p> </li> <li> <p> <code>UnusedCommitment</code> </p> </li> <li> <p> <code>NetSavings</code> </p> </li> <li> <p> <code>AmortizedRecurringCommitment</code> </p> </li> <li> <p> <code>AmortizedUpfrontCommitment</code> </p> </li> </ul> <p>The supported values for <code>SortOrder</code> are <code>ASCENDING</code> and <code>DESCENDING</code>.</p>

    Raises:
        capo_cost_explorer.errors.data_unavailable_exception.DataUnavailableException: <p>The requested data is unavailable.</p>
        capo_cost_explorer.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The pagination token is invalid. Try again without a pagination token.</p>
        capo_cost_explorer.errors.limit_exceeded_exception.LimitExceededException: <p>You made too many calls in a short period of time. Try again later.</p>
        capo_cost_explorer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cost_explorer.types.get_savings_plans_utilization_details_request.GetSavingsPlansUtilizationDetailsRequest]",
    ) -> OperationResponse[
        "capo_cost_explorer.types.get_savings_plans_utilization_details_response.GetSavingsPlansUtilizationDetailsResponse"
    ]:
        import capo_cost_explorer._operations.aws_insights_index_service.get_savings_plans_utilization_details

        output, http_response = (
            capo_cost_explorer._operations.aws_insights_index_service.get_savings_plans_utilization_details.get_savings_plans_utilization_details(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetSavingsPlansUtilizationDetails")
    )
    input_: capo_cost_explorer.types.get_savings_plans_utilization_details_request.GetSavingsPlansUtilizationDetailsRequest = {
        "time_period": time_period
    }
    if filter is not None:
        input_["filter"] = filter
    if data_type is not None:
        input_["data_type"] = data_type
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if sort_by is not None:
        input_["sort_by"] = sort_by

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output