service

package
v1.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package service defines the RPC interface for the sansshell Service actions.

Index

Constants

This section is empty.

Variables

View Source
var (
	SystemType_name = map[int32]string{
		0: "SYSTEM_TYPE_UNKNOWN",
		1: "SYSTEM_TYPE_SYSTEMD",
	}
	SystemType_value = map[string]int32{
		"SYSTEM_TYPE_UNKNOWN": 0,
		"SYSTEM_TYPE_SYSTEMD": 1,
	}
)

Enum value maps for SystemType.

View Source
var (
	Status_name = map[int32]string{
		0: "STATUS_UNKNOWN",
		1: "STATUS_RUNNING",
		2: "STATUS_STOPPED",
	}
	Status_value = map[string]int32{
		"STATUS_UNKNOWN": 0,
		"STATUS_RUNNING": 1,
		"STATUS_STOPPED": 2,
	}
)

Enum value maps for Status.

View Source
var (
	Action_name = map[int32]string{
		0: "ACTION_UNKNOWN",
		1: "ACTION_START",
		2: "ACTION_STOP",
		3: "ACTION_RESTART",
		4: "ACTION_ENABLE",
		5: "ACTION_DISABLE",
	}
	Action_value = map[string]int32{
		"ACTION_UNKNOWN": 0,
		"ACTION_START":   1,
		"ACTION_STOP":    2,
		"ACTION_RESTART": 3,
		"ACTION_ENABLE":  4,
		"ACTION_DISABLE": 5,
	}
)

Enum value maps for Action.

View Source
var File_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Service.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "List",
			Handler:    _Service_List_Handler,
		},
		{
			MethodName: "Status",
			Handler:    _Service_Status_Handler,
		},
		{
			MethodName: "Action",
			Handler:    _Service_Action_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Action

type Action int32

An action taken to modify the operational status of a service.

const (
	Action_ACTION_UNKNOWN Action = 0
	Action_ACTION_START   Action = 1
	Action_ACTION_STOP    Action = 2
	Action_ACTION_RESTART Action = 3
	Action_ACTION_ENABLE  Action = 4
	Action_ACTION_DISABLE Action = 5
)

func (Action) Descriptor

func (Action) Descriptor() protoreflect.EnumDescriptor

func (Action) Enum

func (x Action) Enum() *Action

func (Action) EnumDescriptor deprecated

func (Action) EnumDescriptor() ([]byte, []int)

Deprecated: Use Action.Descriptor instead.

func (Action) Number

func (x Action) Number() protoreflect.EnumNumber

func (Action) String

func (x Action) String() string

func (Action) Type

func (Action) Type() protoreflect.EnumType

type ActionManyResponse

type ActionManyResponse struct {
	Target string
	// As targets can be duplicated this is the index into the slice passed to proxy.Conn.
	Index int
	Resp  *ActionReply
	Error error
}

ActionManyResponse encapsulates a proxy data packet. It includes the target, index, response and possible error returned.

type ActionReply

type ActionReply struct {
	SystemType  SystemType `protobuf:"varint,1,opt,name=system_type,json=systemType,proto3,enum=Service.SystemType" json:"system_type,omitempty"`
	ServiceName string     `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
	// contains filtered or unexported fields
}

The result of a request to alter the status of a service.

func (*ActionReply) Descriptor deprecated

func (*ActionReply) Descriptor() ([]byte, []int)

Deprecated: Use ActionReply.ProtoReflect.Descriptor instead.

func (*ActionReply) GetServiceName

func (x *ActionReply) GetServiceName() string

func (*ActionReply) GetSystemType

func (x *ActionReply) GetSystemType() SystemType

func (*ActionReply) ProtoMessage

func (*ActionReply) ProtoMessage()

func (*ActionReply) ProtoReflect

func (x *ActionReply) ProtoReflect() protoreflect.Message

func (*ActionReply) Reset

func (x *ActionReply) Reset()

func (*ActionReply) String

func (x *ActionReply) String() string

type ActionRequest

type ActionRequest struct {
	SystemType  SystemType `protobuf:"varint,1,opt,name=system_type,json=systemType,proto3,enum=Service.SystemType" json:"system_type,omitempty"`
	ServiceName string     `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
	Action      Action     `protobuf:"varint,3,opt,name=action,proto3,enum=Service.Action" json:"action,omitempty"`
	// contains filtered or unexported fields
}

A request to alter the state of a single service.

func (*ActionRequest) Descriptor deprecated

func (*ActionRequest) Descriptor() ([]byte, []int)

Deprecated: Use ActionRequest.ProtoReflect.Descriptor instead.

func (*ActionRequest) GetAction

func (x *ActionRequest) GetAction() Action

func (*ActionRequest) GetServiceName

func (x *ActionRequest) GetServiceName() string

func (*ActionRequest) GetSystemType

func (x *ActionRequest) GetSystemType() SystemType

func (*ActionRequest) ProtoMessage

func (*ActionRequest) ProtoMessage()

func (*ActionRequest) ProtoReflect

func (x *ActionRequest) ProtoReflect() protoreflect.Message

func (*ActionRequest) Reset

func (x *ActionRequest) Reset()

func (*ActionRequest) String

func (x *ActionRequest) String() string

type ListManyResponse

type ListManyResponse struct {
	Target string
	// As targets can be duplicated this is the index into the slice passed to proxy.Conn.
	Index int
	Resp  *ListReply
	Error error
}

ListManyResponse encapsulates a proxy data packet. It includes the target, index, response and possible error returned.

type ListReply

type ListReply struct {
	SystemType SystemType       `protobuf:"varint,1,opt,name=system_type,json=systemType,proto3,enum=Service.SystemType" json:"system_type,omitempty"`
	Services   []*ServiceStatus `protobuf:"bytes,2,rep,name=services,proto3" json:"services,omitempty"`
	// contains filtered or unexported fields
}

A list of all configured services, with their attendent status.

func (*ListReply) Descriptor deprecated

func (*ListReply) Descriptor() ([]byte, []int)

Deprecated: Use ListReply.ProtoReflect.Descriptor instead.

func (*ListReply) GetServices

func (x *ListReply) GetServices() []*ServiceStatus

func (*ListReply) GetSystemType

func (x *ListReply) GetSystemType() SystemType

func (*ListReply) ProtoMessage

func (*ListReply) ProtoMessage()

func (*ListReply) ProtoReflect

func (x *ListReply) ProtoReflect() protoreflect.Message

func (*ListReply) Reset

func (x *ListReply) Reset()

func (*ListReply) String

func (x *ListReply) String() string

type ListRequest

type ListRequest struct {
	SystemType SystemType `protobuf:"varint,1,opt,name=system_type,json=systemType,proto3,enum=Service.SystemType" json:"system_type,omitempty"`
	// contains filtered or unexported fields
}

A request to list all configured services for a single system type.

func (*ListRequest) Descriptor deprecated

func (*ListRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.

func (*ListRequest) GetSystemType

func (x *ListRequest) GetSystemType() SystemType

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) ProtoReflect

func (x *ListRequest) ProtoReflect() protoreflect.Message

func (*ListRequest) Reset

func (x *ListRequest) Reset()

func (*ListRequest) String

func (x *ListRequest) String() string

type ServiceClient

type ServiceClient interface {
	// List returns a list of services with attendent status.
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListReply, error)
	// Status requests the status of a single service.
	Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error)
	// Action alters the status of a single service. This will always force the
	// requested state to happen regardless of current state.
	Action(ctx context.Context, in *ActionRequest, opts ...grpc.CallOption) (*ActionReply, error)
}

