Skip to content

list_contracts

list_contracts(
    *,
    config_overrides: Optional[BillingClientConfig] = None,
    next_token: Optional[PageToken] = None,
    max_results: Optional[int] = None,
) -> ListContractsResponse

Lists the private pricing contracts that your Amazon Web Services account is an eligible payer account of. This operation is read-only and paginated.

Parameters:

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

    The pagination token that indicates the next set of results to retrieve.

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

    The maximum number of contracts to return in a single call. Minimum value of 1, maximum value of 100.

Raises:

Examples:

Invoke ListContracts

>>> client.list_contracts(max_results=100)
Source code in docs_src/capo_billing/_services/billing.py
def list_contracts(
    self,
    *,
    config_overrides: Optional[BillingClientConfig] = None,
    next_token: Optional["capo_billing.types.page_token.PageToken"] = None,
    max_results: Optional[int] = None,
) -> "capo_billing.types.list_contracts_response.ListContractsResponse":
    """<p>Lists the private pricing contracts that your Amazon Web Services account is an eligible payer account of. This operation is read-only and paginated.</p>

    Args:
        next_token: <p>The pagination token that indicates the next set of results to retrieve.</p>
        max_results: <p>The maximum number of contracts to return in a single call. Minimum value of 1, maximum value of 100.</p>

    Raises:
        capo_billing.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_billing.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an unknown error, exception, or failure. </p>
        capo_billing.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. </p>
        capo_billing.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
        capo_billing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Invoke ListContracts

        >>> client.list_contracts(max_results=100)
    """

    def _handler(
        req: "OperationRequest[capo_billing.types.list_contracts_request.ListContractsRequest]",
    ) -> OperationResponse[
        "capo_billing.types.list_contracts_response.ListContractsResponse"
    ]:
        import capo_billing._operations.aws_billing.list_contracts

        output, http_response = (
            capo_billing._operations.aws_billing.list_contracts.list_contracts(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListContracts")
    )
    input_: capo_billing.types.list_contracts_request.ListContractsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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