cloudify

package
v0.0.0-...-f8139d8 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cloudify - Rest API implementation.

Index

Examples

Constants

View Source
const KubernetesLoadBalancer = "cloudify.nodes.ApplicationServer.kubernetes.LoadBalancer"

KubernetesLoadBalancer - type used for loadbalancers instances

View Source
const KubernetesNode = "cloudify.nodes.ApplicationServer.kubernetes.Node"

KubernetesNode - type used for kubernetes instances

Variables

This section is empty.

Functions

func ValidateBaseConnection

func ValidateBaseConnection(cloudConfig ClientConfig) error

ValidateBaseConnection - check configuration params (without tenant)

func ValidateConnectionTenant

func ValidateConnectionTenant(cloudConfig ClientConfig) error

ValidateConnectionTenant - check configuration params

Types

type Blueprint

type Blueprint struct {
	// have id, owner information
	rest.Resource
	MainFileName string `json:"main_file_name"`
}

Blueprint - struct for descrine information about cloudify blueprint

type BlueprintGet

type BlueprintGet struct {
	// can be response from api
	rest.BaseMessage
	Blueprint
}

BlueprintGet - Struct returned to get call with blueprint id

type Blueprints

type Blueprints struct {
	rest.BaseMessage
	Metadata rest.Metadata `json:"metadata"`
	Items    []Blueprint   `json:"items"`
}

Blueprints - struct returned to call for get blueprints by filter

type CFYAgentConfig

type CFYAgentConfig struct {
	RestHost string `json:"rest_host"`
	RestPort string `json:"rest_port"`
}

CFYAgentConfig - useful(not all) fields for cloudify agent config

type CallWithForce

type CallWithForce struct {
	Force bool `json:"force"`
}

CallWithForce - params for delete/run execution

type Client

type Client struct {
	ClientConfig
	// contains filtered or unexported fields
}

Client - struct with connection settings for connect to manager

Example
cl := NewClient(ClientConfig{
	Host:     "localhost",
	User:     "admin",
	Password: "password",
	Tenant:   "default_tenant",
})
fmt.Printf("Version: %s", cl.GetAPIVersion())
Output:

Version: v3.1

func ClientFromConnection

func ClientFromConnection(conn rest.ConnectionOperationsInterface) *Client

ClientFromConnection - return new client with internally use provided connection

func NewClient

func NewClient(cloudConfig ClientConfig) *Client

NewClient - return new connection with params

func (*Client) CacheConnection

func (cl *Client) CacheConnection()

CacheConnection - lock connection, don't reread agent file

func (*Client) CreateDeployments

func (cl *Client) CreateDeployments(deploymentID string, depl DeploymentPost) (*DeploymentGet, error)

CreateDeployments - create deployment

func (*Client) Delete

func (cl *Client) Delete(url string, input interface{}, output rest.MessageInterface) error

Delete - delete cloudify object on manager

func (*Client) DeleteBlueprints

func (cl *Client) DeleteBlueprints(blueprintID string) (*BlueprintGet, error)

DeleteBlueprints - delete blueprint by id

func (*Client) DeleteDeployments

func (cl *Client) DeleteDeployments(deploymentID string) (*DeploymentGet, error)

DeleteDeployments - delete deployment by ID

func (*Client) DeletePlugins

func (cl *Client) DeletePlugins(pluginID string, params CallWithForce) (*PluginGet, error)

DeletePlugins - delete plugin by id

func (*Client) DownloadBlueprints

func (cl *Client) DownloadBlueprints(blueprintID string) (string, error)

DownloadBlueprints - download blueprint by id

func (*Client) DownloadPlugins

func (cl *Client) DownloadPlugins(pluginID string) (string, error)

DownloadPlugins - download plugin by id

func (*Client) EnableDebug

func (cl *Client) EnableDebug()

EnableDebug - Enable debug on current connection

func (*Client) Get

func (cl *Client) Get(url string, output rest.MessageInterface) error

Get - get cloudify object from server

func (*Client) GetAPIVersion

func (cl *Client) GetAPIVersion() string

GetAPIVersion - return currently supported api version

func (*Client) GetAliveNodeInstancesWithType

func (cl *Client) GetAliveNodeInstancesWithType(params map[string]string, nodeType string) (*NodeInstances, error)

GetAliveNodeInstancesWithType - Returned list of alive node instances with some node type, used mainly for kubernetes, need to get instances that can be joined to cluster Useful for cloudprovider logic only.

func (*Client) GetBinary

func (cl *Client) GetBinary(url, outputPath string) error

GetBinary - get binary object from manager without any kind of unmarshaling

func (*Client) GetBlueprints

func (cl *Client) GetBlueprints(params map[string]string) (*Blueprints, error)

GetBlueprints - return blueprints from manager with fileter by params

func (*Client) GetDeployment

func (cl *Client) GetDeployment(deploymentID string) (*Deployment, error)

GetDeployment - return deployment by ID

func (*Client) GetDeploymentInstancesHostGrouped

func (cl *Client) GetDeploymentInstancesHostGrouped(params map[string]string) (map[string]NodeInstances, error)

GetDeploymentInstancesHostGrouped - return instances grouped by host

func (*Client) GetDeploymentInstancesNodeGrouped

func (cl *Client) GetDeploymentInstancesNodeGrouped(params map[string]string) (map[string]NodeInstances, error)

GetDeploymentInstancesNodeGrouped - return instances grouped by node

func (*Client) GetDeploymentInstancesScaleGrouped

func (cl *Client) GetDeploymentInstancesScaleGrouped(deploymentID, nodeType string) (map[string]NodeInstances, error)

GetDeploymentInstancesScaleGrouped - return instances grouped by scaleing group

func (*Client) GetDeploymentScaleGroup

func (cl *Client) GetDeploymentScaleGroup(deploymentID, scaleGroupName string) (*ScalingGroup, error)

GetDeploymentScaleGroup - return scaling group by name and deployment

func (*Client) GetDeploymentScaleGroupInstances

func (cl *Client) GetDeploymentScaleGroupInstances(deploymentID, groupName, nodeType string) (*NodeInstances, error)

GetDeploymentScaleGroupInstances - return instances related to scaling group

func (*Client) GetDeploymentScaleGroupNodes

func (cl *Client) GetDeploymentScaleGroupNodes(deploymentID, groupName, nodeType string) (*Nodes, error)

GetDeploymentScaleGroupNodes - return nodes related to scaling group

func (*Client) GetDeployments

func (cl *Client) GetDeployments(params map[string]string) (*Deployments, error)

GetDeployments - get deployments list from server filtered by params

func (*Client) GetEvents

func (cl *Client) GetEvents(params map[string]string) (*Events, error)

GetEvents - get events list filtered by params

func (*Client) GetExecutions

func (cl *Client) GetExecutions(params map[string]string) (*Executions, error)

GetExecutions - return list of execution on manager NOTE: change params type if you want use non uniq values in params

func (*Client) GetLoadBalancerInstances

func (cl *Client) GetLoadBalancerInstances(params map[string]string, clusterName, namespace, name, nodeType string) (*NodeInstances, error)

GetLoadBalancerInstances - return loadbalancer by name/namespace/cluster

func (*Client) GetNodeInstances

func (cl *Client) GetNodeInstances(params map[string]string) (*NodeInstances, error)

GetNodeInstances - Get all node instances

func (*Client) GetNodeInstancesWithType

func (cl *Client) GetNodeInstancesWithType(params map[string]string, nodeType string) (*NodeInstances, error)

GetNodeInstancesWithType - Returned list of started node instances with some node type, used mainly for kubernetes, also check that all instances related to same hostId started

func (*Client) GetNodes

func (cl *Client) GetNodes(params map[string]string) (*Nodes, error)

GetNodes - return nodes filtered by params

func (*Client) GetNodesFull

func (cl *Client) GetNodesFull(params map[string]string) (*NodeWithGroups, error)

GetNodesFull - return nodes filtered by params

func (*Client) GetPlugins

func (cl *Client) GetPlugins(params map[string]string) (*Plugins, error)

GetPlugins - return list plugins on manger filtered by params

func (*Client) GetStartedNodeInstancesWithType

func (cl *Client) GetStartedNodeInstancesWithType(params map[string]string, nodeType string) (*NodeInstances, error)

