list_sessions
¶
list_sessions(
*,
config_overrides: Optional[RedshiftDataClientConfig] = None,
next_token: Optional[String] = None,
max_results: Optional[ListStatementsLimit] = None,
session_id: Optional[UUID] = None,
status: Optional[SessionStatusString] = None,
role_level: Optional[bool] = None,
cluster_identifier: Optional[ClusterIdentifierString] = None,
workgroup_name: Optional[WorkgroupNameString] = None,
database: Optional[String] = None,
) -> ListSessionsResponse
Lists the sessions that the caller created in the last 24 hours. By default, only sessions with a status of AVAILABLE or BUSY are returned. You can filter the results by session status, compute target (cluster or serverless workgroup), or database. To retrieve the metadata for a single session, provide the SessionId parameter. Use NextToken to page through the session list.
Returns only the sessions that the caller created. When identity-enhanced role sessions are used, you must provide either the ClusterIdentifier or WorkgroupName parameter to ensure that the IAM Identity Center user can only access the Amazon Redshift IAM Identity Center applications they are assigned. For more information, see Trusted identity propagation overview.
Parameters:
-
next_token(Optional[String], default:None) –A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
-
max_results(Optional[ListStatementsLimit], default:None) –The maximum number of sessions to return in the response. If more sessions exist than fit in one response, the operation returns
NextTokento paginate the results. -
session_id(Optional[UUID], default:None) –The identifier of a specific session to return metadata for. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. When you provide
SessionId, you can't specifyStatus,ClusterIdentifier,WorkgroupName, orDatabase. -
status(Optional[SessionStatusString], default:None) –The status of the sessions to list. If no status is specified, sessions with a status of
AVAILABLEorBUSYare returned. Status values are defined as follows:-
AVAILABLE – The session is open and ready to run a SQL statement.
-
BUSY – The session is currently running a SQL statement.
-
CLOSED – The session is closed and can no longer run SQL statements.
-
-
role_level(Optional[bool], default:None) –Specifies whether to return all sessions created by the caller's IAM role, including sessions from previous IAM sessions. If false, only sessions created in the current IAM session are returned. The default is true.
-
cluster_identifier(Optional[ClusterIdentifierString], default:None) –The cluster identifier. Only sessions on this cluster are returned. When providing
ClusterIdentifier, thenWorkgroupNamecan't be specified. -
workgroup_name(Optional[WorkgroupNameString], default:None) –The serverless workgroup name or Amazon Resource Name (ARN). Only sessions on this workgroup are returned. When providing
WorkgroupName, thenClusterIdentifiercan't be specified. -
database(Optional[String], default:None) –The name of the database. Only sessions connected to this database are returned.
Raises:
-
InternalServerException–The Amazon Redshift Data API operation failed due to invalid input.
-
ResourceNotFoundException–The Amazon Redshift Data API operation failed due to a missing resource.
-
ValidationException–The Amazon Redshift Data API operation failed due to invalid input.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_redshift_data/_services/redshift_data.py
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | |