mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: update api.ServiceClient interface to include service creation and removal
This commit is contained in:
@@ -45,7 +45,9 @@ type MachineClient interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ServiceClient interface {
|
type ServiceClient interface {
|
||||||
|
RunService(ctx context.Context, spec ServiceSpec) (RunServiceResponse, error)
|
||||||
InspectService(ctx context.Context, id string) (Service, error)
|
InspectService(ctx context.Context, id string) (Service, error)
|
||||||
|
RemoveService(ctx context.Context, id string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type VolumeClient interface {
|
type VolumeClient interface {
|
||||||
|
|||||||
@@ -253,6 +253,11 @@ func (e EnvVars) ToSlice() []string {
|
|||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RunServiceResponse struct {
|
||||||
|
ID string
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
ID string
|
ID string
|
||||||
Name string
|
Name string
|
||||||
|
|||||||
@@ -18,13 +18,8 @@ import (
|
|||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RunServiceResponse struct {
|
func (cli *Client) RunService(ctx context.Context, spec api.ServiceSpec) (api.RunServiceResponse, error) {
|
||||||
ID string
|
var resp api.RunServiceResponse
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cli *Client) RunService(ctx context.Context, spec api.ServiceSpec) (RunServiceResponse, error) {
|
|
||||||
var resp RunServiceResponse
|
|
||||||
|
|
||||||
if err := spec.Validate(); err != nil {
|
if err := spec.Validate(); err != nil {
|
||||||
return resp, fmt.Errorf("invalid service spec: %w", err)
|
return resp, fmt.Errorf("invalid service spec: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user