GetStartedNodeInstancesWithType - Returned list of started node instances with some node type, used mainly for kubernetes, also check that all instances related to same hostId started Useful for scale only.

func (*Client) GetStartedNodesWithType

func (cl *Client) GetStartedNodesWithType(params map[string]string, nodeType string) (*Nodes, error)

GetStartedNodesWithType - return nodes specified type with more than zero instances

func (*Client) GetStatus

func (cl *Client) GetStatus() (*Status, error)

GetStatus - manager status

func (*Client) GetTenants

func (cl *Client) GetTenants(params map[string]string) (*Tenants, error)

GetTenants - get tenants list filtered by params

func (*Client) GetVersion

func (cl *Client) GetVersion() (*Version, error)

GetVersion - manager version

func (*Client) Post

func (cl *Client) Post(url string, input interface{}, output rest.MessageInterface) error

Post - send cloudify object to manager

func (*Client) PostExecution

func (cl *Client) PostExecution(exec ExecutionPost) (*ExecutionGet, error)

PostExecution - run executions without waiting

func (*Client) PostZip

func (cl *Client) PostZip(url string, paths []string, output rest.MessageInterface) error

PostZip - store/send path as archive to manger without marshaling, response will be unmarshaled

func (*Client) Put

func (cl *Client) Put(url string, input interface{}, output rest.MessageInterface) error

Put - send object to manager(mainly replece old one)

func (*Client) PutBinary

func (cl *Client) PutBinary(url string, data []byte, output rest.MessageInterface) error

PutBinary - store/send binary object to manger without marshaling, response will be unmarshaled

func (*Client) PutZip

func (cl *Client) PutZip(url string, paths []string, output rest.MessageInterface) error

PutZip - store/send path as archive to manger without marshaling, response will be unmarshaled

func (*Client) ResetConnection

func (cl *Client) ResetConnection()

ResetConnection - reset cached connection settings, need to recreate connection if you have used ClientFromConnection

func (*Client) RunExecution

func (cl *Client) RunExecution(execPost ExecutionPost, fullFinish bool) (*Execution, error)

RunExecution - Run executions and wait results execPost: executions description for run fullFinish: wait to full finish

func (*Client) UploadBlueprint

func (cl *Client) UploadBlueprint(blueprintID, path string) (*BlueprintGet, error)

UploadBlueprint - upload blueprint with name and path to blueprint in filesystem

func (*Client) UploadPlugin

func (cl *Client) UploadPlugin(params map[string]string, pluginPath, yamlPath string) (*PluginGet, error)

UploadPlugin - upload plugin with path to plugin in filesystem

func (*Client) WaitBeforeRunExecution

func (cl *Client) WaitBeforeRunExecution(deploymentID string) error

WaitBeforeRunExecution - wait while all other executions will be finished

type ClientConfig

type ClientConfig struct {
	Host            string `json:"host,omitempty"`
	User            string `json:"user,omitempty"`
	Password        string `json:"password,omitempty"`
	Tenant          string `json:"tenant,omitempty"`
	AgentFile       string `json:"agent,omitempty"`
	DeploymentsFile string `json:"deployment,omitempty"`
	Debug           bool   `json:"debug,omitempty"`
}

ClientConfig - all configuration fields for connection

type Deployment

type Deployment struct {
	// have id, owner information
	rest.Resource
	// contain information from post
	DeploymentPost
	Permalink     string                  `json:"permalink"`
	Workflows     []Workflow              `json:"workflows"`
	Outputs       map[string]interface{}  `json:"outputs"`
	ScalingGroups map[string]ScalingGroup `json:"scaling_groups"`
	Groups        map[string]NodeGroup    `json:"groups"`
	// TODO use correct type for "policy_types" struct
	PolicyTypes map[string]interface{} `json:"policy_types"`
	// TODO use correct type for "policy_triggers" struct
	PolicyTriggers map[string]interface{} `json:"policy_triggers"`
}

Deployment - deployment struct

func (*Deployment) GetJSONInputs

func (depl *Deployment) GetJSONInputs() (string, error)

GetJSONInputs - get deployments inputs as json string