ServiceClient is the client API for Service service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceClientProxy

type ServiceClientProxy interface {
	ServiceClient
	ListOneMany(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (<-chan *ListManyResponse, error)
	StatusOneMany(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (<-chan *StatusManyResponse, error)
	ActionOneMany(ctx context.Context, in *ActionRequest, opts ...grpc.CallOption) (<-chan *ActionManyResponse, error)
}

ServiceClientProxy is the superset of ServiceClient which additionally includes the OneMany proxy methods

func NewServiceClientProxy

func NewServiceClientProxy(cc *proxy.Conn) ServiceClientProxy

NewServiceClientProxy creates a ServiceClientProxy for use in proxied connections. NOTE: This takes a proxy.Conn instead of a generic ClientConnInterface as the methods here are only valid in proxy.Conn contexts.

type ServiceServer

type ServiceServer interface {
	// List returns a list of services with attendent status.
	List(context.Context, *ListRequest) (*ListReply, error)
	// Status requests the status of a single service.
	Status(context.Context, *StatusRequest) (*StatusReply, error)
	// Action alters the status of a single service. This will always force the
	// requested state to happen regardless of current state.
	Action(context.Context, *ActionRequest) (*ActionReply, error)
}

ServiceServer is the server API for Service service. All implementations should embed UnimplementedServiceServer for forward compatibility

type ServiceStatus

type ServiceStatus struct {
	ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
	Status      Status `protobuf:"varint,2,opt,name=status,proto3,enum=Service.Status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

ServiceStatus pairs a service with it's current status.

func (*ServiceStatus) Descriptor deprecated

func (*ServiceStatus) Descriptor() ([]byte, []int)

Deprecated: Use ServiceStatus.ProtoReflect.Descriptor instead.

func (*ServiceStatus) GetServiceName

func (x *ServiceStatus) GetServiceName() string

func (*ServiceStatus) GetStatus

func (x *ServiceStatus) GetStatus() Status

func (*ServiceStatus) ProtoMessage

func (*ServiceStatus) ProtoMessage()

func (*ServiceStatus) ProtoReflect

func (x *ServiceStatus) ProtoReflect() protoreflect.Message

func (*ServiceStatus) Reset

func (x *ServiceStatus) Reset()

func (*ServiceStatus) String

func (x *ServiceStatus) String() string

type Status

type Status int32

The operational status of the service.

const (
	Status_STATUS_UNKNOWN Status = 0
	Status_STATUS_RUNNING Status = 1
	Status_STATUS_STOPPED Status = 2
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type StatusManyResponse

type StatusManyResponse struct {
	Target string
	// As targets can be duplicated this is the index into the slice passed to proxy.Conn.
	Index int
	Resp  *StatusReply
	Error error
}

StatusManyResponse encapsulates a proxy data packet. It includes the target, index, response and possible error returned.

type StatusReply

type StatusReply struct {
	SystemType    SystemType     `protobuf:"varint,1,opt,name=system_type,json=systemType,proto3,enum=Service.SystemType" json:"system_type,omitempty"`
	ServiceStatus *ServiceStatus `protobuf:"bytes,2,opt,name=service_status,json=serviceStatus,proto3" json:"service_status,omitempty"`
	// contains filtered or unexported fields
}

A StatusReply contains the operational status of a single service.

func (*StatusReply) Descriptor deprecated

func (*StatusReply) Descriptor() ([]byte, []int)

Deprecated: Use StatusReply.ProtoReflect.Descriptor instead.

func (*StatusReply) GetServiceStatus

func (x *StatusReply) GetServiceStatus() *ServiceStatus

func (*StatusReply) GetSystemType

func (x *StatusReply) GetSystemType() SystemType

func (*StatusReply) ProtoMessage

func (*StatusReply) ProtoMessage()

func (*StatusReply) ProtoReflect

func (x *StatusReply) ProtoReflect() protoreflect.Message

func (*StatusReply) Reset

func (x *StatusReply) Reset()

func (*StatusReply) String

func (x *StatusReply) String() string

type StatusRequest

type StatusRequest struct {
	SystemType  SystemType `protobuf:"varint,1,opt,name=system_type,json=systemType,proto3,enum=Service.SystemType" json:"system_type,omitempty"`
	ServiceName string     `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
	// contains filtered or unexported fields
}

A request to list the status of a single service.

func (*StatusRequest) Descriptor deprecated

func (*StatusRequest) Descriptor() ([]byte, []int)

Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.

func (*StatusRequest) GetServiceName

func (x *StatusRequest) GetServiceName() string

func (*StatusRequest) GetSystemType

func (x *StatusRequest) GetSystemType() SystemType

func (*StatusRequest) ProtoMessage

func (*StatusRequest) ProtoMessage()

func (*StatusRequest) ProtoReflect

func (x *StatusRequest) ProtoReflect() protoreflect.Message

func (*StatusRequest) Reset

func (x *StatusRequest) Reset()

func (*StatusRequest) String

func (x *StatusRequest) String() string

type SystemType

type SystemType int32

A SystemType specifies the service management system on which to operate. The 'unknown' value, if specified in a request, will map to an appropriate implementation-defined default for the system running SansShell.

const (
	SystemType_SYSTEM_TYPE_UNKNOWN SystemType = 0
	SystemType_SYSTEM_TYPE_SYSTEMD SystemType = 1
)

func (SystemType) Descriptor

func (SystemType) Descriptor() protoreflect.EnumDescriptor

func (SystemType) Enum

func (x SystemType) Enum() *SystemType

func (SystemType) EnumDescriptor deprecated

func (SystemType) EnumDescriptor() ([]byte, []int)

Deprecated: Use SystemType.Descriptor instead.

func (SystemType) Number

func (x SystemType) Number() protoreflect.EnumNumber

func (SystemType) String

func (x SystemType) String() string

func (SystemType) Type

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) Action

func (UnimplementedServiceServer) List

func (UnimplementedServiceServer) Status

type UnsafeServiceServer

type UnsafeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.

Directories

Path Synopsis
Package client provides the client interface for 'service'
Package client provides the client interface for 'service'
Package server implements the sansshell 'Service' service.
Package server implements the sansshell 'Service' service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL