abstract

package
v22.11.9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package abstract defines structures that will contain abstracted information of resources

Index

Constants

View Source
const (
	// DefaultUser Default Host user
	DefaultUser = "safescale"

	// DefaultVolumeMountPoint Default mount point for volumes
	DefaultVolumeMountPoint = "/data/"

	// DefaultBucketMountPoint Default mount point for containers
	DefaultBucketMountPoint = "/buckets/"

	// DefaultShareExportedPath Default path to be exported by nfs server
	DefaultShareExportedPath = "/shared/data"

	// DefaultShareMountPath Default path to be mounted to access a nfs directory
	DefaultShareMountPath = "/shared"
)

Default values

View Source
const (
	SingleHostNetworkCIDR = "10.42.0.0/16"
)

Variables

This section is empty.

Functions

func IsProvisioningError

func IsProvisioningError(err error) bool

IsProvisioningError detects provisioning errors

func ResourceDuplicateError

func ResourceDuplicateError(resource, name string) fail.Error

ResourceDuplicateError creates a ResourceAlreadyExists error

func ResourceForbiddenError

func ResourceForbiddenError(resource, name string) fail.Error

ResourceForbiddenError creates a ErrResourceForbidden error

func ResourceInvalidRequestError

func ResourceInvalidRequestError(resource, reason string) fail.Error

ResourceInvalidRequestError creates a ErrResourceInvalidRequest error

func ResourceNotAvailableError

func ResourceNotAvailableError(resource, name string) fail.Error

ResourceNotAvailableError creates a ResourceNotAvailable error

func ResourceNotFoundError

func ResourceNotFoundError(resource, name string) fail.Error

ResourceNotFoundError creates a ErrNotFound error

func ResourceTimeoutError

func ResourceTimeoutError(resource, name string, dur time.Duration) fail.Error

ResourceTimeoutError creates a ErrTimeout error

Types

type ClusterIdentity

type ClusterIdentity struct {
	Name          string                 `json:"name"`           // Name is the name of the cluster
	Flavor        clusterflavor.Enum     `json:"flavor"`         // Flavor tells what kind of cluster it is
	Complexity    clustercomplexity.Enum `json:"complexity"`     // Complexity is the mode of cluster
	Keypair       *KeyPair               `json:"keypair"`        // Keypair contains the key-pair used inside the Cluster
	AdminPassword string                 `json:"admin_password"` // contains the password of the cladm account
	Tags          map[string]string      `json:"tags,omitempty"`
	ID            string                 `json:"ID"`
}

ClusterIdentity contains the bare minimum information about a cluster

func NewClusterIdentity

func NewClusterIdentity() *ClusterIdentity

NewClusterIdentity ...

func (ClusterIdentity) Clone

func (instance ClusterIdentity) Clone() (data.Clonable, error)

Clone makes a copy of the instance satisfies interface data.Clonable

func (*ClusterIdentity) Deserialize

func (instance *ClusterIdentity) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and reinstantiates a ClusterIdentity

func (ClusterIdentity) GetID

func (instance ClusterIdentity) GetID() (string, error)

GetID returns the ID of the cluster Satisfies interface data.Identifiable

func (ClusterIdentity) GetName

func (instance ClusterIdentity) GetName() string

GetName returns the name of the cluster Satisfies interface data.Identifiable

func (*ClusterIdentity) IsNull

func (instance *ClusterIdentity) IsNull() bool

IsNull ...

func (ClusterIdentity) OK

func (instance ClusterIdentity) OK() bool

OK ...

func (*ClusterIdentity) Replace

func (instance *ClusterIdentity) Replace(p data.Clonable) (data.Clonable, error)

Replace replaces the content of the instance with the content of the parameter satisfies interface data.Clonable

func (*ClusterIdentity) Serialize

func (instance *ClusterIdentity) Serialize() ([]byte, fail.Error)

Serialize serializes ClusterIdentity instance into bytes (output json code)

type ClusterRequest

type ClusterRequest struct {
	Name                    string                 // contains the name of the cluster wanted
	CIDR                    string                 // defines the network to create
	Domain                  string                 // ...
	Complexity              clustercomplexity.Enum // is the implementation wanted, can be Small, Normal or Large
	Flavor                  clusterflavor.Enum     // tells what kind of cluster to create
	NetworkID               string                 // is the ID of the network to use; may be empty and in this case a new Network will be created
	Tenant                  string                 // contains the name of the tenant
	KeepOnFailure           bool                   // tells if resources have to be kept in case of failure (for further analysis)
	GatewaysDef             HostSizingRequirements // sizing of gateways
	MastersDef              HostSizingRequirements // sizing of Masters
	NodesDef                HostSizingRequirements // sizing of nodes
	InitialNodeCount        uint                   // contains the initial count of nodes to create (cannot be less than flavor requirement)
	InitialMasterCount      uint
	OS                      string              // contains the name of the linux distribution wanted
	DisabledDefaultFeatures map[string]struct{} // contains the list of features that should be installed by default, but we don't want actually
	Force                   bool                // set to True in order to ignore sizing recommendations
	FeatureParameters       []string            // contains parameter values of automatically installed Features
	DefaultSshPort          uint                // default ssh port for gateways // nolint
	Enabled                 []string            // enabled features
	OperatorUsername        string              // username of the operator
}

ClusterRequest defines what kind of Cluster is wanted

type Config

