first commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package dto
|
||||
|
||||
import "browser.local/platform/domain"
|
||||
|
||||
type ServerLifecycleCreateRequest struct {
|
||||
ID string `json:"id"`
|
||||
PluginID string `json:"pluginId"`
|
||||
RunEndpointID string `json:"runEndpointId"`
|
||||
Name string `json:"name"`
|
||||
OwnerUserID string `json:"ownerUserId,omitempty"`
|
||||
IdempotencyKey string `json:"idempotencyKey"`
|
||||
}
|
||||
|
||||
type ServerLifecycleCommandRequest struct {
|
||||
ExpectedConfigVersion int `json:"expectedConfigVersion"`
|
||||
IdempotencyKey string `json:"idempotencyKey"`
|
||||
}
|
||||
|
||||
type ServerLifecycleResponse struct {
|
||||
Accepted bool `json:"accepted"`
|
||||
Action domain.ServerLifecycleAction `json:"action"`
|
||||
Instance ServerInstanceResponse `json:"instance"`
|
||||
Job JobResponse `json:"job"`
|
||||
}
|
||||
|
||||
func (request ServerLifecycleCreateRequest) ToDomain() domain.ServerLifecycleCreate {
|
||||
return domain.ServerLifecycleCreate{
|
||||
ID: request.ID,
|
||||
PluginID: request.PluginID,
|
||||
RunEndpointID: request.RunEndpointID,
|
||||
Name: request.Name,
|
||||
OwnerUserID: request.OwnerUserID,
|
||||
IdempotencyKey: request.IdempotencyKey,
|
||||
}
|
||||
}
|
||||
|
||||
func (request ServerLifecycleCommandRequest) ToDomain(serverInstanceID string) domain.ServerLifecycleCommand {
|
||||
return domain.ServerLifecycleCommand{
|
||||
ServerInstanceID: serverInstanceID,
|
||||
ExpectedConfigVersion: request.ExpectedConfigVersion,
|
||||
IdempotencyKey: request.IdempotencyKey,
|
||||
}
|
||||
}
|
||||
|
||||
func ServerLifecycleFromDomain(result domain.ServerLifecycleResult) ServerLifecycleResponse {
|
||||
result = domain.CopyServerLifecycleResult(result)
|
||||
return ServerLifecycleResponse{
|
||||
Accepted: result.Accepted,
|
||||
Action: result.Action,
|
||||
Instance: ServerInstanceFromDomain(result.Instance),
|
||||
Job: JobFromDomain(result.Job),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user