pymapadmin.commands
¶
- pymapadmin.commands.load_commands(group='pymapadmin.commands')[source]¶
Load and return a map of command name to implementation class.
pymapadmin.commands.base
¶
- class pymapadmin.commands.base.Command(args, channel)[source]¶
Interface for command implementations.
- Parameters:
args (Namespace) – The command-line arguments.
channel (Channel) – The GRPC channel for executing commands.
- abstract classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- class pymapadmin.commands.base.ClientCommand(args, channel)[source]¶
Interface for client command implementations.
- Parameters:
args (Namespace) – The command line arguments.
client – The client object.
channel (Channel) –
- abstract property client: StubT¶
Get the client object for the command.
- Parameters:
channel – The GRPC channel for executing commands.
- abstract handle_response(response, outfile, errfile)[source]¶
Handle each response. For streaming responses, this will be called once for each streamed response as long as
0
is returned.
- class pymapadmin.commands.base.AdminCommand(args, channel)[source]¶
Interface for admin command implementations.
The request and response must conform to the
AdminRequestProtocol
andAdminResponseProtocol
protocols, respectively.The default
handle_response()
implementation callshandle_success()
orhandle_failure()
depending on the result code.- Parameters:
args (Namespace) – The command line arguments.
client – The client object.
channel (Channel) –
- handle_response(response, outfile, errfile)[source]¶
Handle each response. For streaming responses, this will be called once for each streamed response as long as
0
is returned.
pymapadmin.commands.health
¶
- class pymapadmin.commands.health.CheckCommand(args, channel)[source]¶
Check the health of the server.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property method: MethodProtocol[HealthCheckRequest, HealthCheckResponse]¶
The GRPC client method.
pymapadmin.commands.system
¶
- class pymapadmin.commands.system.SaveArgsCommand(args, channel)[source]¶
Save the connection settings given as command-line arguments (e.g. –host, –port, etc) to a config file.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- class pymapadmin.commands.system.LoginCommand(args, channel)[source]¶
Login as a user for future requests.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property method: MethodProtocol[LoginRequest, LoginResponse]¶
The GRPC client method.
- class pymapadmin.commands.system.PingCommand(args, channel)[source]¶
Ping the server.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property method: MethodProtocol[PingRequest, PingResponse]¶
The GRPC client method.
pymapadmin.commands.mailbox
¶
- class pymapadmin.commands.mailbox.AppendCommand(args, channel)[source]¶
Append a message directly to a user’s mailbox.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property method: MethodProtocol[AppendRequest, AppendResponse]¶
The GRPC client method.
pymapadmin.commands.user
¶
- class pymapadmin.commands.user.GetUserCommand(args, channel)[source]¶
Print a user and its metadata.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property method: MethodProtocol[GetUserRequest, UserResponse]¶
The GRPC client method.
- class pymapadmin.commands.user.SetUserCommand(args, channel)[source]¶
Set the metadata for a user, creating it if it does not exist.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property method: MethodProtocol[SetUserRequest, UserResponse]¶
The GRPC client method.
- class pymapadmin.commands.user.ChangePasswordCommand(args, channel)[source]¶
Change a password for an existing user, without modifying any other metadata.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property first: GetUserCommand¶
The first step in the compound operation.
- property second: SetUserCommand¶
The second step in the compound operation.
- build_first(request)[source]¶
Build the request object for the first step.
- Parameters:
request (_ChangePasswordRequest) – The compound operation request.
- Return type:
GetUserRequest
- build_second(request, first_response)[source]¶
Build the request object for the second step.
- Parameters:
request (_ChangePasswordRequest) – The compound operation request.
first_response (UserResponse) – The response received by the first step.
- Returns:
If the second step should proceed, returns a two-tuple where the first item is the request object for the second step and the second item is ignored.
If the compound request should be aborted, returns a two-tuple where the first item is
None
and the second item can be a response to use instead of executing the second step.If both items in the tuple are
None
, the compound operation raises aRuntimeError
displaying the response to the first step.- Return type:
tuple[SetUserRequest | None, UserResponse | None]
- class pymapadmin.commands.user.DeleteUserCommand(args, channel)[source]¶
Delete a user and its mail data.
- Parameters:
args (Namespace) –
channel (Channel) –
- classmethod add_subparser(name, subparsers)[source]¶
Add the command-line argument subparser for the command.
- Parameters:
name (str) – The name to use for the subparser.
subparsers (Any) – The special action object as returned by
add_subparsers()
.
- Returns:
The new sub-parser object.
- Return type:
- property method: MethodProtocol[DeleteUserRequest, UserResponse]¶
The GRPC client method.