50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package app
|
|
|
|
import "strings"
|
|
|
|
type transportUnsupportedRuntimeBackend struct {
|
|
mode string
|
|
}
|
|
|
|
func (b transportUnsupportedRuntimeBackend) ID() string {
|
|
return "unsupported"
|
|
}
|
|
|
|
type transportMockBackend struct{}
|
|
|
|
func (transportMockBackend) ID() string { return "mock" }
|
|
|
|
func (transportMockBackend) Action(_ TransportClient, action string) transportBackendActionResult {
|
|
action = strings.ToLower(strings.TrimSpace(action))
|
|
return transportBackendActionResult{
|
|
OK: true,
|
|
ExitCode: 0,
|
|
Message: "mock backend " + action + " done",
|
|
}
|
|
}
|
|
|
|
func (transportMockBackend) Health(client TransportClient) transportBackendHealthResult {
|
|
status := normalizeTransportStatus(client.Status)
|
|
return transportBackendHealthResult{
|
|
OK: true,
|
|
Status: status,
|
|
LatencyMS: client.Health.LatencyMS,
|
|
}
|
|
}
|
|
|
|
func (transportMockBackend) Provision(client TransportClient) transportBackendActionResult {
|
|
return transportBackendActionResult{
|
|
OK: true,
|
|
ExitCode: 0,
|
|
Message: "mock backend provision skipped for " + client.ID,
|
|
}
|
|
}
|
|
|
|
func (transportMockBackend) Cleanup(client TransportClient) transportBackendActionResult {
|
|
return transportBackendActionResult{
|
|
OK: true,
|
|
ExitCode: 0,
|
|
Message: "no cleanup required for backend mock (" + client.ID + ")",
|
|
}
|
|
}
|