type Config interface {
	// Config gets a string configuration value and a
	// bool indicating whether the value was present or not.
	Config(name string) (interface{}, bool)
	// Get is an alias to Config()
	Get(name string) (interface{}, bool)
	// Set sets the configuration name to specified value
	Set(name string, value interface{})
	// GetString returns a string corresponding to the key, empty string if it doesn't exist
	GetString(name string) string
	// GetSliceOfStrings returns a slice of strings corresponding to the key, empty string slice if it doesn't exist
	GetSliceOfStrings(name string) []string
	// GetMapOfStrings returns a string map of strings corresponding to the key, empty map if it doesn't exist
	GetMapOfStrings(name string) map[string]string
	// GetInteger returns an integer corresponding to the key, 0 if it doesn't exist
	GetInteger(name string) int
}

Config represents key/value configuration.

type ConfigMap

type ConfigMap map[string]interface{}

ConfigMap is a map[string]string that implements the Config method.

func (ConfigMap) Config

func (c ConfigMap) Config(name string) (interface{}, bool)

Config gets a string configuration value and a bool indicating whether the value was present or not.

func (ConfigMap) Get

func (c ConfigMap) Get(name string) (interface{}, bool)

Get is an alias to Config()

func (ConfigMap) GetInteger

func (c ConfigMap) GetInteger(name string) int

GetInteger returns an integer corresponding to the key, 0 if it doesn't exist

func (ConfigMap) GetMapOfStrings

func (c ConfigMap) GetMapOfStrings(name string) map[string]string

GetMapOfStrings returns a string map of strings corresponding to the key, empty map if it doesn't exist

func (ConfigMap) GetSliceOfStrings

func (c ConfigMap) GetSliceOfStrings(name string) []string

GetSliceOfStrings returns a string slice corresponding to the key, empty string slice if it doesn't exist

func (ConfigMap) GetString

func (c ConfigMap) GetString(name string) string

GetString returns a string corresponding to the key, empty string if it doesn't exist

func (ConfigMap) Set

func (c ConfigMap) Set(name string, value interface{})

Set sets name configuration to value

type Enum

type Enum int

Enum ...

const (
	UnknownResource Enum = iota
	ClusterResource
	HostResource
	LabelResource
	NetworkResource
	ObjectStorageBucketResource
	SecurityGroupResource
	SubnetResource
	VolumeResource
	ShareResource
	FeatureResource

	VariableResource
	InitScript
	ProviderResource
	FirewallResource
	CustomResource
	GwInitScript
	OutputResource
	FirewallRuleResource
	VolumeAttachmentResource
	NicResource
)

type HostCore

type HostCore struct {
	ID                string            `json:"id,omitempty"`
	Name              string            `json:"name,omitempty"`
	PrivateKey        string            `json:"private_key,omitempty"`
	SSHPort           uint32            `json:"ssh_port,omitempty"`
	Password          string            `json:"password,omitempty"`
	LastState         hoststate.Enum    `json:"last_state"`         // Do not enable "omitempty", if state is "stopped", int value is 0, recognize as "not set" value during Serialize
	ProvisioningState hoststate.Enum    `json:"provisioning_state"` // Do not enable "omitempty", if state is "stopped", int value is 0, recognize as "not set" value during Serialize
	Tags              map[string]string `json:"tags,omitempty"`
}

HostCore contains the core information about a host This information should not change over time, but IT ACTUALLY happens

func NewHostCore

func NewHostCore() *HostCore

NewHostCore ...

func (HostCore) Clone

func (hc HostCore) Clone() (data.Clonable, error)

Clone does a deep-copy of the Host satisfies interface data.Clonable

func (*HostCore) Deserialize

func (hc *HostCore) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and instantiates an Host

func (*HostCore) GetID

func (hc *HostCore) GetID() (string, error)

GetID returns the ID of the host Satisfies interface data.Identifiable

func (*HostCore) GetName

func (hc *HostCore) GetName() string

GetName returns the name of the host Satisfies interface data.Identifiable

func (*HostCore) IsConsistent

func (hc *HostCore) IsConsistent() bool

IsConsistent tells if host struct is consistent

func (*HostCore) IsNull

func (hc *HostCore) IsNull() bool

IsNull tells if the instance should be considered as a null value

func (*HostCore) OK

func (hc *HostCore) OK() bool

OK ...

func (*HostCore) Replace

func (hc *HostCore) Replace(p data.Clonable) (data.Clonable, error)

Replace ... satisfies interface data.Clonable

func (*HostCore) Serialize

func (hc *HostCore) Serialize() ([]byte, fail.Error)

Serialize serializes Host instance into bytes (output json code)

func (*HostCore) SetID

func (hc *HostCore) SetID(id string) *HostCore

SetID is used to set ID field

func (*HostCore) SetName

func (hc *HostCore) SetName(name string) *HostCore

SetName is used to set Name field

type HostDescription

type HostDescription struct {
	Created time.Time `json:"created,omitempty"`  // tells when the host has been created
	Creator string    `json:"creator,omitempty"`  // contains information (forged) about the creator of a host
	Updated time.Time `json:"modified,omitempty"` // tells the last time the host has been modified
	Purpose string    `json:"purpose,omitempty"`  // contains a description of the use of a host
	Tenant  string    `json:"tenant"`             // contains the tenant name used to create the host
}

HostDescription contains description information for the host

type HostEffectiveSizing

type HostEffectiveSizing struct {
	Cores     int     `json:"cores,omitempty"`
	RAMSize   float32 `json:"ram_size,omitempty"`
	DiskSize  int     `json:"disk_size,omitempty"`
	GPUNumber int     `json:"gpu_number,omitempty"`
	GPUType   string  `json:"gpu_type,omitempty"`
	CPUFreq   float32 `json:"cpu_freq,omitempty"`
	ImageID   string  `json:"image_id,omitempty"`
}

HostEffectiveSizing ...

func NewHostEffectiveSizing

func NewHostEffectiveSizing() *HostEffectiveSizing

NewHostEffectiveSizing ...

func (*HostEffectiveSizing) IsNull

func (hse *HostEffectiveSizing) IsNull() bool

type HostFull

type HostFull struct {
	Core         *HostCore
	Sizing       *HostEffectiveSizing
	Networking   *HostNetworking
	Description  *HostDescription
	CurrentState hoststate.Enum `json:"current_state"`
}

HostFull groups information about host coming from provider

func NewHostFull

func NewHostFull() *HostFull

NewHostFull creates an instance of HostFull

func (*HostFull) GetID

func (hf *HostFull) GetID() (string, error)

GetID returns the ID of the host satisfies interface data.Identifiable

func (*HostFull) GetName

func (hf *HostFull) GetName() string

GetName returns the name of the host satisfies interface data.Identifiable

func (*HostFull) IsConsistent

func (hf *HostFull) IsConsistent() bool

IsConsistent returns true if the struct is consistent

func (*HostFull) IsNull

func (hf *HostFull) IsNull() bool

IsNull tells if the instance should be considered as a null value

func (*HostFull) OK

func (hf *HostFull) OK() bool

OK is a synonym to IsConsistent

func (*HostFull) SetName

func (hf *HostFull) SetName(name string) *HostFull

SetName is a setter to initialize field 'Name'

type HostList

type HostList []*HostFull

HostList contains a list of HostFull

type HostNetworking

type HostNetworking struct {
	IsGateway               bool              `json:"is_gateway,omitempty"`                 // Tells if host is a gateway of a network
	DefaultGatewayID        string            `json:"default_gateway_id,omitempty"`         // DEPRECATED: contains the ID of the default gateway
	DefaultGatewayPrivateIP string            `json:"default_gateway_private_ip,omitempty"` // DEPRECATED: contains the private IP of the default gateway
	DefaultSubnetID         string            `json:"default_network_id,omitempty"`         // contains the ID of the default subnet
	SubnetsByID             map[string]string `json:"networks_by_id,omitempty"`             // contains the name of each subnet bound to the host (indexed by ID)
	SubnetsByName           map[string]string `json:"networks_by_name,omitempty"`           // contains the ID of each subnet bound to the host (indexed by name)
	PublicIPv4              string            `json:"public_ip_v4,omitempty"`
	PublicIPv6              string            `json:"public_ip_v6,omitempty"`
	IPv4Addresses           map[string]string `json:"ipv4_addresses,omitempty"` // contains ipv4 (indexed by subnet ID) allocated to the host
	IPv6Addresses           map[string]string `json:"ipv6_addresses,omitempty"` // contains ipv6 (indexed by subnet ID) allocated to the host
}

HostNetworking contains subnets information related to Host

func NewHostNetworking

func NewHostNetworking() *HostNetworking

NewHostNetworking creates a new instance of HostNetworking

type HostRequest

type HostRequest struct {
	ResourceName     string              // ResourceName contains the name of the compute resource
	HostName         string              // HostName contains the hostname on the system (if empty, will use ResourceName)
	Subnets          []*Subnet           // lists the Subnets the host must be connected to
	SubnetNames      []string            // SubnetNames lists the names of the Subnets the host must be connected to
	DefaultRouteIP   string              // DefaultRouteIP is the IP used as default route
	TemplateID       string              // TemplateID is ID of the template used to size the host (see SelectTemplates)
	TemplateRef      string              // TemplateRef is the name or ID of the template used to size the host (see SelectTemplates)
	ImageID          string              // ImageID is the ID of the image that contains the server's OS and initial state.
	ImageRef         string              // ImageRef is the original reference of the image requested
	KeyPair          *KeyPair            // KeyPair is the (optional) specific KeyPair to use (if not provided, a new KeyPair will be generated)
	SSHPort          uint32              // contains the port to use for SSH
	Password         string              // Password contains the password of OperatorUsername account, usable on host console only
	DiskSize         int                 // DiskSize allows asking for a specific size for system disk (in GB)
	Single           bool                // Single tells if the Host is single
	PublicIP         bool                // PublicIP a flag telling if the host must have a public IP
	IsGateway        bool                // IsGateway tells if the host will act as a gateway
	KeepOnFailure    bool                // KeepOnFailure tells if resource must be kept on failure
	SecurityGroupIDs map[string]struct{} // List of Security Groups to attach to Host (using map as dict)
}

HostRequest represents requirements to create host

type HostSizingRequirements

type HostSizingRequirements struct {
	MinCores    int
	MaxCores    int
	MinRAMSize  float32
	MaxRAMSize  float32
	MinDiskSize int
	MaxDiskSize int
	MinGPU      int
	MinCPUFreq  float32
	Image       string
	Template    string // if != "", describes the template to use and disables the use of other fields
}

HostSizingRequirements represents host sizing requirements to fulfill

func (HostSizingRequirements) Equals

func (*HostSizingRequirements) LowerOrEqualThan

func (hsr *HostSizingRequirements) LowerOrEqualThan(y *HostSizingRequirements) (bool, error)

LowerOrEqualThan compares host sizing requirements, returns true if hsr requirements are lower or equal than y

func (*HostSizingRequirements) LowerThan

LowerThan compares host sizing requirements, returns true if hsr requirements are lower than y

type HostTemplate