func (*Deployment) GetJSONOutputs

func (depl *Deployment) GetJSONOutputs() (string, error)

GetJSONOutputs - get deployments outputs as json string

type DeploymentGet

type DeploymentGet struct {
	// can be response from api
	rest.BaseMessage
	Deployment
}

DeploymentGet - information about deployment on server

type DeploymentPost

type DeploymentPost struct {
	BlueprintID string                 `json:"blueprint_id"`
	Inputs      map[string]interface{} `json:"inputs"`
}

DeploymentPost - create deployment struct

func (*DeploymentPost) GetJSONInputs

func (depl *DeploymentPost) GetJSONInputs() (string, error)

GetJSONInputs - get inputs as json string

func (*DeploymentPost) SetJSONInputs

func (depl *DeploymentPost) SetJSONInputs(inputs string) error

SetJSONInputs - set inputs from json string

type Deployments

type Deployments struct {
	rest.BaseMessage
	Metadata rest.Metadata `json:"metadata"`
	Items    []Deployment  `json:"items"`
}

Deployments - response with list deployments

type DeploymentsInfo

type DeploymentsInfo struct {
	Deployments []interface{} `json:"deployments,omitempty"`
}

DeploymentsInfo - all deployments used on kubernetes cloudify provider

func ParseDeploymentFile

func ParseDeploymentFile(deploymentFile string) (*DeploymentsInfo, error)

ParseDeploymentFile - Get deployments provider info needed to be used by kubernetes cloudify provider

type Event

type Event struct {
	NodeInstanceID    string `json:"node_instance_id"`
	EventType         string `json:"event_type"`
	Operation         string `json:"operation"`
	BlueprintID       string `json:"blueprint_id"`
	NodeName          string `json:"node_name"`
	WorkflowID        string `json:"workflow_id"`
	ErrorCauses       string `json:"error_causes"`
	ReportedTimestamp string `json:"reported_timestamp"`
	DeploymentID      string `json:"deployment_id"`
	Type              string `json:"type"`
	ExecutionID       string `json:"execution_id"`
	Timestamp         string `json:"timestamp"`
	Message           string `json:"message"`
}

Event - infromation about cloudify event

type Events

type Events struct {
	rest.BaseMessage
	Metadata rest.Metadata `json:"metadata"`
	Items    []Event       `json:"items"`
}

Events - cloudify response with events list

type Execution

type Execution struct {
	// have id, owner information
	rest.Resource
	// contain information from post
	ExecutionPost
	IsSystemWorkflow bool   `json:"is_system_workflow"`
	ErrorMessage     string `json:"error"`
	BlueprintID      string `json:"blueprint_id"`
	Status           string `json:"status"`
}

Execution - information about execution on manager

type ExecutionGet

type ExecutionGet struct {
	// can be response from api
	rest.BaseMessage
	Execution
}

ExecutionGet - response from manager about selected execution

type ExecutionPost

type ExecutionPost struct {
	CallWithForce
	WorkflowID   string                 `json:"workflow_id"`
	DeploymentID string                 `json:"deployment_id"`
	Parameters   map[string]interface{} `json:"parameters"`
}

ExecutionPost - information for create new execution

func (*ExecutionPost) SetJSONParameters

func (exec *ExecutionPost) SetJSONParameters(parameters string) error

SetJSONParameters - set parameters for execution (use before send)

type Executions

type Executions struct {
	rest.BaseMessage
	Metadata rest.Metadata `json:"metadata"`
	Items    []Execution   `json:"items"`
}

Executions - response from manager about several executions

type InstanceService

type InstanceService struct {
	Instances   []InstanceStatus `json:"instances"`
	DisplayName string           `json:"display_name"`
}

InstanceService - information about system service started on manager

func (InstanceService) Status

func (s InstanceService) Status() string

Status - current status for service

type InstanceStatus

type InstanceStatus struct {
	LoadState   string `json:"LoadState"`
	Description string `json:"Description"`
	State       string `json:"state"`
	MainPID     uint   `json:"MainPID"`
	ID          string `json:"Id"`
	ActiveState string `json:"ActiveState"`
	SubState    string `json:"SubState"`
}

