2023-03-28 23:48:58 +01:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 09:12:13 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 23:48:58 +01:00
|
|
|
|
2022-11-01 15:03:23 -04:00
|
|
|
package service
|
|
|
|
|
2023-02-14 14:22:09 -08:00
|
|
|
import (
|
|
|
|
"context"
|
2023-02-24 14:57:44 -06:00
|
|
|
|
2023-02-14 14:22:09 -08:00
|
|
|
"github.com/hashicorp/consul/api"
|
|
|
|
)
|
2023-01-04 15:28:15 -05:00
|
|
|
|
2022-11-01 15:03:23 -04:00
|
|
|
// Service represents a process that will be registered with the
|
|
|
|
// Consul catalog, including Consul components such as sidecars and gateways
|
|
|
|
type Service interface {
|
2023-02-14 14:22:09 -08:00
|
|
|
Exec(ctx context.Context, cmd []string) (string, error)
|
2023-01-04 15:28:15 -05:00
|
|
|
// Export a service to the peering cluster
|
|
|
|
Export(partition, peer string, client *api.Client) error
|
2023-01-20 17:02:44 -05:00
|
|
|
GetAddr() (string, int)
|
2023-02-22 10:22:25 -05:00
|
|
|
GetAddrs() (string, []int)
|
2023-02-24 14:57:44 -06:00
|
|
|
GetPort(port int) (int, error)
|
2023-02-14 14:22:09 -08:00
|
|
|
// GetAdminAddr returns the external admin address
|
2023-01-18 16:13:55 -05:00
|
|
|
GetAdminAddr() (string, int)
|
2023-01-20 17:02:44 -05:00
|
|
|
GetLogs() (string, error)
|
|
|
|
GetName() string
|
|
|
|
GetServiceName() string
|
|
|
|
Start() (err error)
|
2023-02-15 10:26:43 -05:00
|
|
|
Stop() (err error)
|
2023-01-20 17:02:44 -05:00
|
|
|
Terminate() error
|
2023-01-27 11:25:48 -05:00
|
|
|
Restart() error
|
2023-02-01 10:48:54 -05:00
|
|
|
GetStatus() (string, error)
|
2022-11-01 15:03:23 -04:00
|
|
|
}
|