Hosts Service

@Service
open class HostsService

The HostsService class is useful to manage all the BrownieHost database operations

Author

N7ghtm4r3 - Tecknobit

Constructors

Link copied to clipboard
@Autowired
constructor(hostsRepository: HostsRepository, eventsService: HostEventsService, servicesService: HostServicesService)
Constructor used to init the service

Properties

Link copied to clipboard
eventsService the support service used to manage the host events data
Link copied to clipboard
hostsRepository instance used to access to the HOSTS_KEY table
Link copied to clipboard
servicesService the support service used to manage the services data

Functions

Link copied to clipboard
open fun addService(host: BrownieHost, serviceName: String, hPayload: JsonHelper)
Method used to add a service to a host
Link copied to clipboard
open fun editHost(hostId: String, hostAddress: String, hostName: String, sshUser: String, sshPassword: String, sessionId: String)
Method used to edit an existing host
Link copied to clipboard
open fun editService(host: BrownieHost, serviceId: String, serviceName: String, hPayload: JsonHelper)
Method used to edit an existing service of a host
Link copied to clipboard
private open fun findServicePath(host: BrownieHost, serviceName: String): String
Method used to find the path of the service inside the filesystem of the machine
Link copied to clipboard
open fun getBrownieHost(sessionId: String, hostId: String): BrownieHost
Method used to check whether a host belongs to the specified session
Link copied to clipboard
Method used to retrieve the current overview of a host
Link copied to clipboard
open fun getHosts(sessionId: String, keywords: Set<String>, statuses: List<String>, page: Int, pageSize: Int): PaginatedResponse<BrownieHost>
Method used to get the list of the hosts
Link copied to clipboard
Method used to get the current status of the specified hosts
Link copied to clipboard
private open fun getNetworkInterfaceDetails(sshUser: String, sshPassword: String, hostAddress: String): Pair<String, String>
Method used to retrieve the network interface details of the remote host
Link copied to clipboard
private open fun handleHostStatus(hostId: String, status: HostStatus)
Method used to set the status of a host
Link copied to clipboard
private open fun handleServicesOnStart(host: BrownieHost)
Method used to handle the services of the host has been rebooted or stopped
Link copied to clipboard
open fun hostBelongsToSession(sessionId: String, hostId: String): Boolean
Method used to check whether a host belongs to the specified session
Link copied to clipboard
open fun rebootHost(host: BrownieHost)
Method used to reboot a host
Link copied to clipboard
open fun registerHost(hostId: String, hostName: String, hostAddress: String, sshUser: String, sshPassword: String, sessionId: String)
Method used to register a new host
Link copied to clipboard
open fun restartHost(host: BrownieHost)
Method used to restart a host after it has been rebooted or stopped
Link copied to clipboard
private open fun safeguardHostData(hostId: String, sessionId: String, sshUser: String, sshPassword: String, hostAddress: String): RemoteHostData
Method used to safeguard the sensitive data of a remote host
Link copied to clipboard
Method used to set the OFFLINE status of a host and all its attached services
Link copied to clipboard
Method used to set the ONLINE status of a host
Link copied to clipboard
Method used to set the REBOOTING status of a host and all its attached services
Link copied to clipboard
open fun startHost(host: BrownieHost)
Method used to start the remote host
Link copied to clipboard
open fun stopHost(host: BrownieHost)
Method used to stop a host
Link copied to clipboard
open fun unregisterHost(host: BrownieHost)
Method used to unregister a host from the system