forked from TrueCloudLab/frostfs-testlib
70 lines
2.2 KiB
Python
70 lines
2.2 KiB
Python
from typing import Optional
|
|
|
|
from frostfs_testlib.cli.cli_command import CliCommand
|
|
from frostfs_testlib.shell import CommandResult
|
|
|
|
|
|
class FrostfsCliApeManager(CliCommand):
|
|
"""Operations with APE manager."""
|
|
|
|
def add(
|
|
self,
|
|
rpc_endpoint: str,
|
|
chain_id: Optional[str] = None,
|
|
chain_id_hex: Optional[str] = None,
|
|
path: Optional[str] = None,
|
|
rule: Optional[str] | Optional[list[str]] = None,
|
|
target_name: Optional[str] = None,
|
|
target_type: Optional[str] = None,
|
|
wallet: Optional[str] = None,
|
|
address: Optional[str] = None,
|
|
timeout: Optional[str] = None,
|
|
) -> CommandResult:
|
|
"""Add rule chain for a target."""
|
|
|
|
return self._execute(
|
|
"ape-manager add",
|
|
**{param: value for param, value in locals().items() if param not in ["self"]},
|
|
)
|
|
|
|
def list(
|
|
self,
|
|
rpc_endpoint: str,
|
|
target_name: Optional[str] = None,
|
|
target_type: Optional[str] = None,
|
|
wallet: Optional[str] = None,
|
|
address: Optional[str] = None,
|
|
timeout: Optional[str] = None,
|
|
) -> CommandResult:
|
|
"""Generate APE override by target and APE chains. Util command.
|
|
|
|
Generated APE override can be dumped to a file in JSON format that is passed to
|
|
"create" command.
|
|
"""
|
|
|
|
return self._execute(
|
|
"ape-manager list",
|
|
**{param: value for param, value in locals().items() if param not in ["self"]},
|
|
)
|
|
|
|
def remove(
|
|
self,
|
|
rpc_endpoint: str,
|
|
chain_id: Optional[str] = None,
|
|
chain_id_hex: Optional[str] = None,
|
|
target_name: Optional[str] = None,
|
|
target_type: Optional[str] = None,
|
|
wallet: Optional[str] = None,
|
|
address: Optional[str] = None,
|
|
timeout: Optional[str] = None,
|
|
) -> CommandResult:
|
|
"""Generate APE override by target and APE chains. Util command.
|
|
|
|
Generated APE override can be dumped to a file in JSON format that is passed to
|
|
"create" command.
|
|
"""
|
|
|
|
return self._execute(
|
|
"ape-manager remove",
|
|
**{param: value for param, value in locals().items() if param not in ["self"]},
|
|
)
|