type HostTemplate struct {
	Cores     int     `json:"cores,omitempty"`
	RAMSize   float32 `json:"ram_size,omitempty"`
	DiskSize  int     `json:"disk_size,omitempty"`
	GPUNumber int     `json:"gpu_number,omitempty"`
	GPUType   string  `json:"gpu_type,omitempty"`
	CPUFreq   float32 `json:"cpu_freq,omitempty"`
	CPUPerf   float32 `json:"cpu_perf,omitempty"`
	ID        string  `json:"id,omitempty"`
	Name      string  `json:"name,omitempty"`
}

HostTemplate ...

func (HostTemplate) OK

func (ht HostTemplate) OK() bool

OK ...

type Image

type Image struct {
	ID          string `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	URL         string `json:"url,omitempty"`
	Description string `json:"description,omitempty"`
	StorageType string `json:"storage_type,omitempty"`
	DiskSize    int64  `json:"disk_size_Gb,omitempty"`
	Publisher   string `json:"publisher,omitempty"`
	Offer       string `json:"offer,omitempty"`
	Sku         string `json:"sku,omitempty"`
}

Image represents an OS image

func (Image) OK

func (i Image) OK() bool

OK ...

type KeyPair

type KeyPair struct {
	ID         string `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	PrivateKey string `json:"private_key"`
	PublicKey  string `json:"public_key"`
}

KeyPair represents a SSH key pair

func NewKeyPair

func NewKeyPair(name string) (*KeyPair, fail.Error)

NewKeyPair creates a *resources.KeyPair

func (*KeyPair) IsNull

func (kp *KeyPair) IsNull() bool

IsNull tells if the keypair is a null value

type Label

type Label struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	HasDefault   bool   `json:"has_default"` // if false, this represents a Tag
	DefaultValue string `json:"default_value,omitempty"`
}

func NewLabel

func NewLabel() *Label

NewLabel creates a new empty Label...

func (Label) Clone

func (t Label) Clone() (data.Clonable, error)

Clone ... satisfies interface data.Clonable

func (*Label) Deserialize

func (t *Label) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and restores a Tag

func (*Label) GetID

func (t *Label) GetID() (string, error)

GetID returns the ID of the tag Satisfies interface data.Identifiable

func (*Label) GetName

func (t *Label) GetName() string

GetName returns the name of the tag Satisfies interface data.Identifiable

func (*Label) IsNull

func (t *Label) IsNull() bool

IsNull ... satisfies interface data.Clonable

func (*Label) IsTag

func (t *Label) IsTag() bool

IsTag tells of the Label represents a Tag (ie a Label without value)

func (Label) OK

func (t Label) OK() bool

OK is a synonym for Valid

func (*Label) Replace

func (t *Label) Replace(p data.Clonable) (data.Clonable, error)

Replace ... satisfies interface data.Clonable

func (*Label) Serialize

func (t *Label) Serialize() ([]byte, fail.Error)

Serialize serializes instance into bytes (output json code)

func (*Label) Valid

func (t *Label) Valid() bool

Valid checks if content of Label is valid

type Network

type Network struct {
	ID         string            `json:"id"`                    // ID for the network (from provider)
	Name       string            `json:"name"`                  // name of the network
	CIDR       string            `json:"mask"`                  // network in CIDR notation (if it has a meaning...)
	DNSServers []string          `json:"dns_servers,omitempty"` // list of dns servers to be used inside the Network/VPC
	Imported   bool              `json:"imported,omitempty"`    // tells if the Network has been imported (making it not deletable by SafeScale)
	Tags       map[string]string `json:"tags,omitempty"`

	Domain             string         `json:"domain,omitempty"`               // DEPRECATED: contains the domain used to define host FQDN
	GatewayID          string         `json:"gateway_id,omitempty"`           // DEPRECATED: contains the id of the host acting as primary gateway for the network
	SecondaryGatewayID string         `json:"secondary_gateway_id,omitempty"` // DEPRECATED: contains the id of the host acting as secondary gateway for the network
	VIP                *VirtualIP     `json:"vip,omitempty"`                  // DEPRECATED: contains the VIP of the network if created with HA
	IPVersion          ipversion.Enum `json:"ip_version,omitempty"`           // DEPRECATED: IPVersion is IPv4 or IPv6 (see IPVersion)
	Subnetworks        []SubNetwork   `json:"subnetworks,omitempty"`          // DEPRECATED: deprecated
}

Network represents a virtual network

func NewNetwork

func NewNetwork() *Network

NewNetwork initializes a new instance of Network

func (Network) Clone

func (n Network) Clone() (data.Clonable, error)

Clone ... satisfies interface data.Clonable

func (*Network) Deserialize

func (n *Network) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and reinstantiates a Network

func (*Network) GetID

func (n *Network) GetID() (string, error)

GetID ... satisfies interface data.Identifiable

func (*Network) GetName

func (n *Network) GetName() string

GetName ... satisfies interface data.Identifiable

func (*Network) IsNull

func (n *Network) IsNull() bool

IsNull ... satisfies interface data.Clonable

func (*Network) OK

func (n *Network) OK() bool

OK ...

func (*Network) Replace

func (n *Network) Replace(p data.Clonable) (data.Clonable, error)

Replace ... satisfies interface data.Clonable

func (*Network) Serialize

func (n *Network) Serialize() ([]byte, fail.Error)

Serialize serializes Network instance into bytes (output json code)

type NetworkRequest

type NetworkRequest struct {
	Name          string   // contains name of Network/VPC
	CIDR          string   // contains the CIDR of the Network/VPC
	DNSServers    []string // list of dns servers to be used inside the Network/VPC
	KeepOnFailure bool     // KeepOnFailure tells if resources have to be kept in case of failure (default behavior is to delete them)
}

NetworkRequest represents network requirements to create a network/VPC where CIDR contains a non-routable network like "192.0.2.0/24" or "2001:db8::/32", as defined in RFC 4632 and RFC 4291.

type ObjectStorageBucket

type ObjectStorageBucket struct {
	ID         string `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	Host       string `json:"host,omitempty"`
	MountPoint string `json:"mountPoint,omitempty"`
}

ObjectStorageBucket abstracts an Objet Storage container (also known as bucket in some implementations)

func NewObjectStorageBucket

func NewObjectStorageBucket() *ObjectStorageBucket

NewObjectStorageBucket ...

func (ObjectStorageBucket) Clone

func (instance ObjectStorageBucket) Clone() (data.Clonable, error)

Clone does a deep-copy of the Host

satisfies interface data.Clonable

func (*ObjectStorageBucket) Deserialize

func (instance *ObjectStorageBucket) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and instantiates an ObjectStorageItem

func (ObjectStorageBucket) GetID

func (instance ObjectStorageBucket) GetID() (string, error)

GetID returns the ID of the host Satisfies interface data.Identifiable

func (ObjectStorageBucket) GetName

func (instance ObjectStorageBucket) GetName() string

GetName name returns the name of the host Satisfies interface data.Identifiable

func (ObjectStorageBucket) IsConsistent

func (instance ObjectStorageBucket) IsConsistent() bool

IsConsistent tells if host struct is consistent

func (*ObjectStorageBucket) IsNull

func (instance *ObjectStorageBucket) IsNull() bool

func (ObjectStorageBucket) OK

func (instance ObjectStorageBucket) OK() bool

OK ...

func (*ObjectStorageBucket) Replace

func (instance *ObjectStorageBucket) Replace(p data.Clonable) (data.Clonable, error)

Replace ...

satisfies interface data.Clonable

func (*ObjectStorageBucket) Serialize

func (instance *ObjectStorageBucket) Serialize() ([]byte, fail.Error)

Serialize serializes Host 'instance' into bytes (output json code)

type ObjectStorageItem

type ObjectStorageItem struct {
	BucketName string
	ItemID     string
	ItemName   string
	Metadata   ObjectStorageItemMetadata
}

ObjectStorageItem is an abstracted representation of an object in object storage

func (ObjectStorageItem) GetID

func (osi ObjectStorageItem) GetID() (string, error)

GetID returns the ID of the host Satisfies interface data.Identifiable

func (ObjectStorageItem) GetName

func (osi ObjectStorageItem) GetName() string

GetName returns the name of the host Satisfies interface data.Identifiable

type ObjectStorageItemMetadata

type ObjectStorageItemMetadata map[string]interface{}

ObjectStorageItemMetadata ...

func (ObjectStorageItemMetadata) Clone

Clone creates a copy of ObjectMetadata

type PublicIP added in v22.11.3

type PublicIP struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"` // == IP
	Kind        ipversion.Enum    `json:"kind,omitempty"`
	Description string            `json:"description,omitempty"`
	MacAddress  string            `json:"mac_address;omitempty"`
	Tags        map[string]string `json:"tags,omitempty"`
}

PublicIP represents a public IP

func NewPublicIP added in v22.11.3

func NewPublicIP() *PublicIP

NewPublicIP ...

func (PublicIP) Clone added in v22.11.3

func (pip PublicIP) Clone() (data.Clonable, error)

Clone ... satisfies interface data.Clonable

func (*PublicIP) Deserialize added in v22.11.3

func (pip *PublicIP) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and restores a Volume

func (*PublicIP) GetID added in v22.11.3

func (pip *PublicIP) GetID() string

GetID returns the ID of the volume Satisfies interface data.Identifiable

func (*PublicIP) GetName added in v22.11.3

func (pip *PublicIP) GetName() string

GetName returns the name of the volume Satisfies interface data.Identifiable

func (*PublicIP) IsNull added in v22.11.3

func (pip *PublicIP) IsNull() bool

IsNull ... satisfies interface data.Clonable

func (*PublicIP) OK added in v22.11.3

func (pip *PublicIP) OK() bool

OK ...

func (*PublicIP) Replace added in v22.11.3

func (pip *PublicIP) Replace(p data.Clonable) (data.Clonable, error)

Replace ...

satisfies interface data.Clonable

func (*PublicIP) Serialize added in v22.11.3

func (pip *PublicIP) Serialize() ([]byte, fail.Error)

Serialize serializes instance into bytes (output json code)

type PublicIPRequest added in v22.11.3

type PublicIPRequest struct {
	Name string         `json:"name"`
	Kind ipversion.Enum `json:"kind,omitempty"`
}

PublicIPRequest represents a PublicIP request

type RenderedContent added in v22.11.9

type RenderedContent struct {
	Name     string `json:"Name"`
	Content  string `json:"Content"`
	Complete bool   `json:"Complete"`
}

type SecurityGroup

type SecurityGroup struct {
	ID               string             `json:"id"`                    // ID of the group
	Name             string             `json:"name"`                  // name of the group
	Network          string             `json:"network,omitempty"`     // Contains the ID of the Network owning the Security Group
	Description      string             `json:"description,omitempty"` // description of the group
	Rules            SecurityGroupRules `json:"rules"`                 // rules of the Security Group
	DefaultForSubnet string             `json:"default_for_subnets"`   // lists the ID of the subnet for which this SecurityGroup is considered as default (to be able to prevent removal of Subnet default Security Group until removal of the Subnet itself)
	DefaultForHost   string             `json:"default_for_hosts"`     // lists the ID of the host for which this SecurityGroup is considered as default (to be able to prevent removal of default Security Group until removal of the Host itself)
}

SecurityGroup represents a security group Note: by design, security group names must be unique tenant-wide

func NewSecurityGroup

func NewSecurityGroup() *SecurityGroup

NewSecurityGroup ...

func (SecurityGroup) Clone

func (instance SecurityGroup) Clone() (data.Clonable, error)

Clone does a deep-copy of the SecurityGroup satisfies interface data.Clonable

func (*SecurityGroup) Deserialize

func (instance *SecurityGroup) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and reinstantiates a SecurityGroup

func (*SecurityGroup) GetID

func (instance *SecurityGroup) GetID() (string, error)

GetID returns the ID of the securitygroup Satisfies interface data.Identifiable

func (*SecurityGroup) GetName

func (instance *SecurityGroup) GetName() string

GetName returns the name of the securitygroup Satisfies interface data.Identifiable

func (*SecurityGroup) GetNetworkID

func (instance *SecurityGroup) GetNetworkID() string

GetNetworkID returns the networkId of the securitygroup

func (SecurityGroup) IsComplete

func (instance SecurityGroup) IsComplete() bool

IsComplete tells if the content of the security group is complete

func (SecurityGroup) IsConsistent

func (instance SecurityGroup) IsConsistent() bool

IsConsistent tells if the content of the security group is consistent

func (*SecurityGroup) IsNull

func (instance *SecurityGroup) IsNull() bool

IsNull tells if the SecurityGroup is a null value

func (*SecurityGroup) RemoveRuleByIndex

func (instance *SecurityGroup) RemoveRuleByIndex(index int) fail.Error

RemoveRuleByIndex removes a rule identified by its index and returns the corresponding SecurityGroupRules

func (*SecurityGroup) Replace

func (instance *SecurityGroup) Replace(p data.Clonable) (data.Clonable, error)

Replace ... satisfies interface data.Clonable

func (*SecurityGroup) Serialize

func (instance *SecurityGroup) Serialize() ([]byte, fail.Error)

Serialize serializes instance into bytes (output json code)

func (*SecurityGroup) SetID

func (instance *SecurityGroup) SetID(id string) *SecurityGroup

SetID sets the value of field ID in sg

func (*SecurityGroup) SetName

func (instance *SecurityGroup) SetName(name string) *SecurityGroup

SetName sets the value of field Name in sg

func (*SecurityGroup) SetNetworkID

func (instance *SecurityGroup) SetNetworkID(networkID string) *SecurityGroup

SetNetworkID sets the value of field NetworkID in sg

type SecurityGroupRule

type SecurityGroupRule struct {
	IDs         []string                        `json:"ids"`                   // ids of the rule (an abstracted rule may be split to several provider rules)
	Description string                          `json:"description,omitempty"` // description of the rule
	EtherType   ipversion.Enum                  `json:"ether_type,omitempty"`  // IPv4 or IPv6
	Direction   securitygroupruledirection.Enum `json:"direction"`             // ingress (input) or egress (output)
	Protocol    string                          `json:"protocol,omitempty"`    // concerned protocol
	PortFrom    int32                           `json:"port_from,omitempty"`   // first port of the rule
	PortTo      int32                           `json:"port_to,omitempty"`     // last port of the rule
	Sources     []string                        `json:"sources"`               // concerned sources (depending on Direction); can be array of IP ranges or array of Security Group IDs (no mix)
	Targets     []string                        `json:"targets"`               // concerned source or target (depending on Direction); can be array of IP ranges or array of Security Group IDs (no mix)
	Priority    int                             `json:"priority"`              // priority of the rule
	Name        string                          `json:"name,omitempty"`        // name of the rule
	Network     string                          `json:"network,omitempty"`     // network of the rule, needed for Azure
}

SecurityGroupRule represents a rule of a SecurityGroup

func NewSecurityGroupRule

func NewSecurityGroupRule() *SecurityGroupRule

NewSecurityGroupRule creates an abstract.SecurityGroupRule

func (*SecurityGroupRule) Clone

func (instance *SecurityGroupRule) Clone() (data.Clonable, error)

Clone does a deep-copy of the SecurityGroup

satisfies interface data.Clonable

func (*SecurityGroupRule) EqualTo

func (instance *SecurityGroupRule) EqualTo(in *SecurityGroupRule) bool

EqualTo is a strict equality tester between 2 rules

func (*SecurityGroupRule) EquivalentTo

func (instance *SecurityGroupRule) EquivalentTo(in *SecurityGroupRule) bool

EquivalentTo compares 2 rules, except ID and Description, to tell if the target is comparable

func (*SecurityGroupRule) IsNull

func (instance *SecurityGroupRule) IsNull() bool

IsNull tells if the Security Group Rule is a null value

func (*SecurityGroupRule) Replace

func (instance *SecurityGroupRule) Replace(p data.Clonable) (data.Clonable, error)

Replace ... satisfies interface data.Clonable

func (*SecurityGroupRule) SourcesConcernGroups

func (instance *SecurityGroupRule) SourcesConcernGroups() (bool, fail.Error)

SourcesConcernGroups figures out if rule contains Security Group IDs as sources By design, CIDR and SG ID cannot be mixed

func (*SecurityGroupRule) TargetsConcernGroups

func (instance *SecurityGroupRule) TargetsConcernGroups() (bool, fail.Error)

