# Released under the MIT License. See LICENSE for details.#"""My nifty ssh/mosh/rsync mishmash."""from__future__importannotationsfromenumimportEnumfromdataclassesimportdataclassfromefro.dataclassioimportioprepped
[docs]classLockType(Enum):"""Types of locks that can be acquired on a host."""HOST='host'WORKSPACE='workspace'PYCHARM='pycharm'CLION='clion'
[docs]@ioprepped@dataclassclassHostConfig:"""Config for a cloud machine to run commands on. precommand, if set, will be run before the passed commands. Note that it is not run in interactive mode (when no command is given). """address:str|None=Noneuser:str='ubuntu'port:int=22mosh_port:int|None=Nonemosh_port_2:int|None=Nonemosh_server_path:str|None=Nonemosh_shell:str='sh'workspaces_root:str='/home/${USER}/cloudshell_workspaces'sync_perms:bool=Trueprecommand_noninteractive:str|None=Noneprecommand_interactive:str|None=Nonemanaged:bool=Falseregion:str|None=Noneidle_minutes:int=5can_sudo_reboot:bool=Falsemax_sessions:int=4reboot_wait_seconds:int=20reboot_attempts:int=1
[docs]defresolved_workspaces_root(self)->str:"""Returns workspaces_root with standard substitutions."""returnself.workspaces_root.replace('${USER}',self.user)