controller_exec

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ControllerStatus_name = map[int32]string{
	0: "ControllerStatus_UNKNOWN",
	1: "ControllerStatus_CONFIGURING",
	2: "ControllerStatus_RUNNING",
	3: "ControllerStatus_ERROR",
}
View Source
var ControllerStatus_value = map[string]int32{
	"ControllerStatus_UNKNOWN":     0,
	"ControllerStatus_CONFIGURING": 1,
	"ControllerStatus_RUNNING":     2,
	"ControllerStatus_ERROR":       3,
}
View Source
var ErrAllControllersFailed = errors.New("all controller configurations failed")

ErrAllControllersFailed is returned if all controller configs failed to run.

Functions

func ExecuteController

func ExecuteController(
	ctx context.Context,
	cbus bus.Bus,
	conf config.Config,
	cb func(ControllerStatus),
) error

ExecuteController executes a controller and calls the callback with state.

Note: any ERROR state will return immediately after calling cb(). Some terminal error states may exit without calling cb().

Types

type ControllerStatus

type ControllerStatus int32

ControllerStatus holds basic status for a controller.

const (
	// ControllerStatus_UNKNOWN is unrecognized.
	ControllerStatus_ControllerStatus_UNKNOWN ControllerStatus = 0
	// ControllerStatus_CONFIGURING indicates the controller is configuring.
	ControllerStatus_ControllerStatus_CONFIGURING ControllerStatus = 1
	// ControllerStatus_RUNNING indicates the controller is running.
	ControllerStatus_ControllerStatus_RUNNING ControllerStatus = 2
	// ControllerStatus_ERROR indicates the controller is terminated with an error.
	ControllerStatus_ControllerStatus_ERROR ControllerStatus = 3
)

func (ControllerStatus) EnumDescriptor

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

func (ControllerStatus) String

func (x ControllerStatus) String() string

type ExecControllerRequest

type ExecControllerRequest struct {
	// ConfigSet is the controller config set to execute.
	ConfigSet *proto1.ConfigSet `protobuf:"bytes,1,opt,name=config_set,json=configSet,proto3" json:"config_set,omitempty"`
	// ConfigSetYaml is optionally the YAML form of config_set to parse.
	// Merged with config_set.
	ConfigSetYaml string `protobuf:"bytes,2,opt,name=config_set_yaml,json=configSetYaml,proto3" json:"config_set_yaml,omitempty"`
	// ConfigSetYamlOverwrite sets if the yaml portion overwrites the proto portion.
	ConfigSetYamlOverwrite bool     `` /* 132-byte string literal not displayed */
	XXX_NoUnkeyedLiteral   struct{} `json:"-"`
	XXX_unrecognized       []byte   `json:"-"`
	XXX_sizecache          int32    `json:"-"`
}

ExecControllerRequest is a protobuf request to execute a controller.

func (*ExecControllerRequest) Descriptor

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

func (*ExecControllerRequest) Execute

func (r *ExecControllerRequest) Execute(
	ctx context.Context,
	cbus bus.Bus,
	allowPartialSuccess bool,
	cb func(*ExecControllerResponse) error,
) error

Execute executes the request to apply a config set. Cb should not hold ExecControllerResponse after returning.

func (*ExecControllerRequest) GetConfigSet

func (m *ExecControllerRequest) GetConfigSet() *proto1.ConfigSet

func (*ExecControllerRequest) GetConfigSetYaml

func (m *ExecControllerRequest) GetConfigSetYaml() string

func (*ExecControllerRequest) GetConfigSetYamlOverwrite

func (m *ExecControllerRequest) GetConfigSetYamlOverwrite() bool

func (*ExecControllerRequest) ProtoMessage

func (*ExecControllerRequest) ProtoMessage()

func (*ExecControllerRequest) Reset

func (m *ExecControllerRequest) Reset()

func (*ExecControllerRequest) String

func (m *ExecControllerRequest) String() string

func (*ExecControllerRequest) XXX_DiscardUnknown

func (m *ExecControllerRequest) XXX_DiscardUnknown()

func (*ExecControllerRequest) XXX_Marshal

func (m *ExecControllerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExecControllerRequest) XXX_Merge

func (m *ExecControllerRequest) XXX_Merge(src proto.Message)

func (*ExecControllerRequest) XXX_Size

func (m *ExecControllerRequest) XXX_Size() int

func (*ExecControllerRequest) XXX_Unmarshal

func (m *ExecControllerRequest) XXX_Unmarshal(b []byte) error

type ExecControllerResponse

type ExecControllerResponse struct {
	// Id is the configset identifier for this status report.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Status is the controller execution status.
	Status ControllerStatus `protobuf:"varint,2,opt,name=status,proto3,enum=controller.exec.ControllerStatus" json:"status,omitempty"`
	// ControllerInfo may contain the running controller info.
	ControllerInfo *controller.Info `protobuf:"bytes,3,opt,name=controller_info,json=controllerInfo,proto3" json:"controller_info,omitempty"`
	// ErrorInfo may contain the error information.
	ErrorInfo            string   `protobuf:"bytes,4,opt,name=error_info,json=errorInfo,proto3" json:"error_info,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ExecControllerResponse is a protobuf response stream.

func (*ExecControllerResponse) Descriptor

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

func (*ExecControllerResponse) GetControllerInfo

func (m *ExecControllerResponse) GetControllerInfo() *controller.Info

func (*ExecControllerResponse) GetErrorInfo

func (m *ExecControllerResponse) GetErrorInfo() string

func (*ExecControllerResponse) GetId

func (m *ExecControllerResponse) GetId() string

func (*ExecControllerResponse) GetStatus

func (*ExecControllerResponse) ProtoMessage

func (*ExecControllerResponse) ProtoMessage()

func (*ExecControllerResponse) Reset

func (m *ExecControllerResponse) Reset()

func (*ExecControllerResponse) String

func (m *ExecControllerResponse) String() string

func (*ExecControllerResponse) XXX_DiscardUnknown

func (m *ExecControllerResponse) XXX_DiscardUnknown()

func (*ExecControllerResponse) XXX_Marshal

func (m *ExecControllerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExecControllerResponse) XXX_Merge

func (m *ExecControllerResponse) XXX_Merge(src proto.Message)

func (*ExecControllerResponse) XXX_Size

func (m *ExecControllerResponse) XXX_Size() int

func (*ExecControllerResponse) XXX_Unmarshal

func (m *ExecControllerResponse) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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