from types import TracebackType
from typing import AsyncIterator, Mapping, Sequence
__version__: str
class SsmError(Exception):
class SsmAwsError(SsmError):
class SsmProtocolError(SsmError):
class SsmTransportError(SsmError):
class SsmClosedError(SsmError):
class SsmCryptoError(SsmError):
class SsmTimeoutError(SsmError):
def configure_logging(level: str = "warn") -> None:
class OutputStream:
def __aiter__(self) -> AsyncIterator[bytes]: ...
async def __anext__(self) -> bytes: ...
class Session:
@property
def id(self) -> str:
@property
def target(self) -> str:
@property
def agent_version(self) -> str | None:
@property
def banner(self) -> str | None:
@property
def exit_code(self) -> int | None:
@property
def is_encrypted(self) -> bool:
@property
def is_ready(self) -> bool:
@property
def is_closed(self) -> bool:
@property
def close_reason(self) -> str | None:
async def wait_ready(self) -> None:
async def wait_closed(self) -> None:
async def send(self, data: bytes) -> None:
async def send_terminal_size(self, cols: int, rows: int) -> None:
def output(self) -> OutputStream:
async def terminate(self) -> None:
async def __aenter__(self) -> Session: ...
async def __aexit__(
self,
exc_type: type[BaseException] | None = None,
exc_value: BaseException | None = None,
traceback: TracebackType | None = None,
) -> bool: ...
class SessionManager:
@staticmethod
async def new(region: str | None = None) -> SessionManager:
async def start_session(
self,
target: str,
document_name: str | None = None,
parameters: Mapping[str, Sequence[str]] | None = None,
reason: str | None = None,
ready_timeout: float = 30.0,
) -> Session:
async def start_port_forward(
self, target: str, remote_port: int, reason: str | None = None
) -> Session:
async def start_remote_port_forward(
self, target: str, host: str, remote_port: int, reason: str | None = None
) -> Session:
async def terminate_session(self, session_id: str) -> None:
class PortForwarder:
@staticmethod
async def bind(local_addr: str = "127.0.0.1:0", max_connections: int = 100) -> PortForwarder:
@property
def address(self) -> str:
@property
def port(self) -> int:
async def forward(self, session: Session) -> None:
def stop(self) -> None:
class InteractiveShell:
def __init__(
self,
show_banner: bool = True,
region: str | None = None,
reason: str | None = None,
) -> None: ...
async def run(self, target: str) -> int | None:
async def connect(
target: str, *, region: str | None = None, reason: str | None = None
) -> Session:
async def run_command(
target: str, command: str, *, region: str | None = None, timeout: float = 30.0
) -> str: