Documentation
¶
Overview ¶
Package resources defines the interface of various abstracted resources used by SafeScale
Package resources ...
Package resources ...
Index ¶
- Constants
- type Bucket
- type Callback
- type Cluster
- type Consistent
- type Feature
- type FeatureSettings
- type Host
- type IndexedListOfClusterNodes
- type Label
- type Metadata
- type Network
- type Results
- type SecurityGroup
- type SecurityGroupActivation
- type SecurityGroupMark
- type Share
- type Subnet
- type Targetable
- type UnitResult
- type UnitResults
- type Volume
Constants ¶
const ( MarkSecurityGroupAsDefault = true // mark the Security Group as a default MarkSecurityGroupAsSupplemental = false // mark the Security Group as supplemental KeepCurrentSecurityGroupMark = false // Do not change current Security Group mark )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket interface {
Metadata
data.Identifiable
Consistent
GetName() string
Browse(ctx context.Context, callback func(bucket *abstract.ObjectStorageBucket) fail.Error) fail.Error
Create(ctx context.Context, name string) fail.Error
Delete(ctx context.Context) fail.Error
Mount(ctx context.Context, hostname string, path string) fail.Error
ToProtocol(ctx context.Context) (*protocol.BucketResponse, fail.Error)
Unmount(ctx context.Context, hostname string) fail.Error
}
Bucket GetBucket defines the interface to manipulate Object Storage buckets
type Cluster ¶
type Cluster interface {
Metadata
Targetable
Consistent
GetName() string
AddFeature(ctx context.Context, name string, vars data.Map, settings FeatureSettings) (Results, fail.Error) // adds feature on cluster
AddNodes(ctx context.Context, name string, count uint, def abstract.HostSizingRequirements, parameters data.Map, keepOnFailure bool) ([]Host, fail.Error) // adds several nodes
Browse(ctx context.Context, callback func(*abstract.ClusterIdentity) fail.Error) fail.Error // browse in metadata clusters and execute a callback on each entry
CheckFeature(ctx context.Context, name string, vars data.Map, settings FeatureSettings) (Results, fail.Error) // checks feature on cluster
Create(ctx context.Context, req abstract.ClusterRequest) fail.Error // creates a new cluster and save its metadata
DeleteSpecificNode(ctx context.Context, hostID string, selectedMasterID string) fail.Error // deletes a node identified by its ID
Delete(ctx context.Context, force bool) fail.Error // deletes the cluster (Delete is not used to not collision with metadata)
FindAvailableMaster(ctx context.Context) (Host, fail.Error) // returns ID of the first master available to execute order
GetIdentity(ctx context.Context) (abstract.ClusterIdentity, fail.Error) // returns Cluster Identity
GetFlavor(ctx context.Context) (clusterflavor.Enum, fail.Error) // returns the flavor of the cluster
GetComplexity(ctx context.Context) (clustercomplexity.Enum, fail.Error) // returns the complexity of the cluster
GetAdminPassword(ctx context.Context) (string, fail.Error) // returns the password of the cluster admin account
GetKeyPair(ctx context.Context) (*abstract.KeyPair, fail.Error) // returns the key pair used in the cluster
GetNetworkConfig(ctx context.Context) (*propertiesv3.ClusterNetwork, fail.Error) // returns network configuration of the cluster
GetState(ctx context.Context) (clusterstate.Enum, fail.Error) // returns the current state of the cluster
IsFeatureInstalled(ctx context.Context, name string) (found bool, ferr fail.Error) // tells if a feature is installed in Cluster using only metadata
ListEligibleFeatures(ctx context.Context) ([]Feature, fail.Error) // returns the list of eligible features for the Cluster
ListInstalledFeatures(ctx context.Context) ([]Feature, fail.Error) // returns the list of installed features on the Cluster
ListMasters(ctx context.Context) (IndexedListOfClusterNodes, fail.Error) // lists the node instances corresponding to masters (if there is such masters in the flavor...)
ListNodes(ctx context.Context) (IndexedListOfClusterNodes, fail.Error) // lists node instances corresponding to the nodes in the cluster
RemoveFeature(ctx context.Context, name string, vars data.Map, settings FeatureSettings) (Results, fail.Error) // removes feature from cluster
Shrink(ctx context.Context, name string, count uint) ([]*propertiesv3.ClusterNode, fail.Error) // reduce the size of the cluster of 'count' nodes (the last created)
Start(ctx context.Context) fail.Error // starts the cluster
Stop(ctx context.Context) fail.Error // stops the cluster
ToProtocol(ctx context.Context) (*protocol.ClusterResponse, fail.Error)
}
Cluster is the interface of all cluster object instances
type Consistent ¶
type Feature ¶
type Feature interface {
data.Identifiable
GetName() string
Add(ctx context.Context, t Targetable, v data.Map, fs FeatureSettings) (Results, fail.Error) // installs the feature on the target
Applicable(ctx context.Context, tg Targetable) (bool, fail.Error) // tells if the feature is installable on the target
Check(ctx context.Context, t Targetable, v data.Map, fs FeatureSettings) (Results, fail.Error) // check if feature is installed on target
GetDisplayFilename(ctx context.Context) string // displays the filename of display (optionally adding '[embedded]' for embedded features)
GetFilename(ctx context.Context) (string, fail.Error) // returns the filename of the feature
Dependencies(ctx context.Context) (map[string]struct{}, fail.Error) // returns the other features needed as requirements
ListParametersWithControl(ctx context.Context) []string // returns a list of parameter containing version information
Remove(ctx context.Context, t Targetable, v data.Map, fs FeatureSettings) (Results, fail.Error) // uninstalls the feature from the target
ToProtocol(ctx context.Context) *protocol.FeatureResponse
}
Feature defines the interface of feature
type FeatureSettings ¶
type FeatureSettings struct {
SkipProxy bool // to tell not to try to set reverse proxy
Serialize bool // force not to parallel hosts in step
SkipFeatureRequirements bool // tells not to install required features
SkipSizingRequirements bool // tells not to check sizing requirements
AddUnconditionally bool // tells to not check before addition (no effect for check or removal)
IgnoreSuitability bool // allows to not check if the feature is suitable for the target
IgnoreTainted bool
}
FeatureSettings are used to tune the feature
type Host ¶
type Host interface {
Metadata
Targetable
Consistent
GetName() string
BindLabel(ctx context.Context, labelInstance Label, value string) fail.Error
BindSecurityGroup(ctx context.Context, sg SecurityGroup, enable SecurityGroupActivation) fail.Error // Binds a security group to host
Browse(ctx context.Context, callback func(*abstract.HostCore) fail.Error) fail.Error // ...
Create(ctx context.Context, hostReq abstract.HostRequest, hostDef abstract.HostSizingRequirements, extra interface{}) (*userdata.Content, fail.Error) // creates a new host and its metadata
Delete(ctx context.Context) fail.Error
DisableSecurityGroup(ctx context.Context, sg SecurityGroup) fail.Error // disables a bound security group on host
EnableSecurityGroup(ctx context.Context, sg SecurityGroup) fail.Error // enables a bound security group on host
ForceGetState(ctx context.Context) (hoststate.Enum, fail.Error) // returns the real current state of the host, with error handling
GetAccessIP(ctx context.Context) (string, fail.Error) // returns the IP to reach the host, with error handling
GetDefaultSubnet(ctx context.Context) (Subnet, fail.Error) // returns the resources.Subnet instance corresponding to the default subnet of the host, with error handling
GetMounts(ctx context.Context) (*propertiesv1.HostMounts, fail.Error) // returns the mounts on the host
GetPrivateIP(ctx context.Context) (string, fail.Error) // returns the IP address of the host on the default subnet, with error handling
GetPrivateIPOnSubnet(ctx context.Context, subnetID string) (string, fail.Error) // returns the IP address of the host on the requested subnet, with error handling // never used
GetPublicIP(ctx context.Context) (string, fail.Error) // returns the public IP address of the host, with error handling
GetSSHConfig(ctx context.Context) (sshapi.Config, fail.Error) // loads SSH configuration for host from metadata
GetState(ctx context.Context) (hoststate.Enum, fail.Error) // returns the current state of the host, with error handling
GetVolumes(ctx context.Context) (*propertiesv1.HostVolumes, fail.Error) // returns the volumes attached to the host
IsClusterMember(ctx context.Context) (bool, fail.Error) // returns true if the host is member of a cluster
IsFeatureInstalled(ctx context.Context, name string) (bool, fail.Error) // tells if a feature is installed on Host, using only metadata
IsGateway(ctx context.Context) (bool, fail.Error) // tells of the host acts as a gateway
IsSingle(ctx context.Context) (bool, fail.Error) // tells of the host acts as a gateway
ListEligibleFeatures(ctx context.Context) ([]Feature, fail.Error) // returns the list of eligible features for the Cluster
ListInstalledFeatures(ctx context.Context) ([]Feature, fail.Error) // returns the list of installed features on the Cluster
ListSecurityGroups(ctx context.Context, state securitygroupstate.Enum) ([]*propertiesv1.SecurityGroupBond, fail.Error) // returns a slice of properties.SecurityGroupBond corresponding to bound Security Group of the host
ListLabels(ctx context.Context) (list map[string]string, err fail.Error)
Pull(ctx context.Context, target, source string, timeout time.Duration) (int, string, string, fail.Error) // downloads a file from host
Push(ctx context.Context, source, target, owner, mode string, timeout time.Duration) (int, string, string, fail.Error) // uploads a file to host
PushStringToFileWithOwnership(ctx context.Context, content string, filename string, owner, mode string) fail.Error // creates a file 'filename' on remote 'host' with the content 'content' and apply ownership to it
Reboot(ctx context.Context, soft bool) fail.Error // reboots the host
ResetLabel(ctx context.Context, labelInstance Label) fail.Error
Run(ctx context.Context, cmd string, outs outputs.Enum, connectionTimeout, executionTimeout time.Duration) (int, string, string, fail.Error) // tries to execute command 'cmd' on the host
Start(ctx context.Context) fail.Error // starts the host
Stop(ctx context.Context) fail.Error // stops the host
ToProtocol(ctx context.Context) (*protocol.Host, fail.Error) // converts a host to equivalent gRPC message
UnbindSecurityGroup(ctx context.Context, sg SecurityGroup) fail.Error // Unbinds a security group from host
UnbindLabel(ctx context.Context, label Label) fail.Error // Untag a host
UpdateLabel(ctx context.Context, labelInstance Label, value string) fail.Error
WaitSSHReady(ctx context.Context, timeout time.Duration) (status string, err fail.Error)
}
Host links Object Storage folder and Host
type IndexedListOfClusterNodes ¶
type IndexedListOfClusterNodes map[uint]*propertiesv3.ClusterNode
IndexedListOfClusterNodes ...
type Label ¶
type Label interface {
Metadata
data.Identifiable
GetName() string
BindToHost(ctx context.Context, hostInstance Host, value string) fail.Error // instructs Label to be bound to Host with overrided value (if not a Tag)
Browse(ctx context.Context, callback func(*abstract.Label) fail.Error) fail.Error // walks through all the metadata objects in labels
Create(ctx context.Context, name string, hasDefault bool, defaultValue string) fail.Error // creates a Label
Delete(ctx context.Context) fail.Error // deletes a Label
IsTag(ctx context.Context) (bool, fail.Error) // tells if the label is a Tag (ie a Label that does not carry a value)
DefaultValue(ctx context.Context) (string, fail.Error) // returns the default value of the Label
ToProtocol(ctx context.Context, withHosts bool) (*protocol.LabelInspectResponse, fail.Error) // converts Label to equivalent protocol message
UnbindFromHost(ctx context.Context, hostInstance Host) fail.Error // instructs Label to unbind Host from it
}
Label links Object Storage folder and getTags
type Metadata ¶
type Metadata interface {
IsNull() bool
Alter(ctx context.Context, callback Callback) fail.Error // protects the data for exclusive write
BrowseFolder(ctx context.Context, callback func(buf []byte) fail.Error) fail.Error // walks through host folder and executes a callback for each entry
Deserialize(ctx context.Context, buf []byte) fail.Error // Transforms a slice of bytes in struct
Inspect(ctx context.Context, callback Callback) fail.Error // protects the data for shared read with first reloading data from Object Storage
Read(ctx context.Context, ref string) fail.Error // reads the data from Object Storage using ref as id or name
ReadByID(ctx context.Context, id string) fail.Error // reads the data from Object Storage by id
Reload(ctx context.Context) fail.Error // Reloads the metadata from the Object Storage, overriding what is in the object
Sdump(ctx context.Context) (string, fail.Error)
Service() iaas.Service // Undocumented implicit dependency
}
Metadata contains the core functions of a persistent object
type Network ¶
type Network interface {
Metadata
data.Identifiable
Consistent
GetName() string
AbandonSubnet(ctx context.Context, subnetID string) fail.Error // used to detach a Subnet from the Network
AdoptSubnet(ctx context.Context, subnet Subnet) fail.Error // used to attach a Subnet to the Network
Browse(ctx context.Context, callback func(*abstract.Network) fail.Error) fail.Error // call the callback for each entry of the metadata folder of Networks
Create(ctx context.Context, req *abstract.NetworkRequest, snreq *abstract.SubnetRequest) fail.Error // creates a Network
Delete(ctx context.Context) fail.Error
InspectSubnet(ctx context.Context, subnetRef string) (Subnet, fail.Error) // returns the Subnet instance corresponding to Subnet reference (ID or name) provided (if Subnet is attached to the Network)
ToProtocol(ctx context.Context) (*protocol.Network, fail.Error) // converts the network to protobuf message
}
Network links Object Storage folder and Network
type Results ¶
type Results interface {
Add(string, UnitResults) error
AddOne(string, string, UnitResult) error
Successful() bool
AllErrorMessages() string
ErrorMessagesOfUnit(name string) (string, fail.Error)
ErrorMessagesOfKey(name string) string
ResultsOfKey(key string) UnitResults
Keys() []string
}
Results ...
type SecurityGroup ¶
type SecurityGroup interface {
Metadata
data.Identifiable
Consistent
GetName() string
AddRule(context.Context, *abstract.SecurityGroupRule) fail.Error // returns true if the host is member of a cluster
AddRules(context.Context, abstract.SecurityGroupRules) fail.Error // returns true if the host is member of a cluster
BindToHost(context.Context, Host, SecurityGroupActivation, SecurityGroupMark) fail.Error // binds a security group to a host
BindToSubnet(context.Context, Subnet, SecurityGroupActivation, SecurityGroupMark) fail.Error // binds a security group to a network
Browse(ctx context.Context, callback func(*abstract.SecurityGroup) fail.Error) fail.Error // browses the metadata folder of Security Groups and call the callback on each entry
Clear(ctx context.Context) fail.Error // removes rules from the security group
Create(ctx context.Context, networkID, name, description string, rules abstract.SecurityGroupRules) fail.Error // creates a new host and its metadata
Delete(ctx context.Context, force bool) fail.Error // deletes the Security Group
DeleteRule(ctx context.Context, rule *abstract.SecurityGroupRule) fail.Error // deletes a rule from a Security Group
GetBoundHosts(ctx context.Context) ([]*propertiesv1.SecurityGroupBond, fail.Error) // returns a slice of bonds corresponding to hosts bound to the security group
GetBoundSubnets(ctx context.Context) ([]*propertiesv1.SecurityGroupBond, fail.Error) // returns a slice of bonds corresponding to networks bound to the security group
Reset(ctx context.Context) fail.Error // resets the rules of the security group from the ones registered in metadata
ToProtocol(ctx context.Context) (*protocol.SecurityGroupResponse, fail.Error) // converts a SecurityGroup to equivalent gRPC message
UnbindFromHost(context.Context, Host) fail.Error // unbinds a Security Group from Host
UnbindFromHostByReference(context.Context, string) fail.Error // unbinds a Security Group from Host
UnbindFromSubnet(context.Context, Subnet) fail.Error // unbinds a Security Group from Subnet
UnbindFromSubnetByReference(context.Context, string) fail.Error // unbinds a Security group from a Subnet identified by reference (ID or name)
}
SecurityGroup links Object Storage folder and SecurityGroup
type SecurityGroupActivation ¶
type SecurityGroupActivation bool
SecurityGroupActivation represents activation state of a Security Group
const ( // SecurityGroupEnable means the security group is enabled SecurityGroupEnable SecurityGroupActivation = true // SecurityGroupDisable means the security group is disabled SecurityGroupDisable SecurityGroupActivation = false )
type SecurityGroupMark ¶
type SecurityGroupMark bool
type Share ¶
type Share interface {
Metadata
data.Identifiable
Consistent
}
Share contains information to maintain in Object Storage a list of shared folders
type Subnet ¶
type Subnet interface {
Metadata
data.Identifiable
Consistent
GetName() string
DetachHost(ctx context.Context, hostID string) fail.Error // unlinks host ID from subnet
AttachHost(context.Context, Host) fail.Error // links Host to the Subnet
BindSecurityGroup(context.Context, SecurityGroup, SecurityGroupActivation) fail.Error // binds a Security Group to the Subnet
Browse(ctx context.Context, callback func(*abstract.Subnet) fail.Error) fail.Error // ...
Create(ctx context.Context, req abstract.SubnetRequest, gwname string, gwSizing *abstract.HostSizingRequirements, extra interface{}) fail.Error // creates a Subnet
Delete(ctx context.Context) fail.Error // deletes a Subnet
DisableSecurityGroup(context.Context, SecurityGroup) fail.Error // disables a bound Security Group on Subnet
EnableSecurityGroup(context.Context, SecurityGroup) fail.Error // enables a bound Security Group on Subnet
GetGatewayPublicIP(ctx context.Context, primary bool) (string, fail.Error) // returns the gateway related to Subnet
GetGatewayPublicIPs(ctx context.Context) ([]string, fail.Error) // returns the gateway IPs of the Subnet
GetDefaultRouteIP(ctx context.Context) (string, fail.Error) // returns the private IP of the default route of the Subnet
GetEndpointIP(ctx context.Context) (string, fail.Error) // returns the public IP to reach the Subnet from Internet
GetCIDR(ctx context.Context) (string, fail.Error) // return the CIDR
GetState(ctx context.Context) (subnetstate.Enum, fail.Error) // gives the current state of the Subnet
HasVirtualIP(ctx context.Context) (bool, fail.Error) // tells if the Subnet is using a VIP as default route
InspectGateway(ctx context.Context, primary bool) (Host, fail.Error) // returns the gateway related to Subnet
InspectGatewaySecurityGroup(ctx context.Context) (SecurityGroup, fail.Error) // returns the SecurityGroup responsible of network security on Gateway
InspectInternalSecurityGroup(ctx context.Context) (SecurityGroup, fail.Error) // returns the SecurityGroup responsible of internal network security
InspectPublicIPSecurityGroup(ctx context.Context) (SecurityGroup, fail.Error) // returns the SecurityGroup responsible of Hosts with Public IP (excluding gateways)
InspectNetwork(ctx context.Context) (Network, fail.Error) // returns the instance of the parent Network of the Subnet
ListHosts(ctx context.Context) ([]Host, fail.Error) // returns the list of Host attached to the subnet (excluding gateway)
ListSecurityGroups(ctx context.Context, state securitygroupstate.Enum) ([]*propertiesv1.SecurityGroupBond, fail.Error) // lists the security groups bound to the subnet
ToProtocol(ctx context.Context) (*protocol.Subnet, fail.Error) // converts the subnet to protobuf message
UnbindSecurityGroup(context.Context, SecurityGroup) fail.Error // unbinds a security group from the subnet
}
Subnet links Object Storage folder and Network
type Targetable ¶
type Targetable interface {
data.Identifiable
GetName() string
ComplementFeatureParameters(ctx context.Context, v data.Map) fail.Error // adds parameters corresponding to the Target in preparation of feature installation
UnregisterFeature(ctx context.Context, feat string) fail.Error // unregisters a Feature from Target in metadata
InstalledFeatures(ctx context.Context) ([]string, fail.Error) // returns a list of installed features
InstallMethods(ctx context.Context) (map[uint8]installmethod.Enum, fail.Error) // returns a list of installation methods usable on the target, ordered from upper to lower preference (1 = the highest preference)
RegisterFeature(ctx context.Context, feat Feature, requiredBy Feature, clusterContext bool) fail.Error // registers a feature on target in metadata
Service() iaas.Service // returns the iaas.Service used by the target
TargetType() featuretargettype.Enum // returns the type of the target
}
Targetable is an interface that target must satisfy to be able to install something on it
type UnitResult ¶
type UnitResult interface {
Successful() bool
Completed() bool
Error() error
ErrorMessage() string
}
UnitResult ...
type UnitResults ¶
type UnitResults interface {
AddOne(string, UnitResult)
Completed() bool
Uncompleted() []string
ErrorMessages() string
Successful() bool
Keys() []string
ResultOfKey(key string) UnitResult
}
UnitResults ...
type Volume ¶
type Volume interface {
Metadata
data.Identifiable
Consistent
GetName() string
Attach(ctx context.Context, host Host, path, format string, doNotFormat, doNotMount bool) fail.Error // attaches a volume to a host
Browse(ctx context.Context, callback func(*abstract.Volume) fail.Error) fail.Error // walks through all the metadata objects in network
Create(ctx context.Context, req abstract.VolumeRequest) fail.Error // creates a volume
Delete(ctx context.Context) fail.Error // deletes a volume
Detach(ctx context.Context, host Host) fail.Error // detaches the volume identified by ref, ref can be the name or the id
GetAttachments(ctx context.Context) (*propertiesv1.VolumeAttachments, fail.Error) // returns the property containing where the volume is attached
GetSize(ctx context.Context) (int, fail.Error) // returns the size of volume in GB
GetSpeed(ctx context.Context) (volumespeed.Enum, fail.Error) // returns the speed of the volume (more or less the type of hardware)
ToProtocol(ctx context.Context) (*protocol.VolumeInspectResponse, fail.Error) // converts volume to equivalent protocol message
}
Volume links Object Storage folder and getVolumes
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package abstract defines structures that will contain abstracted information of resources
|
Package abstract defines structures that will contain abstracted information of resources |
|
enums
|
|
|
clusterstate
Package clusterstate is an enumeration of the possible states of a Cluster
|
Package clusterstate is an enumeration of the possible states of a Cluster |
|
volumespeed
Package volumespeed defines an enum to represents Volume type
|
Package volumespeed defines an enum to represents Volume type |
|
volumestate
Package volumestate defines an enum to represents Volume states life cycle
|
Package volumestate defines an enum to represents Volume states life cycle |
|
factories
|
|
|
network
Package network contains functions to list, create, load instances of resources.Network
|
Package network contains functions to list, create, load instances of resources.Network |
|
subnet
Package subnet contains methods to load or create instance of resources.Subnet
|
Package subnet contains methods to load or create instance of resources.Subnet |
|
Package operations contains the implementations of resources interfaces
|
Package operations contains the implementations of resources interfaces |
|
properties
|
|