Skip to content

get_capacity_reservation_usage

get_capacity_reservation_usage(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    sm_capacity_reservation_arn: Optional[CapacityReservationArn] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> GetCapacityReservationUsageResponse

Returns the number of instances in use from a SageMaker Capacity Reservation, for each account that uses them.

SageMaker AI refreshes the usage counts periodically. The LastRefreshTime value shows when the counts were last refreshed.

Parameters:

  • sm_capacity_reservation_arn (Optional[CapacityReservationArn], default: None ) –

    The Amazon Resource Name (ARN) of the SageMaker Capacity Reservation. The ARN has the format arn:aws:sagemaker:region:account-id:sm-capacity-reservation/smcr-id.

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

    The maximum number of results to return in the response. If more results are available, the response includes a NextToken value.

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

    If the previous response was truncated, the response includes a NextToken value. To retrieve the next set of results, use that token in your next request.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def get_capacity_reservation_usage(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    sm_capacity_reservation_arn: Optional[
        "capo_sagemaker.types.capacity_reservation_arn.CapacityReservationArn"
    ] = None,
    max_results: Optional["capo_sagemaker.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
) -> "capo_sagemaker.types.get_capacity_reservation_usage_response.GetCapacityReservationUsageResponse":
    """<p>Returns the number of instances in use from a SageMaker Capacity Reservation, for each account that uses them.</p> <p>SageMaker AI refreshes the usage counts periodically. The <code>LastRefreshTime</code> value shows when the counts were last refreshed.</p>

    Args:
        sm_capacity_reservation_arn: <p>The Amazon Resource Name (ARN) of the SageMaker Capacity Reservation. The ARN has the format <code>arn:aws:sagemaker:region:account-id:sm-capacity-reservation/smcr-id</code>.</p>
        max_results: <p>The maximum number of results to return in the response. If more results are available, the response includes a <code>NextToken</code> value.</p>
        next_token: <p>If the previous response was truncated, the response includes a <code>NextToken</code> value. To retrieve the next set of results, use that token in your next request.</p>

    Raises:
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.get_capacity_reservation_usage_request.GetCapacityReservationUsageRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.get_capacity_reservation_usage_response.GetCapacityReservationUsageResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.get_capacity_reservation_usage

        output, http_response = (
            capo_sagemaker._operations.sage_maker.get_capacity_reservation_usage.get_capacity_reservation_usage(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetCapacityReservationUsage")
    )
    input_: capo_sagemaker.types.get_capacity_reservation_usage_request.GetCapacityReservationUsageRequest = {}
    if sm_capacity_reservation_arn is not None:
        input_["sm_capacity_reservation_arn"] = sm_capacity_reservation_arn
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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