v0_bulk_command_api

package
v0.0.0-...-86958d0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceIdIpReplacementPrefix = "<<<"
	ServiceIdIpReplacementSuffix = ">>>"
)

Variables

This section is empty.

Functions

func EncodeServiceIdForIpReplacement

func EncodeServiceIdForIpReplacement(serviceId string) string

Used to encode a service ID to a string that can be embedded in commands, and which the API container will replace

with the IP address of the service at runtime

Types

type V0BulkCommands

type V0BulkCommands struct {
	Commands []V0SerializableCommand `json:"commands"`
}

type V0CommandType

type V0CommandType string
const (
	// vvvvvvvvvvvvvvvvvvvv Update the visitor whenever you add an enum value!!! vvvvvvvvvvvvvvvvvvvvvvvvvvv
	LoadModuleCommandType                          V0CommandType = "LOAD_MODULE"
	ExecuteModuleCommandType                       V0CommandType = "EXECUTE_MODULE"
	RegisterServiceCommandType                     V0CommandType = "REGISTER_SERVICE"
	StartServiceCommandType                        V0CommandType = "START_SERVICE"
	RemoveServiceCommandType                       V0CommandType = "REMOVE_SERVICE"
	RepartitionCommandType                         V0CommandType = "REPARTITION"
	ExecCommandCommandType                         V0CommandType = "EXEC_COMMAND"
	WaitForHttpGetEndpointAvailabilityCommandType  V0CommandType = "WAIT_FOR_HTTP_GET_ENDPOINT_AVAILABILITY"
	WaitForHttpPostEndpointAvailabilityCommandType V0CommandType = "WAIT_FOR_HTTP_POST_ENDPOINT_AVAILABILITY"
	ExecuteBulkCommandsCommandType                 V0CommandType = "EXECUTE_BULK_COMMANDS"
	GetServicesCommandType                         V0CommandType = "GET_SERVICES"
	GetModulesCommandType                          V0CommandType = "GET_MODULES"
)

func (V0CommandType) AcceptVisitor

func (commandType V0CommandType) AcceptVisitor(visitor V0CommandTypeVisitor) error

type V0CommandTypeVisitor

type V0CommandTypeVisitor interface {
	VisitLoadModule() error
	VisitExecuteModule() error
	VisitRegisterService() error
	VisitStartService() error
	VisitRemoveService() error
	VisitRepartition() error
	VisitExecCommand() error
	VisitWaitForHttpGetEndpointAvailability() error
	VisitWaitForHttpPostEndpointAvailability() error
	VisitExecuteBulkCommands() error
	VisitGetServices() error
	VisitGetModules() error
}

We provide a visitor interface here so that:

  1. all enum cases can be exhaustively handled
  2. any changes in the enum will result in a compile break

type V0SerializableCommand

type V0SerializableCommand struct {
	Type V0CommandType `json:"type"`

	// The only allowed objects here are from the bindings generated from the .proto file
	ArgsPtr proto.Message `json:"args"`
}

Used for serializing

func (*V0SerializableCommand) UnmarshalJSON

func (cmd *V0SerializableCommand) UnmarshalJSON(bytes []byte) error

A V0SerializableCommand knows how to deserialize itself, thanks to the "type" tag

Jump to

Keyboard shortcuts

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