controller_exec

package
v0.45.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 17 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",
	}
	ControllerStatus_value = map[string]int32{
		"ControllerStatus_UNKNOWN":     0,
		"ControllerStatus_CONFIGURING": 1,
		"ControllerStatus_RUNNING":     2,
		"ControllerStatus_ERROR":       3,
	}
)

Enum value maps for ControllerStatus.

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) Enum added in v0.10.1

func (ControllerStatus) MarshalJSON added in v0.41.0

func (x ControllerStatus) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerStatus to JSON.

func (ControllerStatus) MarshalProtoJSON added in v0.41.0

func (x ControllerStatus) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerStatus to JSON.

func (ControllerStatus) MarshalProtoText added in v0.42.0

func (x ControllerStatus) MarshalProtoText() string

func (ControllerStatus) MarshalText added in v0.41.0

func (x ControllerStatus) MarshalText() ([]byte, error)

MarshalText marshals the ControllerStatus to text.

func (ControllerStatus) String

func (x ControllerStatus) String() string

func (*ControllerStatus) UnmarshalJSON added in v0.41.0

func (x *ControllerStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerStatus from JSON.

func (*ControllerStatus) UnmarshalProtoJSON added in v0.41.0

func (x *ControllerStatus) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerStatus from JSON.

func (*ControllerStatus) UnmarshalText added in v0.41.0

func (x *ControllerStatus) UnmarshalText(b []byte) error

UnmarshalText unmarshals the ControllerStatus from text.

type ExecControllerRequest

type ExecControllerRequest struct {

	// ConfigSet is the controller config set to execute.
	ConfigSet *proto.ConfigSet `protobuf:"bytes,1,opt,name=config_set,json=configSet,proto3" json:"configSet,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:"configSetYaml,omitempty"`
	// ConfigSetYamlOverwrite sets if the yaml portion overwrites the proto portion.
	ConfigSetYamlOverwrite bool `` /* 129-byte string literal not displayed */
	// contains filtered or unexported fields
}

ExecControllerRequest is a protobuf request to execute a controller.

func ExecControllerProtoFromConfigSet added in v0.8.7

func ExecControllerProtoFromConfigSet(cs configset.ConfigSet) (*ExecControllerRequest, error)

ExecControllerProtoFromConfigSet converts a config set to a ExecControllerRequest w/ proto.

func ExecControllerYAMLFromConfigSet added in v0.8.7

func ExecControllerYAMLFromConfigSet(cs configset.ConfigSet) (*ExecControllerRequest, error)

ExecControllerYAMLFromConfigSet converts a config set to a ExecControllerRequest w/ YAML.

func (*ExecControllerRequest) CloneMessageVT added in v0.23.6

func (*ExecControllerRequest) CloneVT added in v0.12.3

func (*ExecControllerRequest) EqualMessageVT added in v0.23.6

func (this *ExecControllerRequest) EqualMessageVT(thatMsg any) bool

func (*ExecControllerRequest) EqualVT added in v0.10.0

func (this *ExecControllerRequest) EqualVT(that *ExecControllerRequest) bool

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 (x *ExecControllerRequest) GetConfigSet() *proto.ConfigSet

func (*ExecControllerRequest) GetConfigSetYaml

func (x *ExecControllerRequest) GetConfigSetYaml() string

func (*ExecControllerRequest) GetConfigSetYamlOverwrite

func (x *ExecControllerRequest) GetConfigSetYamlOverwrite() bool

func (*ExecControllerRequest) IsNil added in v0.26.0

func (r *ExecControllerRequest) IsNil() bool

IsNil checks if the object is nil.

func (*ExecControllerRequest) MarshalJSON added in v0.41.0

func (x *ExecControllerRequest) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ExecControllerRequest to JSON.

func (*ExecControllerRequest) MarshalProtoJSON added in v0.41.0

func (x *ExecControllerRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ExecControllerRequest message to JSON.

func (*ExecControllerRequest) MarshalProtoText added in v0.42.0

func (x *ExecControllerRequest) MarshalProtoText() string

func (*ExecControllerRequest) MarshalToSizedBufferVT added in v0.10.0

func (m *ExecControllerRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ExecControllerRequest) MarshalToVT added in v0.10.0

func (m *ExecControllerRequest) MarshalToVT(dAtA []byte) (int, error)

func (*ExecControllerRequest) MarshalVT added in v0.10.0

func (m *ExecControllerRequest) MarshalVT() (dAtA []byte, err error)

func (*ExecControllerRequest) ProtoMessage

func (*ExecControllerRequest) ProtoMessage()

func (*ExecControllerRequest) Reset

func (x *ExecControllerRequest) Reset()

func (*ExecControllerRequest) SizeVT added in v0.10.0

func (m *ExecControllerRequest) SizeVT() (n int)

func (*ExecControllerRequest) String

func (x *ExecControllerRequest) String() string

func (*ExecControllerRequest) UnmarshalJSON added in v0.41.0

func (x *ExecControllerRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ExecControllerRequest from JSON.

func (*ExecControllerRequest) UnmarshalProtoJSON added in v0.41.0

func (x *ExecControllerRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ExecControllerRequest message from JSON.

func (*ExecControllerRequest) UnmarshalVT added in v0.10.0

func (m *ExecControllerRequest) UnmarshalVT(dAtA []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" json:"status,omitempty"`
	// ControllerInfo may contain the running controller info.
	ControllerInfo *controller.Info `protobuf:"bytes,3,opt,name=controller_info,json=controllerInfo,proto3" json:"controllerInfo,omitempty"`
	// ErrorInfo may contain the error information.
	ErrorInfo string `protobuf:"bytes,4,opt,name=error_info,json=errorInfo,proto3" json:"errorInfo,omitempty"`
	// contains filtered or unexported fields
}

ExecControllerResponse is a protobuf response stream.

func (*ExecControllerResponse) CloneMessageVT added in v0.23.6

func (*ExecControllerResponse) CloneVT added in v0.12.3

func (*ExecControllerResponse) EqualMessageVT added in v0.23.6

func (this *ExecControllerResponse) EqualMessageVT(thatMsg any) bool

func (*ExecControllerResponse) EqualVT added in v0.10.0

func (this *ExecControllerResponse) EqualVT(that *ExecControllerResponse) bool

func (*ExecControllerResponse) FormatLogString added in v0.24.0

func (e *ExecControllerResponse) FormatLogString() string

FormatLogString formats a log string with info from the response.

func (*ExecControllerResponse) GetControllerInfo

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

func (*ExecControllerResponse) GetError added in v0.8.7

func (e *ExecControllerResponse) GetError() error

GetError returns an error if the response indicated one, or nil for success.

If no error info was provided, assumes ErrAllControllersFailed

func (*ExecControllerResponse) GetErrorInfo

func (x *ExecControllerResponse) GetErrorInfo() string

func (*ExecControllerResponse) GetId

func (x *ExecControllerResponse) GetId() string

func (*ExecControllerResponse) GetStatus

func (*ExecControllerResponse) MarshalJSON added in v0.41.0

func (x *ExecControllerResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ExecControllerResponse to JSON.

func (*ExecControllerResponse) MarshalProtoJSON added in v0.41.0

func (x *ExecControllerResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ExecControllerResponse message to JSON.

func (*ExecControllerResponse) MarshalProtoText added in v0.42.0

func (x *ExecControllerResponse) MarshalProtoText() string

func (*ExecControllerResponse) MarshalToSizedBufferVT added in v0.10.0

func (m *ExecControllerResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ExecControllerResponse) MarshalToVT added in v0.10.0

func (m *ExecControllerResponse) MarshalToVT(dAtA []byte) (int, error)

func (*ExecControllerResponse) MarshalVT added in v0.10.0

func (m *ExecControllerResponse) MarshalVT() (dAtA []byte, err error)

func (*ExecControllerResponse) ProtoMessage

func (*ExecControllerResponse) ProtoMessage()

func (*ExecControllerResponse) Reset

func (x *ExecControllerResponse) Reset()

func (*ExecControllerResponse) SizeVT added in v0.10.0

func (m *ExecControllerResponse) SizeVT() (n int)

func (*ExecControllerResponse) String

func (x *ExecControllerResponse) String() string

func (*ExecControllerResponse) UnmarshalJSON added in v0.41.0

func (x *ExecControllerResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ExecControllerResponse from JSON.

func (*ExecControllerResponse) UnmarshalProtoJSON added in v0.41.0

func (x *ExecControllerResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ExecControllerResponse message from JSON.

func (*ExecControllerResponse) UnmarshalVT added in v0.10.0

func (m *ExecControllerResponse) UnmarshalVT(dAtA []byte) error

Jump to

Keyboard shortcuts

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