TargetsConcernGroups figures out if rule contains Security Group IDs as targets By design, CIDR and SG ID cannot be mixed

func (*SecurityGroupRule) Validate

func (instance *SecurityGroupRule) Validate() fail.Error

Validate returns an error if the content of the rule is incomplete

type SecurityGroupRules

type SecurityGroupRules []*SecurityGroupRule

SecurityGroupRules ...

func (SecurityGroupRules) Clone

Clone does a deep-copy of the SecurityGroupRules

func (SecurityGroupRules) IndexOfEquivalentRule

func (sgrs SecurityGroupRules) IndexOfEquivalentRule(rule *SecurityGroupRule) (int, fail.Error)

IndexOfEquivalentRule returns the index of the rule equivalent to the one provided

func (SecurityGroupRules) IndexOfRuleByID

func (sgrs SecurityGroupRules) IndexOfRuleByID(id string) (int, fail.Error)

IndexOfRuleByID returns the index of the rule containing the provider rule ID provided

type Serializable added in v22.11.4

type Serializable interface {
	Serialize() ([]byte, fail.Error)
	Deserialize(buf []byte) (ferr fail.Error)
}

Serializable to transform structs from and to json

type StoredCPUInfo

type StoredCPUInfo struct {
	ID           string `bow:"key"`
	TenantName   string `json:"tenant_name,omitempty"`
	TemplateID   string `json:"template_id,omitempty"`
	TemplateName string `json:"template_name,omitempty"`
	ImageID      string `json:"image_id,omitempty"`
	ImageName    string `json:"image_name,omitempty"`
	LastUpdated  string `json:"last_updated,omitempty"`

	NumberOfCPU    int     `json:"number_of_cpu,omitempty"`
	NumberOfCore   int     `json:"number_of_core,omitempty"`
	NumberOfSocket int     `json:"number_of_socket,omitempty"`
	CPUFrequency   float64 `json:"cpu_frequency_Ghz,omitempty"`
	CPUArch        string  `json:"cpu_arch,omitempty"`
	Hypervisor     string  `json:"hypervisor,omitempty"`
	CPUModel       string  `json:"cpu_model,omitempty"`
	RAMSize        float64 `json:"ram_size_Gb,omitempty"`
	RAMFreq        float64 `json:"ram_freq,omitempty"`
	GPU            int     `json:"gpu,omitempty"`
	GPUModel       string  `json:"gpu_model,omitempty"`
	DiskSize       int64   `json:"disk_size_Gb,omitempty"`
	MainDiskType   string  `json:"main_disk_type"`
	MainDiskSpeed  float64 `json:"main_disk_speed_MBps"`
	SampleNetSpeed float64 `json:"sample_net_speed_KBps"`
	EphDiskSize    int64   `json:"eph_disk_size_Gb"`
	PricePerHour   float64 `json:"price_in_dollars_hour"`
}

StoredCPUInfo ...

type SubNetwork

type SubNetwork struct {
	CIDR string `json:"subnetmask,omitempty"` // DEPRECATED: deprecated
	ID   string `json:"subnetid,omitempty"`   // DEPRECATED: deprecated
}

SubNetwork is deprecated

type Subnet

type Subnet struct {
	ID                      string            `json:"id"`                                   // ID of the subnet (from provider)
	Name                    string            `json:"name"`                                 // Name of the subnet
	Network                 string            `json:"network"`                              // parent Network of the subnet
	CIDR                    string            `json:"mask"`                                 // ip network in CIDR notation
	Domain                  string            `json:"domain,omitempty"`                     // contains the domain used to define host FQDN
	DNSServers              []string          `json:"dns_servers,omitempty"`                // contains the DNSServers used on the subnet
	GatewayIDs              []string          `json:"gateway_id,omitempty"`                 // contains the id of the host(s) acting as gateway(s) for the subnet
	VIP                     *VirtualIP        `json:"vip,omitempty"`                        // contains the VIP of the network if created with HA
	IPVersion               ipversion.Enum    `json:"ip_version,omitempty"`                 // IPVersion is IPv4 or IPv6 (see IPVersion)
	State                   subnetstate.Enum  `json:"status,omitempty"`                     // indicates the current state of the Subnet
	GWSecurityGroupID       string            `json:"gw_security_group_id,omitempty"`       // Contains the ID of the Security Group for external access of gateways in Subnet
	PublicIPSecurityGroupID string            `json:"publicip_security_group_id,omitempty"` // contains the ID of the Security Group for hosts with public IP in Subnet
	InternalSecurityGroupID string            `json:"internal_security_group_id,omitempty"` // contains the ID of the security group for internal access of hosts
	DefaultSSHPort          uint32            `json:"default_ssh_port,omitempty"`           // contains the port to use for SSH by default on gateways in the Subnet
	SingleHostCIDRIndex     uint              `json:"single_host_cidr_index,omitempty"`     // if > 0, contains the index of the CIDR in the single Host Network
	Tags                    map[string]string `json:"tags,omitempty"`
}

Subnet represents a subnet

func NewSubnet

func NewSubnet() *Subnet

NewSubnet initializes a new instance of Subnet

func (Subnet) Clone

func (s Subnet) Clone() (data.Clonable, error)

Clone ... satisfies interface data.Clonable

func (*Subnet) Deserialize

func (s *Subnet) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and reinstantiates a Subnet

func (*Subnet) GetCIDR

func (s *Subnet) GetCIDR() string

func (*Subnet) GetID

func (s *Subnet) GetID() (string, error)

GetID ... satisfies interface data.Identifiable

func (*Subnet) GetName