InstanceStatus - system service status

type Node

type Node struct {
	rest.ObjectIDWithTenant
	Operations               map[string]interface{} `json:"operations,omitempty"`
	Relationships            []interface{}          `json:"relationships,omitempty"`
	DeployNumberOfInstances  int                    `json:"deploy_number_of_instances"`
	TypeHierarchy            []string               `json:"type_hierarchy,omitempty"`
	BlueprintID              string                 `json:"blueprint_id,omitempty"`
	NumberOfInstances        int                    `json:"number_of_instances"`
	DeploymentID             string                 `json:"deployment_id,omitempty"`
	Properties               map[string]interface{} `json:"properties,omitempty"`
	PlannedNumberOfInstances int                    `json:"planned_number_of_instances"`
	Plugins                  []NodePlugin           `json:"plugins,omitempty"`
	MaxNumberOfInstances     int                    `json:"max_number_of_instances"`
	HostID                   string                 `json:"host_id,omitempty"`
	MinNumberOfInstances     int                    `json:"min_number_of_instances"`
	Type                     string                 `json:"type,omitempty"`
	PluginsToInstall         []interface{}          `json:"plugins_to_install,omitempty"`
}

Node - information about cloudify node

func (*Node) GetJSONProperties

func (node *Node) GetJSONProperties() (string, error)

GetJSONProperties - properties related to node

type NodeGroup

type NodeGroup struct {
	Members []string `json:"members"`
	// TODO use correct type for "policies" struct
	Policies map[string]interface{} `json:"policies"`
}

NodeGroup - Node group struct

type NodeInstance

type NodeInstance struct {
	rest.ObjectIDWithTenant
	Relationships     []interface{}              `json:"relationships,omitempty"`
	RuntimeProperties map[string]interface{}     `json:"runtime_properties,omitempty"`
	State             string                     `json:"state,omitempty"`
	Version           int                        `json:"version,omitempty"`
	HostID            string                     `json:"host_id,omitempty"`
	DeploymentID      string                     `json:"deployment_id,omitempty"`
	NodeID            string                     `json:"node_id,omitempty"`
	ScalingGroups     []NodeInstanceScalingGroup `json:"scaling_groups,omitempty"`
}

NodeInstance - cloudify node instance struct

func (*NodeInstance) GetJSONRuntimeProperties

func (instance *NodeInstance) GetJSONRuntimeProperties() (string, error)

GetJSONRuntimeProperties - instance runtime properties returnd as json string

func (*NodeInstance) GetProperty

func (instance *NodeInstance) GetProperty(name string) interface{}

GetProperty - return field value or nil if field does not exist

func (*NodeInstance) GetStringProperty

func (instance *NodeInstance) GetStringProperty(name string) string

GetStringProperty - return field value as string or empty if field does not exist

type NodeInstanceScalingGroup

type NodeInstanceScalingGroup struct {
	Name string `json:"name,omitempty"`
	ID   string `json:"id,omitempty"`
}

NodeInstanceScalingGroup - short information(ID+Name) about scaling group related to instance

type NodeInstances

type NodeInstances struct {
	rest.BaseMessage
	Metadata rest.Metadata  `json:"metadata"`
	Items    []NodeInstance `json:"items"`
}

NodeInstances - cloudify manager response with list instances

func (*NodeInstances) AllAreStarted

func (ni *NodeInstances) AllAreStarted() bool

AllAreStarted - check that all instances in list are started

type NodePlugin

type NodePlugin struct {
	PluginBase
	Name     string `json:"name,omitempty"`
	Executor string `json:"executor,omitempty"`
	// TODO describe "install_arguments"
	// TODO describe "source"
	Install bool `json:"install"`
}

NodePlugin - information about plugin used by node

type NodeWithGroup

type NodeWithGroup struct {
	Node
	ScalingGroupName string `json:"scaling_group"`
	GroupName        string `json:"group"`
}

NodeWithGroup - full information about cloudify node

type NodeWithGroups

type NodeWithGroups struct {
	rest.BaseMessage
	Metadata rest.Metadata   `json:"metadata"`
	Items    []NodeWithGroup `json:"items"`
}

NodeWithGroups - response from manager with nodes list

