instance

package
v0.0.0-...-8b0e3ae Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateInstanceRequest

type CreateInstanceRequest struct {
	ID       string
	Provider string
	Owner    string
	Device   string
}

CreateInstanceRequest describes the params for creating an instance

type Instance

type Instance struct {
	ID       string
	Provider *provider.Provider
	Services Services
	Owner    string
	Device   string
}

Instance is a open-copilot managed instance

func CreateInstance

func CreateInstance(consulClient *consul.Client, vaultClient *vault.Client, instanceParams CreateInstanceRequest) (*Instance, error)

CreateInstance creates the key/value pairs for a new instance in Consul

func NewInstance

func NewInstance(consulClient *consul.Client, id string) (*Instance, error)

NewInstance returns a new instance

func (*Instance) AddService

func (i *Instance) AddService(consulClient *consul.Client, service, config string) (*Instance, error)

AddService adds a service in consul

func (*Instance) ConfigureService

func (i *Instance) ConfigureService(consulClient *consul.Client, serviceType, config string) (*Service, error)

ConfigureService sets the configuration for a service in Consul

func (*Instance) DestroyInstance

func (i *Instance) DestroyInstance(consulClient *consul.Client, vaultClient *vault.Client) error

DestroyInstance removes an instance from Consul

func (*Instance) GenerateConsulToken

func (i *Instance) GenerateConsulToken(consulClient *consul.Client) (string, error)

GenerateConsulToken generates an ACL in consul for this instance

func (*Instance) GetInstance

func (i *Instance) GetInstance(consulClient *consul.Client) (*Instance, error)

GetInstance gets instance info

func (*Instance) GetService

func (i *Instance) GetService(consulClient *consul.Client, serviceType string) (*Service, error)

GetService returns the service requested

func (*Instance) RemoveService

func (i *Instance) RemoveService(consulClient *consul.Client, service string) (*Instance, error)

RemoveService removes a service from Consul

func (*Instance) SetInstanceFields

func (i *Instance) SetInstanceFields(consulClient *consul.Client, instanceFields map[string]string) (*Instance, error)

SetInstanceFields sets instance/instanceID/fieldName to fieldValue

func (*Instance) ToMessage

func (i *Instance) ToMessage() (*pb.Instance, error)

ToMessage converts an instance to something that can be sent back over gRPC

type Service

type Service struct {
	Type   string
	Config string
}

Service is a managed service

func (*Service) ToMessage

func (s *Service) ToMessage() (*pb.ServiceSpec, error)

ToMessage serializes a Service for gRPC

type Services

type Services []*Service

Services is a list of Service

func (Services) ToMessage

func (services Services) ToMessage() ([]*pb.ServiceSpec, error)

ToMessage serializes a list of Services for gRPC

Jump to

Keyboard shortcuts

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