blueprint

package module
v0.0.0-...-bf6bc6a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: Apache-2.0 Imports: 6 Imported by: 1

README

blueprint-go

Go bindings to read Blueprints

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssembleOperationsMap

func AssembleOperationsMap(b Blueprint) map[string]ExtendedOps

Types

type AbstractPropertiesMethodType

type AbstractPropertiesMethodType struct {

	// The method identifier this goals apply to
	// required: true
	MethodId *string `json:"method_id"`

	// The goal tree for this method
	// required: true
	GoalTrees GoalTreeType `json:"goalTrees"`
}

AbstractPropertiesMethodType defines a goal tree for a method swagger:model

type Attributes

type Attributes struct {
	DataUtility []DataUtility `json:"dataUtility"`
	Privacy     []DataUtility `json:"privacy"`
	Security    []DataUtility `json:"security"`
}

goal trees

type Blueprint

type Blueprint struct {
	ID                 string                         `json:"_id"`
	AbstractProperties []AbstractPropertiesMethodType `json:"ABSTRACT_PROPERTIES"`
	CookbookAppendix   CookbookAppendix               `json:"COOKBOOK_APPENDIX"`  // CookbookAppendix is the definition of the Cookbook Appendix section in the blueprint
	DataManagement     []DataManagement               `json:"DATA_MANAGEMENT"`    // list of methods
	ExposedAPI         spec.Swagger                   `json:"EXPOSED_API"`        // The CAF RESTful API of the VDC, written according to the current version (3.0.1) of the; OpenAPI Specification (OAS), but also adapted to DITAS requirements
	InternalStructure  InternalStructure              `json:"INTERNAL_STRUCTURE"` // General information about the VDC Blueprint
}

This is a VDC Blueprint which consists of five sections

func ReadBlueprint

func ReadBlueprint(path string) (*Blueprint, error)

func (Blueprint) GetMethodMap

func (b Blueprint) GetMethodMap() map[string]ExtendedMethods

GetMethodMap returns a map with information about each operation of the blueprint indexed by operation id.

type COOKBOOKAPPENDIXIdentityAccessManagement

type COOKBOOKAPPENDIXIdentityAccessManagement struct {
	Mapping        []Mapping                `json:"mapping"`
	ValidationKeys []map[string]interface{} `json:"validation_keys"`
}

type Class

type Class string
const (
	API                Class = "api"
	DataStream         Class = "data stream"
	ObjectStorage      Class = "object storage"
	RelationalDatabase Class = "relational database"
	TimeSeriesDatabase Class = "time-series database"
)

type CloudProviderInfo

type CloudProviderInfo struct {
	// Endpoint to use for this infrastructure
	// required:true
	APIEndpoint string `json:"api_endpoint"`
	// Type of the infrastructure. i.e AWS, Cloudsigma, GCP or Edge
	APIType string `json:"api_type"`
	// Secret identifier to use to log in to the infrastructure manager.
	SecretID string `json:"secret_id"`
	// Credentials to access the cloud provider. Either this or secret_id is mandatory. Each cloud provider should define the format of this element.
	Credentials map[string]interface{} `json:"credentials"`
}

CloudProviderInfo contains information about a cloud provider swagger:model

type Column

type Column struct {
	ColumnID           *string `json:"column_id,omitempty"`          // The id of the column/field
	ComputeDataUtility *bool   `json:"computeDataUtility,omitempty"` // True if it is required for data utility computation
}

type CookbookAppendix

type CookbookAppendix struct {

	// Information about the resources which are available to deploy VDCs
	// required:true
	Resources Deployment `json:"Resources"`

	// Information about the clusters that were deployed with this blueprint
	// required: true
	Deployment DeploymentInfo `json:"Deployment"`

	IdentityAccessManagement *COOKBOOKAPPENDIXIdentityAccessManagement `json:"Identity_Access_Management,omitempty"`
}

CookbookAppendix is the definition of the Cookbook Appendix section in the blueprint swagger:model

type DALImage

type DALImage struct {
	Images             map[string]Image  `json:"images,omitempty"`     // Set of images to deploy indexed by the image identifier
	OriginalIP         string            `json:"original_ip"`          // IP of the original DAL's location
	ClusterOriginalIPs map[string]string `json:"cluster_original_ips"` // When each cluster needs a different IP for the original DAL, it can be specified here where the key is the cluster name (which has to be unique) and the value is the IP to use when deploy the VDC to that cluster
}

DALImage about the DAL including its original location

type DataManagement

type DataManagement struct {
	Attributes Attributes `json:"attributes"` // goal trees
	MethodID   string     `json:"method_id"`  // The id (operationId) of the method (as indicated in the EXPOSED_API.paths field)
}

type DataSource

type DataSource struct {
	Class       *Class                 `json:"class,omitempty"`
	Description *string                `json:"description,omitempty"`
	ID          string                 `json:"id"` // A unique identifier
	Location    *Location              `json:"location,omitempty"`
	Parameters  map[string]interface{} `json:"parameters,omitempty"` // Connection parameters
	Schema      map[string]interface{} `json:"schema,omitempty"`
	Type        *Type                  `json:"type,omitempty"`
}

type DataSourceElement

type DataSourceElement struct {
	Database       []Database `json:"database"`                  // the list of databases required by a method in a data source
	DataSourceID   *string    `json:"dataSource_id,omitempty"`   // The id of the data sources (as indicated in the Data_Sources field)
	DataSourceType *string    `json:"dataSource_type,omitempty"` // The type of the data sources (relationa/not_relational/object)
}

type DataUtility

type DataUtility struct {
	ID         *string             `json:"id,omitempty"`         // id of the metric
	Name       *string             `json:"name,omitempty"`       // name of the metric
	Properties map[string]Property `json:"properties,omitempty"` // properties related to the metric
	Type       *string             `json:"type,omitempty"`       // type of the metric
}

definition of the metric

type Database

type Database struct {
	DatabaseID *string `json:"database_id,omitempty"` // The id of the database
	Tables     []Table `json:"tables"`                // the list of tables/collections required by a method in a data source
}

type Deployment

type Deployment struct {
	// Name for this deployment
	// required:true
	// unique:true
	Name string `json:"name"`
	// Optional description
	Description string `json:"description"`
	// List of infrastructures to deploy for this hybrid deployment
	// required:true
	Infrastructures []InfrastructureType `json:"infrastructures"`
}

Deployment is a set of infrastructures that need to be instantiated or configurated to form clusters swagger:model

type DeploymentInfo

type DeploymentInfo struct {
	// Unique ID for the deployment
	// required:true
	// unique:true
	ID string `json:"id" bson:"_id"`
	// Name of the deployment
	Name string `json:"name"`
	// Lisf of infrastructures, each one representing a different cluster.
	Infrastructures map[string]InfrastructureDeploymentInfo `json:"infrastructures"`
	// Extra properties bound to the deployment
	ExtraProperties ExtraPropertiesType `json:"extra_properties"`
	// Global status of the deployment
	Status string `json:"status"`
}

DeploymentInfo contains information of a deployment than may compromise several clusters swagger:model

type Drive

type Drive struct {
	// Unique name for the drive
	// required:true
	Name string `json:"name"`
	// Type of the drive. It can be "SSD" or "HDD"
	// pattern: SSD|HDD
	// example: SSD
	Type string `json:"type"`
	// Size of the disk in Mb
	// required:true
	Size int64 `json:"size"`
}

Drive holds information about a data drive attached to a node swagger:model

type DriveInfo

type DriveInfo struct {
	// Name of the data drive
	// unique:true
	// required:true
	Name string `json:"name"`
	// Size of the disk in bytes
	// required:true
	Size int64 `json:"size"`
}

DriveInfo is the information of a drive that has been instantiated swagger:model

type ExtendedMethods

type ExtendedMethods struct {
	Properties AbstractPropertiesMethodType
	Method     DataManagement
	Path       string
	HTTPMethod string
	Tags       []string
}

type ExtendedOps

type ExtendedOps struct {
	Ops    spec.Operation
	Path   string
	Method string
}

type ExtraPropertiesType

type ExtraPropertiesType map[string]string

ExtraPropertiesType represents extra properties to define for resources, infrastructures or deployments. This properties are provisioner or deployment specific and they should document them when they expect any. swagger:model

type Flow

type Flow struct {
	Parameters map[string]interface{} `json:"parameters,omitempty"`
	Platform   *Platform              `json:"platform,omitempty"`
	SourceCode interface{}            `json:"source_code"`
}

The data flow that implements the VDC

type GoalTreeType

type GoalTreeType struct {

	// Goal tree for data utility properties
	// required: false
	DataUtility TreeStructureType `json:"dataUtility"`

	// Goal tree for security properties
	// required: false
	Security TreeStructureType `json:"security"`

	// Goal tree for privacy properties
	// required: false
	Privacy TreeStructureType `json:"privacy"`
}

GoalTreeType defines a goal tree swagger:model

type INTERNALSTRUCTUREIdentityAccessManagement

type INTERNALSTRUCTUREIdentityAccessManagement struct {
	IamEndpoint string            `json:"iam_endpoint"`
	JwksURI     string            `json:"jwks_uri"`
	Provider    []ProviderElement `json:"provider"`
	Roles       []string          `json:"roles"`
}

type Image

type Image struct {
	ExternalPort *int64            `json:"external_port,omitempty"` // Port in which this image must be exposed. It must be unique across all images in all the; ImageSets defined in this blueprint. Due to limitations in k8s, the port range must be; bewteen 30000 and 32767
	Image        string            `json:"image"`                   // Image is the image name in the standard format [group]/<image_name>:[release]
	InternalPort *int64            `json:"internal_port,omitempty"` // Port in which the docker image is listening internally. Two images inside the same; ImageSet can't have the same internal port.
	Environment  map[string]string `json:"environment,omitempty"`   // Environment is a set of environment variables to pass to this image. It can have some special variables if the value is in the form ${var}
}

Image is the information about an image that will be deployed by the deployment engine

type InfrastructureDeploymentInfo

type InfrastructureDeploymentInfo struct {
	// Unique infrastructure ID on the deployment
	// required:true
	// unique:true
	ID string `json:"id"`
	// Name of the infrastructure
	Name string `json:"name"`
	// Type of the infrastructure: cloud or edge
	// pattern:cloud|edge
	// required:true
	Type string `json:"type"`
	// Provider information
	// required:true
	Provider CloudProviderInfo `json:"provider"`
	// Set of nodes in the infrastructure indexed by role
	// required:true
	Nodes map[string][]NodeInfo
	// Status of the infrastructure
	Status string `json:"status"`
	// Configuration of VDCs running in the cluster, indexed by VDC identifier.
	VDCs map[string]VDCInfo `json:"vdcs"`
	// Set weather the VDM is running in this cluster or not
	VDM bool
	// Extra properties to pass to the provider or the provisioner
	ExtraProperties ExtraPropertiesType `json:"extra_properties"`
}

InfrastructureDeploymentInfo contains information about a cluster of nodes that has been instantiated or were already existing. swagger:model

type InfrastructureType

type InfrastructureType struct {
	// Unique name for the infrastructure
	// required:true
	// unique:true
	Name string `json:"name"`
	// Optional description for the infrastructure
	Description string `json:"description"`
	// Type of the infrastructure: Cloud or Edge: Cloud infrastructures mean that the resources will be VMs that need to be instantiated. Edge means that the infrastructure is already in place and its information will be added to the database but no further work will be done by a deployer.
	Type string `json:"type"`
	// Provider information. Required in case of Cloud type
	Provider CloudProviderInfo `json:"provider"`
	// List of resources to deploy
	// required:true
	Resources []ResourceType `json:"resources"`
	// Extra properties to pass to the provider or the provisioner
	ExtraProperties ExtraPropertiesType `json:"extra_properties"`
}

InfrastructureType is a set of resources that need to be created or configured to form a cluster swagger:model

type InternalStructure

type InternalStructure struct {
	DALImages                map[string]DALImage                        `json:"DAL_Images,omitempty"` // Docker images that must be deployed in the DAL indexed by DAL name. It will be used to; compose the service name and the DNS entry that other images in the cluster can access to.
	DataSources              []DataSource                               `json:"Data_Sources"`
	Flow                     *Flow                                      `json:"Flow,omitempty"` // The data flow that implements the VDC
	IdentityAccessManagement *INTERNALSTRUCTUREIdentityAccessManagement `json:"Identity_Access_Management,omitempty"`
	MethodsInput             *MethodsInput                              `json:"Methods_Input,omitempty"` // This filed contains the part of the data source that each method needs to be executed
	Overview                 Overview                                   `json:"Overview"`
	TestingOutputData        []TestingOutputDatum                       `json:"Testing_Output_Data"`
	VDCImages                map[string]Image                           `json:"VDC_Images,omitempty"`
}

General information about the VDC Blueprint

type LeafType

type LeafType struct {
	// Unique identifier for the leaf
	// required: true
	// unique: true
	Id *string `json:"id"`

	// An optional description for the leaf
	// required: false
	Description string `json:"description"`

	// The weight in the resolution of the constraint
	// requiered: true
	Weight int `json:"weight"`

	// The list of attributes defined in the data management section to match. All of them must comply.
	// requiered: true
	Attributes []string `json:"attributes"`
}

LeafType is a leaf in a tree data structure swagger:model

type Location

type Location string
const (
	Cloud Location = "cloud"
	Edge  Location = "edge"
)

type Mapping

type Mapping struct {
	MappingURL *string       `json:"mapping_url,omitempty"`
	Provider   *string       `json:"provider,omitempty"`
	RoleMap    *RoleMapUnion `json:"role_map"`
	Roles      []string      `json:"roles"`
}

type Method

type Method struct {
	DataSources []DataSourceElement `json:"dataSources"`         // The list of data sources required by the method
	MethodID    *string             `json:"method_id,omitempty"` // The id (operationId) of the method (as indicated in the EXPOSED_API.paths field)
}

type MethodsInput

type MethodsInput struct {
	Methods []Method `json:"Methods"` // The list of methods
}

This filed contains the part of the data source that each method needs to be executed

type NodeInfo

type NodeInfo struct {
	// Hostname of the node.
	// requiered:true
	// unique:true
	Hostname string `json:"hostname"`
	// Role of the node. Master or slave in case of Kubernetes.
	// example:master
	Role string `json:"role"`
	// CPU speed in Mhz.
	CPU int `json:"cpu"`
	// Number of cores.
	Cores int `json:"cores"`
	// RAM quantity in bytes.
	RAM int64 `json:"ram"`
	// IP assigned to this node.
	// required:true
	// unique:true
	IP string `json:"ip"`
	// Size of the boot disk in bytes
	// required:true
	// unique:true
	DriveSize int64 `json:"drive_size" bson:"drive_size"`
	// Data drives information
	DataDrives []DriveInfo `json:"data_drives" bson:"data_drives"`
	// Extra properties to pass to the provider or the provisioner
	ExtraProperties ExtraPropertiesType `json:"extra_properties"`
}

NodeInfo is the information of a virtual machine that has been instantiated or a physical one that was pre-existing swagger:model

type Overview

type Overview struct {
	Description string `json:"description"` // This field should contain a short description of the VDC Blueprint
	Name        string `json:"name"`        // This field should contain the name of the VDC Blueprint
	Tags        []Tag  `json:"tags"`        // Each element of this array should contain some keywords that describe the functionality; of each one exposed VDC method
}

func (Overview) String

func (o Overview) String() string

type Platform

type Platform string
const (
	NodeRED Platform = "Node-RED"
	Spark   Platform = "Spark"
)

type Property

type Property struct {
	Maximum *float64    `json:"maximum,omitempty"` // lower limit of the offered property
	Minimum *float64    `json:"minimum,omitempty"` // upper limit of the offered property
	Unit    *string     `json:"unit,omitempty"`    // unit of measure of the property
	Value   interface{} `json:"value"`             // value of the property
}

properties related to the metric

func (Property) String

func (mm Property) String() string

type ProviderElement

type ProviderElement struct {
	LoginPortal *string `json:"loginPortal,omitempty"`
	Name        string  `json:"name"`
	Type        *string `json:"type,omitempty"`
	URI         string  `json:"uri"`
}

type ResourceType

type ResourceType struct {
	// Suffix for the hostname. The real hostname will be formed of the infrastructure name + resource name
	// required:true
	// unique:true
	Name string `json:"name"`
	// Type of the VM to create i.e. n1-small
	// example: n1-small
	Type string `json:"type"`
	// CPU speed in Mhz. Ignored if type is provided
	CPU int `json:"cpu"`
	// Number of cores. Ignored if type is provided
	Cores int `json:"cores"`
	// RAM quantity in Mb. Ignored if type is provided
	RAM int64 `json:"ram"`
	// Boot disk size in Mb
	// required:true
	Disk int64 `json:"disk"`
	// Role that this VM plays. In case of a Kubernetes deployment at least one "master" is needed.
	Role string `json:"role"`
	// Boot image ID to use
	// required:true
	ImageId string `json:"image_id"`
	// IP to assign this VM. In case it's not specified, the first available one will be used.
	IP string `json:"ip,omitempty"`
	// List of data drives to attach to this VM
	Drives []Drive `json:"drives"`
	// Extra properties to pass to the provider or the provisioner
	ExtraProperties ExtraPropertiesType `json:"extra_properties"`
}

ResourceType has information about a node that needs to be created by a deployer. swagger:model

type RoleMapElement

type RoleMapElement struct {
	Matcher  *string  `json:"matcher,omitempty"`
	Priority *float64 `json:"priority,omitempty"`
	Roles    []string `json:"roles"`
}

type RoleMapUnion

type RoleMapUnion struct {
	RoleMapElementArray []RoleMapElement
	String              *string
}

type Table

type Table struct {
	Columns []Column `json:"columns"`
	TableID *string  `json:"table_id,omitempty"` // The id of the tables/collection
}

type Tag

type Tag struct {
	MethodID string   `json:"method_id"` // The id (operationId) of the method (as indicated in the EXPOSED_API.paths field)
	Tags     []string `json:"tags"`
}

type TestingOutputDatum

type TestingOutputDatum struct {
	MethodID string `json:"method_id"` // The id (operationId) of the method (as indicated in the EXPOSED_API.paths field)
	ZipData  string `json:"zip_data"`  // The URI to the zip testing output data for each one exposed VDC method
}

type TreeStructureType

type TreeStructureType struct {

	// The operation to apply to the subtree or leaves
	// required: true
	// pattern: AND|OR
	// example: AND
	Type *string `json:"type"`

	// The subtrees pending from this node
	// required: false
	Children []TreeStructureType `json:"children"`

	// The leaves pending from this node
	// required: false
	Leaves []LeafType `json:"leaves"`
}

TreeStructureType is a tree structure with a root and subtrees or leaves swagger:model

func (TreeStructureType) String

func (t TreeStructureType) String() string

type Type

type Type string
const (
	InfluxDB Type = "InfluxDB"
	Minio    Type = "Minio"
	MySQL    Type = "MySQL"
	Other    Type = "other"
	REST     Type = "rest"
)

type VDCInfo

type VDCInfo struct {
	Ports map[string]int
}

VDCInfo contains information about related to a VDC running in a kubernetes cluster swagger:model

type Value

type Value struct {
	AnythingArray []interface{}
	Bool          *bool
	Double        *float64
	String        *string
}

value of the property

Jump to

Keyboard shortcuts

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