func (s *Subnet) GetName() string

GetName ... satisfies interface data.Identifiable

func (*Subnet) IsNull

func (s *Subnet) IsNull() bool

IsNull ... satisfies interface data.Clonable

func (*Subnet) OK

func (s *Subnet) OK() bool

OK ...

func (*Subnet) Replace

func (s *Subnet) Replace(p data.Clonable) (data.Clonable, error)

Replace ... satisfies interface data.Clonable

func (*Subnet) Serialize

func (s *Subnet) Serialize() ([]byte, fail.Error)

Serialize serializes instance into bytes (output json code)

type SubnetRequest

type SubnetRequest struct {
	NetworkID      string         // contains the ID of the parent Network
	Name           string         // contains the name of the subnet (must be unique in a network)
	IPVersion      ipversion.Enum // must be IPv4 or IPv6 (see IPVersion)
	CIDR           string         // CIDR mask
	DNSServers     []string       // Contains the DNS servers to configure
	Domain         string         // contains the DNS suffix to use for this network
	HA             bool           // tells if 2 gateways and a VIP needs to be created; the VIP IP address will be used as gateway
	ImageRef       string         // contains the reference (ID or name) of the image requested for gateway(s)
	DefaultSSHPort uint32         // contains the port to use for SSH on all hosts of the subnet by default
	KeepOnFailure  bool           // tells if resources have to be kept in case of failure (default behavior is to delete them)
	ClusterID      string
	GwSizing       *HostSizingRequirements
}

SubnetRequest represents requirements to create a subnet where Mask is defined in CIDR notation like "192.0.2.0/24" or "2001:db8::/32", as defined in RFC 4632 and RFC 4291.

type VirtualIP

type VirtualIP struct {
	ID        string      `json:"id,omitempty"`
	Name      string      `json:"name,omitempty"`
	SubnetID  string      `json:"subnet_id,omitempty"`
	PrivateIP string      `json:"private_ip,omitempty"`
	PublicIP  string      `json:"public_ip,omitempty"`
	Hosts     []*HostCore `json:"hosts,omitempty"`

	NetworkID string `json:"network_id,omitempty"` // DEPRECATED: deprecated, replaced by SubnetID
}

VirtualIP is a structure containing information needed to manage VIP (virtual IP)

func NewVirtualIP

func NewVirtualIP() *VirtualIP

NewVirtualIP ...

func (VirtualIP) Clone

func (vip VirtualIP) Clone() (data.Clonable, error)

Clone ... satisfies interface data.Clonable

func (*VirtualIP) IsNull

func (vip *VirtualIP) IsNull() bool

IsNull ... satisfies interface data.Clonable

func (*VirtualIP) Replace

func (vip *VirtualIP) Replace(p data.Clonable) (data.Clonable, error)

Replace ... satisfies interface data.Clonable interface

type Volume

type Volume struct {
	ID    string            `json:"id,omitempty"`
	Name  string            `json:"name,omitempty"`
	Size  int               `json:"size,omitempty"`
	Speed volumespeed.Enum  `json:"speed"`
	State volumestate.Enum  `json:"state"`
	Tags  map[string]string `json:"tags,omitempty"`
}

Volume represents a block volume

func NewVolume

func NewVolume() *Volume

NewVolume ...

func (Volume) Clone

func (v Volume) Clone() (data.Clonable, error)

Clone ... satisfies interface data.Clonable

func (*Volume) Deserialize

func (v *Volume) Deserialize(buf []byte) (ferr fail.Error)

Deserialize reads json code and restores a Volume

func (*Volume) GetID

func (v *Volume) GetID() (string, error)

GetID returns the ID of the volume Satisfies interface data.Identifiable

func (*Volume) GetName

func (v *Volume) GetName() string

GetName returns the name of the volume Satisfies interface data.Identifiable

func (*Volume) IsNull

func (v *Volume) IsNull() bool

IsNull ... satisfies interface data.Clonable

func (*Volume) OK

func (v *Volume) OK() bool

OK ...

func (*Volume) Replace

func (v *Volume) Replace(p data.Clonable) (data.Clonable, error)

Replace ...

satisfies interface data.Clonable

func (*Volume) Serialize

func (v *Volume) Serialize() ([]byte, fail.Error)

Serialize serializes instance into bytes (output json code)

type VolumeAttachment

type VolumeAttachment struct {
	ID         string `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	VolumeID   string `json:"volume,omitempty"`
	ServerID   string `json:"host,omitempty"`
	Device     string `json:"device,omitempty"`
	MountPoint string `json:"mountpoint,omitempty"`
	Format     string `json:"format,omitempty"`
}

VolumeAttachment represents a volume attachment

func NewVolumeAttachment

func NewVolumeAttachment() *VolumeAttachment

func (*VolumeAttachment) IsNull

func (va *VolumeAttachment) IsNull() bool

func (*VolumeAttachment) OK

func (va *VolumeAttachment) OK() bool

OK ...

type VolumeAttachmentRequest

type VolumeAttachmentRequest struct {
	Name     string `json:"name,omitempty"`
	VolumeID string `json:"volume_id,omitempty"`
	HostID   string `json:"host_id,omitempty"`
}

VolumeAttachmentRequest represents a volume attachment request

type VolumeRequest

type VolumeRequest struct {
	Name  string           `json:"name,omitempty"`
	Size  int              `json:"size,omitempty"`
	Speed volumespeed.Enum `json:"speed"`
}

VolumeRequest represents a volume request

Directories

Path Synopsis
filters

Jump to

Keyboard shortcuts

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