Host Services Controller

@RestController
@RequestMapping(value = "BASE_EQUINOX_ENDPOINT + SESSIONS_KEY + "/{" + IDENTIFIER_KEY + "}/" + HOSTS_KEY + "/{" + HOST_IDENTIFIER_KEY + "}/" + SERVICES_KEY" )
open class HostServicesController : DefaultBrownieController

The HostServicesController class is useful to manage all the BrownieHostService operations

Author

N7ghtm4r3 - Tecknobit

See also

EquinoxController
DefaultEquinoxController

Constructors

Link copied to clipboard
@Autowired
constructor(sessionsService: BrownieSessionsService, hostsService: HostsService, service: HostServicesService)
Constructor used to init the controller

Properties

Link copied to clipboard
protected val configuration: EquinoxBackendConfiguration
Link copied to clipboard
currentBrownieSession the current Brownie's session used in the request
Link copied to clipboard
protected val hostsService: HostsService
hostsService the support service used to manage the hosts data
Link copied to clipboard
protected open var jsonHelper: JsonHelper
Link copied to clipboard
protected open var me: T
Link copied to clipboard
protected open var messageSource: MessageSource
Link copied to clipboard
open var resourcesProvider: ResourcesProvider
Link copied to clipboard
val RESPONSE_SUCCESSFUL_MESSAGE: String = "operation_executed_successfully"
Link copied to clipboard
protected open var serverProtector: ServerProtector
Link copied to clipboard
service the support service used to manage the services data
Link copied to clipboard
sessionsService the support service used to manage the sessions data
Link copied to clipboard
val SOMETHING_WENT_WRONG_MESSAGE: String = "something_went_wrong"
SOMETHING_WENT_WRONG_MESSAGE the key of the message sent to the clients when a remote SSH connection failed
Link copied to clipboard
protected open var usersRepository: R
Link copied to clipboard
val WRONG_EMAIL_MESSAGE: String = "wrong_email"
Link copied to clipboard
val WRONG_LANGUAGE_MESSAGE: String = "wrong_language"
Link copied to clipboard
val WRONG_NAME_MESSAGE: String = "wrong_name"
Link copied to clipboard
val WRONG_PASSWORD_MESSAGE: String = "wrong_password"
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure"
Link copied to clipboard
val WRONG_SURNAME_MESSAGE: String = "wrong_surname"

Functions

Link copied to clipboard
@PutMapping
open fun addService(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @RequestParam(value = "language", required = false, defaultValue = "en") language: String, @RequestBody payload: Map<String, Any>): String
Endpoint used to add a service to a host
Link copied to clipboard
@PatchMapping(path = "/{" + SERVICE_IDENTIFIER_KEY + "}" )
open fun editService(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @PathVariable(value = "service_id") serviceId: String, @RequestParam(value = "language", required = false, defaultValue = "en") language: String, @RequestBody payload: Map<String, Any>): String
Endpoint used to edit an existing service to a host
Link copied to clipboard
protected open fun failedResponse(errorKey: String): String
Link copied to clipboard
Link copied to clipboard
protected open fun getBrownieHostIfAllowed(sessionId: String, hostId: String): BrownieHost
Method to retrieve a BrownieHost checking the identifier of the session and its identifier
Link copied to clipboard
protected open fun getInternationalizedMessage(messageKey: String): String
Link copied to clipboard
@GetMapping(path = "/{" + SERVICE_IDENTIFIER_KEY + "}" )
open fun <T> getService(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @PathVariable(value = "service_id") serviceId: String, @RequestParam(value = "language", required = false, defaultValue = "en") language: String): T
Endpoint used to get an existing service of a host
Link copied to clipboard
@GetMapping
open fun <T> getServices(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @RequestParam(name = "keywords", defaultValue = "", required = false) keywords: Set<String>, @RequestParam(name = "statuses", defaultValue = "RUNNING, STOPPED, REBOOTING", required = false) statuses: List<String>, @RequestParam(value = "language", required = false, defaultValue = "en") language: String, @RequestParam(name = "page", defaultValue = "0", required = false) page: Int, @RequestParam(name = "pageSize", defaultValue = "10", required = false) pageSize: Int): T
Endpoint used to retrieve the services of a host
Link copied to clipboard
@GetMapping(path = ""/" + STATUS_KEY" )
open fun <T> getServicesStatus(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @RequestParam(name = "services", defaultValue = "") services: List<String>, @RequestParam(value = "language", required = false, defaultValue = "en") language: String): T
Endpoint used to retrieve the current status of the specified services
Link copied to clipboard
open fun initEquinoxEnvironment(context: Class<out Any>, args: Array<String>)
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Link copied to clipboard
protected open fun loadJsonHelper(payload: JSONObject)
Link copied to clipboard
Link copied to clipboard
protected open fun plainResponse(status: ResponseStatus, message: String): String
Link copied to clipboard
@PatchMapping(path = ""/{" + SERVICE_IDENTIFIER_KEY + "}" + REBOOT_ENDPOINT" )
open fun rebootService(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @PathVariable(value = "service_id") serviceId: String, @RequestParam(value = "language", required = false, defaultValue = "en") language: String): String
Endpoint used to reboot a service
Link copied to clipboard
@DeleteMapping(path = "/{" + SERVICE_IDENTIFIER_KEY + "}" )
open fun removeService(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @PathVariable(value = "service_id") serviceId: String, @RequestParam(value = "language", required = false, defaultValue = "en") language: String, @RequestParam(value = "remove_from_the_host", required = false, defaultValue = "false") removeFromTheHost: Boolean): String
Endpoint used to remove a service
Link copied to clipboard
protected open fun sessionExists(sessionId: String): Boolean
Method to check whether a session exists by its id
Link copied to clipboard
protected open fun setSessionLocale(locale: String)
Link copied to clipboard
@PatchMapping(path = ""/{" + SERVICE_IDENTIFIER_KEY + "}" + START_ENDPOINT" )
open fun startService(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @PathVariable(value = "service_id") serviceId: String, @RequestParam(value = "language", required = false, defaultValue = "en") language: String): String
Endpoint used to start a service
Link copied to clipboard
@PatchMapping(path = ""/{" + SERVICE_IDENTIFIER_KEY + "}" + STOP_ENDPOINT" )
open fun stopService(@PathVariable(value = "id") sessionId: String, @PathVariable(value = "host_id") hostId: String, @PathVariable(value = "service_id") serviceId: String, @RequestParam(value = "language", required = false, defaultValue = "en") language: String): String
Endpoint used to stop a service
Link copied to clipboard
protected open fun successResponse(): String
protected open fun <V> successResponse(value: V): HashMap<String, V>
Link copied to clipboard
protected open fun wrongProcedureResponse(): String