services

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrServiceNotFound happens when a wedeploy.json is not found
	ErrServiceNotFound = errors.New("Service not found")

	// ErrServiceAlreadyExists happens when a service ID already exists
	ErrServiceAlreadyExists = errors.New("Service already exists")

	// ErrInvalidServiceID happens when a service ID is invalid
	ErrInvalidServiceID = errors.New("Invalid service ID")

	// ErrEmptyProjectID happens when trying to access a project, but providing an empty ID
	ErrEmptyProjectID = errors.New("Can not get project: Project ID is empty")

	// ErrEmptyServiceID happens when trying to access a service, but providing an empty ID
	ErrEmptyServiceID = errors.New("Can not get service: Service ID is empty")

	// ErrEmptyProjectAndServiceID happens when trying to access a service, but providing empty IDs
	ErrEmptyProjectAndServiceID = errors.New("Can not get service: Project and Service ID is empty")
)

Functions

This section is empty.

Types

type Client added in v1.1.5

type Client struct {
	*apihelper.Client
}

Client for the services

func New added in v1.1.5

func New(wectx config.Context) *Client

New Client

func (*Client) AddDomain added in v1.1.5

func (c *Client) AddDomain(ctx context.Context, projectID, serviceID string, domain string) (err error)

AddDomain in project

func (*Client) Get added in v1.1.5

func (c *Client) Get(ctx context.Context, projectID, serviceID string) (s Service, err error)

Get service

func (*Client) GetEnvironmentVariables added in v1.1.5

func (c *Client) GetEnvironmentVariables(ctx context.Context, projectID, serviceID string) (envs []EnvironmentVariable, err error)

GetEnvironmentVariables of a service

func (c *Client) Link(ctx context.Context, projectID string, service Service, source string) (err error)

Link service to project

func (*Client) List added in v1.1.5

func (c *Client) List(ctx context.Context, projectID string) (Services, error)

List services of a given project

func (*Client) RemoveDomain added in v1.1.5

func (c *Client) RemoveDomain(ctx context.Context, projectID string, serviceID, domain string) (err error)

RemoveDomain in project

func (*Client) Restart added in v1.1.5

func (c *Client) Restart(ctx context.Context, projectID, serviceID string) error

Restart restarts a service inside a project

func (*Client) SetEnvironmentVariable added in v1.1.5

func (c *Client) SetEnvironmentVariable(ctx context.Context, projectID, serviceID, key, value string) error

SetEnvironmentVariable sets an environment variable

func (c *Client) Unlink(ctx context.Context, projectID, serviceID string) error

Unlink service

func (*Client) UnsetEnvironmentVariable added in v1.1.5

func (c *Client) UnsetEnvironmentVariable(ctx context.Context, projectID, serviceID, key string) error

UnsetEnvironmentVariable removes an environment variable

func (*Client) Validate added in v1.1.5

func (c *Client) Validate(ctx context.Context, projectID, serviceID string) (err error)

Validate service

type EnvironmentVariable

type EnvironmentVariable struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

EnvironmentVariable of a service

type Register

type Register struct {
	ID          string `json:"id"`
	Image       string `json:"image"`
	Category    string `json:"category"`
	Description string `json:"description"`
}

Register for the service structure

func GetRegistry

func GetRegistry(ctx context.Context) (registry []Register, err error)

GetRegistry gets a list of service images

type Service

type Service struct {
	ServiceID     string            `json:"serviceId,omitempty"`
	Health        string            `json:"health,omitempty"`
	Image         string            `json:"image,omitempty"`
	ImageHint     string            `json:"imageHint,omitempty"`
	CustomDomains []string          `json:"customDomains,omitempty"`
	Env           map[string]string `json:"env,omitempty"`
	Scale         int               `json:"scale,omitempty"`
	CPU           json.Number       `json:"cpu,omitempty"`
	Memory        json.Number       `json:"memory,omitempty"`
	HealthUID     string            `json:"healthUid,omitempty"`
}

Service structure

type ServiceInfo

type ServiceInfo struct {
	ServiceID string
	Location  string
}

ServiceInfo is for a tuple of service ID and Location.

type ServiceInfoList

type ServiceInfoList []ServiceInfo

ServiceInfoList is a list of ServiceInfo

func GetListFromDirectory

func GetListFromDirectory(root string) (ServiceInfoList, error)

GetListFromDirectory returns a list of services on the given diretory

func (ServiceInfoList) Get

func (c ServiceInfoList) Get(ID string) (ServiceInfo, error)

Get service info from service info list

func (ServiceInfoList) GetIDs

func (c ServiceInfoList) GetIDs() []string

GetIDs returns the services ids of a given ServiceInfoList.

func (ServiceInfoList) GetLocations

func (c ServiceInfoList) GetLocations() []string

GetLocations returns the locations of a given ServiceInfoList.

type ServicePackage

type ServicePackage struct {
	ID            string            `json:"id,omitempty"`
	Scale         int               `json:"scale,omitempty"`
	Image         string            `json:"image,omitempty"`
	CustomDomains []string          `json:"customDomains,omitempty"`
	Env           map[string]string `json:"env,omitempty"`
	// contains filtered or unexported fields
}

ServicePackage is the structure for wedeploy.json

func Read

func Read(path string) (*ServicePackage, error)

Read a service directory properties (defined by a wedeploy.json and/or Dockerfile on it)

func (ServicePackage) Service

func (cp ServicePackage) Service() *Service

Service returns a Service type created taking wedeploy.json as base

type Services

type Services []Service

Services of services for helper functions

func (Services) Get

func (cs Services) Get(id string) (c Service, err error)

Get a service from the service list

Jump to

Keyboard shortcuts

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