rest

package
v3.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LinkRelSelf defines the AtomLink Rel attribute for relationships of the "self"
	LinkRelSelf string = "self"
	// LinkRelDeployment defines the AtomLink Rel attribute for relationships of the "deployment"
	LinkRelDeployment string = "deployment"
	// LinkRelNode defines the AtomLink Rel attribute for relationships of the "node"
	LinkRelNode string = "node"
	// LinkRelInstance defines the AtomLink Rel attribute for relationships of the "instance"
	LinkRelInstance string = "instance"
	// LinkRelOutput defines the AtomLink Rel attribute for relationships of the "output"
	LinkRelOutput string = "output"
	// LinkRelTask defines the AtomLink Rel attribute for relationships of the "task"
	LinkRelTask string = "task"
	// LinkRelAttribute defines the AtomLink Rel attribute for relationships of the "attribute"
	LinkRelAttribute string = "attribute"
	// LinkRelWorkflow defines the AtomLink Rel attribute for relationships of the "attribute"
	LinkRelWorkflow string = "workflow"
	// LinkRelHost defines the AtomLink Rel attribute for relationships of the "host" (for hostspool)
	LinkRelHost string = "host"
)
View Source
const (
	// YorcDeploymentIDPattern is the allowed pattern for Yorc deployments IDs
	YorcDeploymentIDPattern string = "^[-_0-9a-zA-Z]+$"
)
View Source
const (
	// YorcIndexHeader is the name of the HTTP header containing the last index for long polling endpoints
	YorcIndexHeader string = "X-Yorc-Index"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomLink struct {
	Rel      string `json:"rel"`
	Href     string `json:"href"`
	LinkType string `json:"type"`
}

An AtomLink is defined in the Atom specification (https://tools.ietf.org/html/rfc4287#section-4.2.7) it allows to reference REST endpoints in the HATEOAS model

type Attribute

type Attribute struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Attribute is the representation of an TOSCA node instance attribute

type AttributesCollection

type AttributesCollection struct {
	Attributes []AtomLink `json:"attributes,omitempty"`
}

AttributesCollection is a collection of node instance's attributes links

type CustomCommandRequest

type CustomCommandRequest struct {
	NodeName          string                            `json:"node"`
	CustomCommandName string                            `json:"name"`
	InterfaceName     string                            `json:"interface,omitempty"`
	Inputs            map[string]*tosca.ValueAssignment `json:"inputs"`
}

CustomCommandRequest is the representation of a request to process a Custom Command

type Deployment

type Deployment struct {
	ID     string     `json:"id"`
	Status string     `json:"status"`
	Links  []AtomLink `json:"links"`
}

Deployment is the representation of a Yorc deployment

Deployment's links may be of type LinkRelSelf, LinkRelNode, LinkRelTask, LinkRelOutput.

type DeploymentsCollection

type DeploymentsCollection struct {
	Deployments []Deployment `json:"deployments"`
}

DeploymentsCollection is a collection of Deployment

Links are all of type LinkRelDeployment.

type Error

type Error struct {
	ID     string `json:"id"`
	Status int    `json:"status"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

Error represent an error returned by the REST API

func (*Error) Error

func (e *Error) Error() string

type Errors

type Errors struct {
	Errors []*Error `json:"errors"`
}

Errors is a collection of REST errors

type EventsCollection

type EventsCollection struct {
	Events    []json.RawMessage `json:"events"`
	LastIndex uint64            `json:"last_index"`
}

EventsCollection is a collection of instances status change events

type Health

type Health struct {
	Value string `json:"value"`
}

Health of a Yorc instance

type Host

type Host struct {
	hostspool.Host
	Links []AtomLink `json:"links"`
}

Host is a host in the host pool representation

Links are all of type LinkRelSelf.

type HostConfig

type HostConfig struct {
	Name       string
	Connection hostspool.Connection `json:"connection,omitempty" yaml:"connection,omitempty"`
	Labels     map[string]string    `json:"labels,omitempty" yaml:"labels,omitempty"`
}

HostConfig represents the configuration of a host in the Hosts Pool

type HostRequest

type HostRequest struct {
	Connection *hostspool.Connection `json:"connection,omitempty"`
	Labels     []MapEntry            `json:"labels,omitempty"`
}

HostRequest represents a request for creating or updating a host in the hosts pool

type HostsCollection

type HostsCollection struct {
	Checkpoint uint64     `json:"checkpoint,omitempty"`
	Hosts      []AtomLink `json:"hosts"`
	Warnings   []string   `json:"warnings,omitempty"`
}

HostsCollection is a collection of hosts registered in the host pool links

Links are all of type LinkRelHost.

type HostsPoolRequest

type HostsPoolRequest struct {
	Hosts []HostConfig `json:"hosts"`
}

HostsPoolRequest represents a request for applying a Hosts Pool configuration

type LogsCollection

type LogsCollection struct {
	Logs      []json.RawMessage `json:"logs"`
	LastIndex uint64            `json:"last_index"`
}

LogsCollection is a collection of logs events

type MapEntry

type MapEntry struct {
	// Op is the operation for this entry. The default if omitted is "add". An "add" operation acts like a remplace if the entry already exists
	Op MapEntryOperation `json:"op,omitempty"`
	// Name is the map entry key name
	Name string `json:"name"`
	// Value is the value of the map entry. Optional for a "remove" operation
	Value string `json:"value,omitempty"`
}

A MapEntry allows to manipulate a Map collection by performing operations (Op) on entries. It is inspired (with many simplifications) by the JSON Patch RFC https://tools.ietf.org/html/rfc6902

type MapEntryOperation

type MapEntryOperation int

MapEntryOperation is an enumeration of valid values for a MapEntry.Op field ENUM( Add, Remove )

const (
	// MapEntryOperationAdd is a MapEntryOperation of type Add
	MapEntryOperationAdd MapEntryOperation = iota
	// MapEntryOperationRemove is a MapEntryOperation of type Remove
	MapEntryOperationRemove
)

func ParseMapEntryOperation

func ParseMapEntryOperation(name string) (MapEntryOperation, error)

ParseMapEntryOperation attempts to convert a string to a MapEntryOperation

func (MapEntryOperation) MarshalJSON

func (o MapEntryOperation) MarshalJSON() ([]byte, error)

MarshalJSON is used to represent this enumeration as a string instead of an int

func (MapEntryOperation) String

func (x MapEntryOperation) String() string

String implements the Stringer interface.

func (*MapEntryOperation) UnmarshalJSON

func (o *MapEntryOperation) UnmarshalJSON(b []byte) error

UnmarshalJSON is used to read this enumeration from a string

type Node

type Node struct {
	Name  string     `json:"name"`
	Links []AtomLink `json:"links"`
}

Node is the representation of a TOSCA node

Node's links are of type LinkRelSelf, LinkRelDeployment and LinkRelInstance.

type NodeInstance

type NodeInstance struct {
	ID     string     `json:"id"`
	Status string     `json:"status"`
	Links  []AtomLink `json:"links"`
}

NodeInstance is the representation of a TOSCA node

Node's links are of type LinkRelSelf, LinkRelDeployment, LinkRelNode and LinkRelAttribute.

type Output

type Output struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Output is the representation of a deployment output

type OutputsCollection

type OutputsCollection struct {
	Outputs []AtomLink `json:"outputs,omitempty"`
}

OutputsCollection is a collection of deployment's outputs links

type RegistryDefinitionsCollection

type RegistryDefinitionsCollection struct {
	Definitions []registry.Definition `json:"definitions"`
}

RegistryDefinitionsCollection is the collection of TOSCA Definitions registered in the Yorc registry

type RegistryDelegatesCollection

type RegistryDelegatesCollection struct {
	Delegates []registry.DelegateMatch `json:"delegates"`
}

RegistryDelegatesCollection is the collection of Delegates executors registered in the Yorc registry

type RegistryImplementationsCollection

type RegistryImplementationsCollection struct {
	Implementations []registry.OperationExecMatch `json:"implementations"`
}

RegistryImplementationsCollection is the collection of Operation executors registered in the Yorc registry

type RegistryInfraUsageCollectorsCollection

type RegistryInfraUsageCollectorsCollection struct {
	InfraUsageCollectors []registry.InfraUsageCollector `json:"infrastructure_usage_collectors"`
}

RegistryInfraUsageCollectorsCollection is the collection of infrastructure usage collectors registered in the Yorc registry

type RegistryVaultsCollection

type RegistryVaultsCollection struct {
	VaultClientBuilders []registry.VaultClientBuilder `json:"vaults"`
}

RegistryVaultsCollection is the collection of Vaults Clients Builders registered in the Yorc registry

type Server

type Server struct {
	// contains filtered or unexported fields
}

A Server is an HTTP server that runs the Yorc REST API

func NewServer

func NewServer(configuration config.Configuration, client *api.Client, shutdownCh chan struct{}) (*Server, error)

NewServer create a Server to serve the REST API

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown stops the HTTP server

type Task

type Task struct {
	ID        string          `json:"id"`
	TargetID  string          `json:"target_id"`
	Type      string          `json:"type"`
	Status    string          `json:"status"`
	ResultSet json.RawMessage `json:"result_set,omitempty"`
}

Task is the representation of a Yorc' task

type TaskRequest

type TaskRequest struct {
	Type string `json:"type"`
}

TaskRequest is the representation of a request to process a new task

type TasksCollection

type TasksCollection struct {
	Tasks []AtomLink `json:"tasks,omitempty"`
}

TasksCollection is the collection of task's links

type Workflow

type Workflow struct {
	Name string `json:"name"`
	tosca.Workflow
}

Workflow is a workflow representation.

type WorkflowsCollection

type WorkflowsCollection struct {
	Workflows []AtomLink `json:"workflows"`
}

WorkflowsCollection is a collection of workflows links

Links are all of type LinkRelWorkflow.

Jump to

Keyboard shortcuts

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