Skip to content

list_contexts async

list_contexts(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    source_uri: Optional[SourceUri] = None,
    context_type: Optional[String256] = None,
    created_after: Optional[Timestamp] = None,
    created_before: Optional[Timestamp] = None,
    sort_by: Optional[SortContextsBy] = None,
    sort_order: Optional[SortOrder] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListContextsResponse

Lists the contexts in your account and their properties.

Parameters:

  • source_uri (Optional[SourceUri], default: None ) –

    A filter that returns only contexts with the specified source URI.

  • context_type (Optional[String256], default: None ) –

    A filter that returns only contexts of the specified type.

  • created_after (Optional[Timestamp], default: None ) –

    A filter that returns only contexts created on or after the specified time.

  • created_before (Optional[Timestamp], default: None ) –

    A filter that returns only contexts created on or before the specified time.

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

    The property used to sort results. The default value is CreationTime.

  • sort_order (Optional[SortOrder], default: None ) –

    The sort order. The default value is Descending.

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

    If the previous call to ListContexts didn't return the full set of contexts, the call returns a token for getting the next set of contexts.

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

    The maximum number of contexts to return in the response. The default value is 10.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def list_contexts(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    source_uri: Optional["capo_sagemaker.types.source_uri.SourceUri"] = None,
    context_type: Optional["capo_sagemaker.types.string256.String256"] = None,
    created_after: Optional["capo_sagemaker.types.timestamp.Timestamp"] = None,
    created_before: Optional["capo_sagemaker.types.timestamp.Timestamp"] = None,
    sort_by: Optional[
        "capo_sagemaker.types.sort_contexts_by.SortContextsBy"
    ] = None,
    sort_order: Optional["capo_sagemaker.types.sort_order.SortOrder"] = None,
    next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
    max_results: Optional["capo_sagemaker.types.max_results.MaxResults"] = None,
) -> "capo_sagemaker.types.list_contexts_response.ListContextsResponse":
    """<p>Lists the contexts in your account and their properties.</p>

    Args:
        source_uri: <p>A filter that returns only contexts with the specified source URI.</p>
        context_type: <p>A filter that returns only contexts of the specified type.</p>
        created_after: <p>A filter that returns only contexts created on or after the specified time.</p>
        created_before: <p>A filter that returns only contexts created on or before the specified time.</p>
        sort_by: <p>The property used to sort results. The default value is <code>CreationTime</code>.</p>
        sort_order: <p>The sort order. The default value is <code>Descending</code>.</p>
        next_token: <p>If the previous call to <code>ListContexts</code> didn't return the full set of contexts, the call returns a token for getting the next set of contexts.</p>
        max_results: <p>The maximum number of contexts to return in the response. The default value is 10.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.list_contexts_request.ListContextsRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.list_contexts_response.ListContextsResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.list_contexts

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.list_contexts.async_list_contexts(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListContexts")
    )
    input_: capo_sagemaker.types.list_contexts_request.ListContextsRequest = {}
    if source_uri is not None:
        input_["source_uri"] = source_uri
    if context_type is not None:
        input_["context_type"] = context_type
    if created_after is not None:
        input_["created_after"] = created_after
    if created_before is not None:
        input_["created_before"] = created_before
    if sort_by is not None:
        input_["sort_by"] = sort_by
    if sort_order is not None:
        input_["sort_order"] = sort_order
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output