Skip to content

describe_sessions async

describe_sessions(
    state: SessionState,
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    max_results: Optional[SessionMaxResults] = None,
    next_token: Optional[NextToken] = None,
    filters: Optional[SessionFilterList] = None,
) -> DescribeSessionsResponse

Retrieves a list of all active sessions (both connected and disconnected) or terminated sessions from the past 30 days.

Parameters:

  • state (SessionState) –

    The session status to retrieve a list of sessions for. For example, "Active".

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

    The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

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

    The token for the next set of items to return. (You received this token from a previous call.)

  • filters (Optional[SessionFilterList], default: None ) –

    One or more filters to limit the type of sessions returned by the request.

Raises:

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def describe_sessions(
    self,
    state: "capo_ssm.types.session_state.SessionState",
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    max_results: Optional[
        "capo_ssm.types.session_max_results.SessionMaxResults"
    ] = None,
    next_token: Optional["capo_ssm.types.next_token.NextToken"] = None,
    filters: Optional[
        "capo_ssm.types.session_filter_list.SessionFilterList"
    ] = None,
) -> "capo_ssm.types.describe_sessions_response.DescribeSessionsResponse":
    """<p>Retrieves a list of all active sessions (both connected and disconnected) or terminated sessions from the past 30 days.</p>

    Args:
        state: <p>The session status to retrieve a list of sessions for. For example, "Active".</p>
        max_results: <p>The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.</p>
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>
        filters: <p>One or more filters to limit the type of sessions returned by the request.</p>

    Raises:
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_filter_key.InvalidFilterKey: <p>The specified key isn't valid.</p>
        capo_ssm.errors.invalid_next_token.InvalidNextToken: <p>The specified token isn't valid.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.describe_sessions_request.DescribeSessionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.describe_sessions_response.DescribeSessionsResponse"
    ]:
        import capo_ssm._operations.amazon_ssm.describe_sessions

        (
            output,
            http_response,
        ) = await capo_ssm._operations.amazon_ssm.describe_sessions.async_describe_sessions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeSessions")
    )
    input_: capo_ssm.types.describe_sessions_request.DescribeSessionsRequest = {
        "state": state
    }
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if filters is not None:
        input_["filters"] = filters

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