Documentation ¶
Index ¶
Constants ¶
View Source
const AgentPlatformConnector = "connector"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector interface { // List lists all containers running on the host. List(ctx context.Context) ([]Container, error) // Start starts the agent for the container with the given ID. Start(ctx context.Context, id string, name string) // Stop stops the agent for the container with the given ID. Stop(ctx context.Context, id string) // Listen listens for events and starts or stops the agent for the container that was created or removed. Listen(ctx context.Context) error }
Connector is an interface that defines the methods that a connector must implement.
type Container ¶
type Container struct { // ID is the container ID. ID string // Name is the container name. Name string // ServerAddress is the ShellHub address of the server that the agent will connect to. ServerAddress string // Tenant is the tenant ID of the namespace that the agent belongs to. Tenant string // PrivateKey is the private key of the device. Specify the path to store the container private key. If not // provided, the agent will generate a new one. This is required. PrivateKey string // Cancel is a function that is used to stop the goroutine that is running the agent for this container. Cancel context.CancelFunc }
Container is a struct that represents a container that will be managed by the connector.
type DockerConnector ¶
type DockerConnector struct {
// contains filtered or unexported fields
}
DockerConnector is a struct that represents a connector that uses Docker as the container runtime.
func (*DockerConnector) List ¶
func (d *DockerConnector) List(ctx context.Context) ([]Container, error)
func (*DockerConnector) Listen ¶
func (d *DockerConnector) Listen(ctx context.Context) error
Listen listens for events and starts or stops the agent for the containers.
Click to show internal directories.
Click to hide internal directories.