func (*NodeWithGroups) SelfUpdateGroups

func (nwg *NodeWithGroups) SelfUpdateGroups()

SelfUpdateGroups - go by nodes and update group if we have some additional info from parent

type Nodes

type Nodes struct {
	rest.BaseMessage
	Metadata rest.Metadata `json:"metadata"`
	Items    []Node        `json:"items"`
}

Nodes - response from manager with nodes list

func (*Nodes) GetNodeNamesWithType

func (nl *Nodes) GetNodeNamesWithType(nodeType string) []string

GetNodeNamesWithType - Return all Node ID's with specific type

type Plugin

type Plugin struct {
	rest.ObjectIDWithTenant
	PluginBase
	SupportedPyVersions []string `json:"supported_py_versions,omitempty"`
	UploadedAt          string   `json:"uploaded_at,omitempty"`
	ArchiveName         string   `json:"archive_name,omitempty"`
	ExcludedWheels      []string `json:"excluded_wheels,omitempty"`
	Distribution        string   `json:"distribution,omitempty"`
	PackageSource       string   `json:"package_source,omitempty"`
	Wheels              []string `json:"wheels,omitempty"`
}

Plugin - information about cloudify plugin

type PluginBase

type PluginBase struct {
	DistributionRelease string `json:"distribution_release,omitempty"`
	PackageName         string `json:"package_name,omitempty"`
	PackageVersion      string `json:"package_version,omitempty"`
	DistributionVersion string `json:"distribution_version,omitempty"`
	SupportedPlatform   string `json:"supported_platform,omitempty"`
}

PluginBase - common part for any response about plugin

type PluginGet

type PluginGet struct {
	// can be response from api
	rest.BaseMessage
	Plugin
}

PluginGet - Struct returned to get call with Plugin id

type Plugins

type Plugins struct {
	rest.BaseMessage
	Metadata rest.Metadata `json:"metadata"`
	Items    []Plugin      `json:"items"`
}

Plugins - response with list plugins

type ScalingGroup

type ScalingGroup struct {
	Properties ScalingGroupProperties `json:"properties"`
	Members    []string               `json:"members"`
}

ScalingGroup - Scaling group struct

type ScalingGroupProperties

type ScalingGroupProperties struct {
	MinInstances     int `json:"min_instances"`
	PlannedInstances int `json:"planned_instances"`
	DefaultInstances int `json:"default_instances"`
	MaxInstances     int `json:"max_instances"`
	CurrentInstances int `json:"current_instances"`
}

ScalingGroupProperties - scaling group properties struct

type ServiceConfig

type ServiceConfig struct {
	ClientConfig
}

ServiceConfig - settings for connect to cloudify

func ServiceClientInit

func ServiceClientInit(config io.Reader) (*ServiceConfig, error)

ServiceClientInit - common functionality for load config for service

type Status

type Status struct {
	rest.StrStatusMessage
	Services []InstanceService `json:"services"`
}

Status - response from server about current status

type Tenant

type Tenant struct {
	Name   string `json:"name"`
	Users  int    `json:"users"`
	Groups int    `json:"groups"`
}

Tenant - information about cloudify tenant

type Tenants

type Tenants struct {
	rest.BaseMessage
	Metadata rest.Metadata `json:"metadata"`
	Items    []Tenant      `json:"items"`
}

Tenants - cloudify response with tenants list

type Version

type Version struct {
	rest.BaseMessage
	Date    string `json:"date"`
	Edition string `json:"edition"`
	Version string `json:"version"`
	Build   string `json:"build"`
	Commit  string `json:"commit"`
}

Version - information about manager version

type Workflow

type Workflow struct {
	CreatedAt  string                 `json:"created_at"`
	Name       string                 `json:"name"`
	Parameters map[string]interface{} `json:"parameters"`
}

Workflow - information about workflow

Directories

Path Synopsis
Package rest - implementation http/https connection to cloudify manager.
Package rest - implementation http/https connection to cloudify manager.
Package tests - fake classes for api testing.
Package tests - fake classes for api testing.
Package utils - additional supplementary functions.
Package utils - additional supplementary functions.

Jump to

Keyboard shortcuts

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