2023-06-23 11:22:07 +00:00
|
|
|
package operations
|
|
|
|
|
|
|
|
import (
|
|
|
|
. "github.com/reiver/greatape/components/api/protobuf"
|
|
|
|
. "github.com/reiver/greatape/components/api/services"
|
2023-06-26 07:50:54 +00:00
|
|
|
. "github.com/reiver/greatape/components/constants"
|
2023-06-23 11:22:07 +00:00
|
|
|
. "github.com/reiver/greatape/components/contracts"
|
|
|
|
. "github.com/xeronith/diamante/contracts/operation"
|
|
|
|
. "github.com/xeronith/diamante/contracts/service"
|
|
|
|
. "github.com/xeronith/diamante/contracts/system"
|
|
|
|
. "github.com/xeronith/diamante/operation"
|
|
|
|
)
|
|
|
|
|
2023-06-26 07:50:54 +00:00
|
|
|
type (
|
|
|
|
GetServerConfigurationRunner func(IContext, *GetServerConfigurationRequest) (*GetServerConfigurationResult, error)
|
|
|
|
GetServerConfigurationRunners []GetServerConfigurationRunner
|
2023-06-23 11:22:07 +00:00
|
|
|
|
2023-06-26 07:50:54 +00:00
|
|
|
getServerConfigurationOperation struct {
|
|
|
|
Operation
|
|
|
|
|
|
|
|
runners GetServerConfigurationRunners
|
|
|
|
}
|
|
|
|
)
|
2023-06-23 11:22:07 +00:00
|
|
|
|
|
|
|
func GetServerConfigurationOperation() IOperation {
|
|
|
|
return &getServerConfigurationOperation{
|
2023-06-26 07:50:54 +00:00
|
|
|
runners: GetServerConfigurationRunners{
|
|
|
|
GetServerConfigurationService,
|
|
|
|
},
|
2023-06-23 11:22:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-26 07:50:54 +00:00
|
|
|
func (operation *getServerConfigurationOperation) Tag() string {
|
|
|
|
return "GET_SERVER_CONFIGURATION"
|
|
|
|
}
|
|
|
|
|
2023-06-23 11:22:07 +00:00
|
|
|
func (operation *getServerConfigurationOperation) Id() (ID, ID) {
|
|
|
|
return GET_SERVER_CONFIGURATION_REQUEST, GET_SERVER_CONFIGURATION_RESULT
|
|
|
|
}
|
|
|
|
|
|
|
|
func (operation *getServerConfigurationOperation) InputContainer() Pointer {
|
|
|
|
return new(GetServerConfigurationRequest)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (operation *getServerConfigurationOperation) OutputContainer() Pointer {
|
|
|
|
return new(GetServerConfigurationResult)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (operation *getServerConfigurationOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
2023-06-26 07:50:54 +00:00
|
|
|
if len(operation.runners) <= int(operation.ActiveRunner()) {
|
|
|
|
return nil, ERROR_OPERATION_RUNNER_NOT_AVAILABLE
|
|
|
|
}
|
|
|
|
|
|
|
|
service := operation.runners[operation.ActiveRunner()]
|
|
|
|
if input, valid := payload.(*GetServerConfigurationRequest); valid {
|
|
|
|
return service(context, input)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil, ERROR_OPERATION_PAYLOAD_NOT_SUPPORTED
|
2023-06-23 11:22:07 +00:00
|
|
|
}
|