Documentation
¶
Overview ¶
Package bat provides a set of utility functions that can be used to test and manipulate a ciao cluster. These functions are just wrappers around the ciao command. They invoke ciao commands and parse and return the output from these commands in easily consumable go values. Invoking the ciao commands directly, rather than calling the REST APIs exposed by ciao's various services, allows us to test a little bit more of ciao.
Here's a quick example. The following code retrieves the instances defined on the default tenant and prints out their UUIDs and statuses.
instances, err := bat.GetAllInstances(context.Background(), "") if err != nil { return err } for uuid, instance := range instances { fmt.Printf("%s : %s\n", uuid, instance.Status) }
The bat.GetAllInstances command calls ciao list instances ¶
Package bat contains a number of helper functions that can be used to perform various operations on a ciao cluster such as creating an instance or retrieving a list of all the defined workloads, etc. All of these helper functions are implemented by calling ciao rather than by using ciao's REST APIs. This package is mainly intended for use by BAT tests. Manipulating the cluster via ciao, rather than through the REST APIs, allows us to test a little bit more of ciao.
Package bat contains a number of helper functions that can be used to perform various operations on a ciao cluster such as creating an instance or retrieving a list of all the defined workloads, etc. All of these helper functions are implemented by calling ciao rather than by using ciao's REST APIs. This package is mainly intended for use by BAT tests. Manipulating the cluster via ciao, rather than through the REST APIs, allows us to test a little bit more of ciao.
Index ¶
- func AddExternalIPToPool(ctx context.Context, tenant, name, ip string) error
- func AddVolume(ctx context.Context, tenant, source, sourceType string, options *VolumeOptions) (string, error)
- func AttachVolume(ctx context.Context, tenant, instance, volume string) error
- func AttachVolumeAndWait(ctx context.Context, tenant, instance, volume string) error
- func CreateExternalIPPool(ctx context.Context, tenant, name string) error
- func CreatePublicWorkload(ctx context.Context, tenant string, opt WorkloadOptions, config string) (string, error)
- func CreateRandomFile(sizeMiB int) (path string, err error)
- func CreateWorkload(ctx context.Context, tenant string, opt WorkloadOptions, config string) (string, error)
- func CreateWorkloadFromFile(ctx context.Context, public bool, tenant, wdPath string) (string, error)
- func DeleteAllInstances(ctx context.Context, tenant string) error
- func DeleteExternalIPPool(ctx context.Context, tenant, name string) error
- func DeleteImage(ctx context.Context, admin bool, tenant, ID string) error
- func DeleteInstance(ctx context.Context, tenant string, instance string) error
- func DeleteInstanceAndWait(ctx context.Context, tenant string, instance string) error
- func DeleteInstances(ctx context.Context, tenant string, instances []string) ([]error, error)
- func DeletePublicWorkload(ctx context.Context, workload string) error
- func DeleteTenant(ctx context.Context, ID string) error
- func DeleteVolume(ctx context.Context, tenant, ID string) error
- func DeleteWorkload(ctx context.Context, tenant string, workload string) error
- func DetachVolume(ctx context.Context, tenant, volume string) error
- func DetachVolumeAndWait(ctx context.Context, tenant, volume string) error
- func Evacuate(ctx context.Context, nodeid string) error
- func GetAllInstances(ctx context.Context, tenant string) (map[string]*Instance, error)
- func GetAllVolumes(ctx context.Context, tenant string) (map[string]*Volume, error)
- func GetCNCIs(ctx context.Context) (map[string]*CNCI, error)
- func GetComputeNodes(ctx context.Context) (map[string]*NodeStatus, error)
- func GetImageCount(ctx context.Context, admin bool, tenant string) (int, error)
- func GetImages(ctx context.Context, admin bool, tenant string) (map[string]*Image, error)
- func GetNetworkNodes(ctx context.Context) (map[string]*NodeStatus, error)
- func LaunchInstances(ctx context.Context, tenant string, workload string, num int) ([]string, error)
- func MapExternalIP(ctx context.Context, tenant, pool, instance string) error
- func RestartInstance(ctx context.Context, tenant string, instance string) error
- func RestartInstanceAndWait(ctx context.Context, tenant string, instance string) error
- func Restore(ctx context.Context, nodeid string) error
- func RetrieveInstanceStatus(ctx context.Context, tenant string, instance string) (string, error)
- func RetrieveInstancesStatuses(ctx context.Context, tenant string) (map[string]string, error)
- func RunCIAOCmd(ctx context.Context, tenant string, args []string) ([]byte, error)
- func RunCIAOCmdAsAdmin(ctx context.Context, tenant string, args []string) ([]byte, error)
- func RunCIAOCmdAsAdminJS(ctx context.Context, tenant string, args []string, jsdata interface{}) error
- func RunCIAOCmdJS(ctx context.Context, tenant string, args []string, jsdata interface{}) error
- func StartRandomInstances(ctx context.Context, tenant string, num int) ([]string, error)
- func StopInstance(ctx context.Context, tenant string, instance string) error
- func StopInstanceAndWait(ctx context.Context, tenant string, instance string) error
- func UnmapExternalIP(ctx context.Context, tenant, address string) error
- func UpdateQuota(ctx context.Context, tenantID string, forTenantID string, name string, ...) error
- func UpdateTenant(ctx context.Context, ID string, config TenantConfig) error
- func WaitForComputeNodeStatus(ctx context.Context, nodeID, status string) error
- func WaitForInstanceExit(ctx context.Context, tenant string, instance string) error
- func WaitForInstancesLaunch(ctx context.Context, tenant string, instances []string, mustBeActive bool) ([]string, error)
- func WaitForVolumeStatus(ctx context.Context, tenant, volume, status string) error
- type CNCI
- type ClusterStatus
- type Disk
- type ExternalIP
- type Image
- type ImageOptions
- type Instance
- type NodeStatus
- type QuotaDetails
- type Source
- type Tenant
- type TenantConfig
- type TenantSummary
- type Volume
- type VolumeOptions
- type Workload
- type WorkloadOptions
- type WorkloadRequirements
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddExternalIPToPool ¶
AddExternalIPToPool adds an external ips to an existing pool. The address is added using the ciao add external-ip command. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func AddVolume ¶
func AddVolume(ctx context.Context, tenant, source, sourceType string, options *VolumeOptions) (string, error)
AddVolume adds a new volume to a tenant. The volume is added using ciao create volume. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func AttachVolume ¶
AttachVolume attaches a volume to an instance. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func AttachVolumeAndWait ¶
AttachVolumeAndWait attaches a volume to an instance and waits for the status of that volume to transition to "in-use". An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func CreateExternalIPPool ¶
CreateExternalIPPool creates a new pool for external ips. The pool is created using the ciao create pool command. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func CreatePublicWorkload ¶
func CreatePublicWorkload(ctx context.Context, tenant string, opt WorkloadOptions, config string) (string, error)
CreatePublicWorkload will call ciao as admin to create a workload. It will first output the cloud init yaml file to the current working directory. Then it will output the workload definition to the current working directory. Finally it will call ciao create workload to upload the workload definition. It will clean up all the files it created when it is done.
func CreateRandomFile ¶
CreateRandomFile creates a file of the desired size with random data returning the path.
func CreateWorkload ¶
func CreateWorkload(ctx context.Context, tenant string, opt WorkloadOptions, config string) (string, error)
CreateWorkload will call ciao to create a workload definition. It will first output the cloud init yaml file to the current working directory. Then it will output the workload definition to the current working directory. Finally it will call ciao create workload to upload the workload definition. It will clean up all the files it created when it is done.
func CreateWorkloadFromFile ¶
func CreateWorkloadFromFile(ctx context.Context, public bool, tenant, wdPath string) (string, error)
CreateWorkloadFromFile will call ciao create workload to create a workload from the specified file. ciao will be invoked using the admin user if the public flag is set to true. The provided workload definition file will remain intact after the call returns. The id of the new workload is returned upon success.
func DeleteAllInstances ¶
DeleteAllInstances deletes all the instances created for the specified tenant by calling ciao delete instance --all. It returns an error if the ciao command fails. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DeleteExternalIPPool ¶
DeleteExternalIPPool deletes an external-ip pool. The pool is deleted using the ciao delete pool command. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DeleteImage ¶
DeleteImage deletes an image from the image service. It is implemented by calling ciao delete image. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE (if admin set) otherwise CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DeleteInstance ¶
DeleteInstance deletes a specific instance from the cluster. It deletes the instance using ciao delete instance. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DeleteInstanceAndWait ¶
DeleteInstanceAndWait deletes a specific instance from the cluster. It deletes the instance using ciao delete instance and then blocks until ciao reports that the instance is truly deleted. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DeleteInstances ¶
DeleteInstances deletes a set of instances provided by the instances slice. If the function encounters an error deleting an instance it records the error and proceeds to the delete the next instance. The function returns two values, an error and a slice of errors. A single error value is set if any of the instance deletion attempts failed. A slice of errors is also returned so that the caller can determine which of the deletion attempts failed. The indices in the error slice match the indicies in the instances slice, i.e., a non nil value in the first element of the error slice indicates that there was an error deleting the first instance in the instances slice. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DeletePublicWorkload ¶
DeletePublicWorkload will call ciao as admin to delete a workload.
func DeleteTenant ¶
DeleteTenant will delete the given tenant. It calls ciao delete tenant
func DeleteVolume ¶
DeleteVolume deletes the specified volume from a given tenant. The volume is deleted by calling ciao delete volume. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DeleteWorkload ¶
DeleteWorkload will call ciao as a tenant to delete a workload.
func DetachVolume ¶
DetachVolume detaches a volume from an instance. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func DetachVolumeAndWait ¶
DetachVolumeAndWait attaches a volume to an instance and waits for the status of that volume to transition to "available". An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func Evacuate ¶
Evacuate evacuates a given node of a ciao cluster. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetAllInstances ¶
GetAllInstances returns information about all instances in the specified tenant in a map. The key of the map is the instance uuid. The information is retrieved by calling ciao list instances. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetAllVolumes ¶
GetAllVolumes returns a map of all the volumes defined in the specified tenant. The map is indexed by volume ID. The map is retrieved by calling ciao list volumes. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetCNCIs ¶
GetCNCIs returns a map of the CNCIs present in the cluster. The key of the map is the CNCI ID. The CNCI information is retrieved using ciao list cncis command. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetComputeNodes ¶
func GetComputeNodes(ctx context.Context) (map[string]*NodeStatus, error)
GetComputeNodes returns a map containing status information about each compute node in the cluster. The key of the map is the Node ID. The information is retrieved using ciao list nodes command. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetImageCount ¶
GetImageCount returns the number of images currently stored in the image service. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE (if admin set) otherwise CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetImages ¶
GetImages retrieves the meta data for all images. It is implemented by calling ciao list images. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE (if admin set) otherwise CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetNetworkNodes ¶
func GetNetworkNodes(ctx context.Context) (map[string]*NodeStatus, error)
GetNetworkNodes returns a map containing status information about each network node in the cluster. The key of the map is the Node ID. The information is retrieved using ciao list nodes command. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func LaunchInstances ¶
func LaunchInstances(ctx context.Context, tenant string, workload string, num int) ([]string, error)
LaunchInstances launches num instances of the specified workload. On success the function returns a slice of UUIDs of the successfully launched instances. If some instances failed to start then the error can be found in the event log. The instances are launched using ciao create instance. If no instances successfully launch then an error will be returned. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func MapExternalIP ¶
MapExternalIP maps an external ip from a given pool to an instance. The address is mapped using the ciao attach external-ip command. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func RestartInstance ¶
RestartInstance restarts a ciao instance by invoking the ciao restart instance command. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func RestartInstanceAndWait ¶
RestartInstanceAndWait restarts a ciao instance by invoking the ciao instance restart command. It then waits until the instance's status changes to active. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func Restore ¶
Restore restores a given node of a ciao cluster. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func RetrieveInstanceStatus ¶
RetrieveInstanceStatus retrieve the status of a specific instance. This information is retrieved using ciao show instances . An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func RetrieveInstancesStatuses ¶
RetrieveInstancesStatuses retrieves the statuses of a slice of specific instances. This information is retrieved using ciao list instances. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func RunCIAOCmd ¶
RunCIAOCmd execs the ciao command with a set of arguments. The ciao process will be killed if the context is Done. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER. On success the data written to ciao on stdout will be returned.
func RunCIAOCmdAsAdmin ¶
RunCIAOCmdAsAdmin execs the ciao command as the admin user with a set of provided arguments. The ciao process will be killed if the context is Done. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER. On success the data written to ciao on stdout will be returned.
func RunCIAOCmdAsAdminJS ¶
func RunCIAOCmdAsAdminJS(ctx context.Context, tenant string, args []string, jsdata interface{}) error
RunCIAOCmdAsAdminJS is similar to RunCIAOCmdAsAdmin with the exception that the output of the ciao command is expected to be in json format. The json is decoded into the jsdata parameter which should be a pointer to a type that corresponds to the json output.
func RunCIAOCmdJS ¶
RunCIAOCmdJS is similar to RunCIAOCmd with the exception that the output of the ciao command is expected to be in json format. The json is decoded into the jsdata parameter which should be a pointer to a type that corresponds to the json output.
func StartRandomInstances ¶
StartRandomInstances starts a specified number of instances using a random workload. The UUIDs of the started instances are returned to the user. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func StopInstance ¶
StopInstance stops a ciao instance by invoking the ciao stop instance command. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func StopInstanceAndWait ¶
StopInstanceAndWait stops a ciao instance by invoking the ciao instance stop command. It then waits until the instance's status changes to exited. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func UnmapExternalIP ¶
UnmapExternalIP unmaps an external ip from an instance. The address is unmapped using the ciao detach external-ip command. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func UpdateQuota ¶
func UpdateQuota(ctx context.Context, tenantID string, forTenantID string, name string, value string) error
UpdateQuota updates the provided named quota for the provided tenant (using forTenantID) to the desired value.
func UpdateTenant ¶
func UpdateTenant(ctx context.Context, ID string, config TenantConfig) error
UpdateTenant updates a new tenant with the given config. It calls ciao update tenant
func WaitForComputeNodeStatus ¶
WaitForComputeNodeStatus waits for the status of a node to transition to a given state. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func WaitForInstanceExit ¶
WaitForInstanceExit blocks until the specified instance has exited or the context is cancelled. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func WaitForInstancesLaunch ¶
func WaitForInstancesLaunch(ctx context.Context, tenant string, instances []string, mustBeActive bool) ([]string, error)
WaitForInstancesLaunch waits for a slice of newly created instances to be scheduled. An instance is scheduled when its status changes from pending to exited or active. If mustBeActive is set to true, the function will fail if it sees an instance that has been scheduled but whose status is exited. The function returns a slice of instance UUIDs and an error. In the case of success, the returned slice of UUIDs will equal the instances array. In the case of error, these two slices may be different. This can happen if one or more of the instances has failed to launch. If errors are detected with multiple instances, e.g., mustBeActive is true and two instances have a status of 'exited' the error returned will refers to the first instance only. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func WaitForVolumeStatus ¶
WaitForVolumeStatus blocks until the status of the specified volume matches the status parameter or the context is cancelled. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
Types ¶
type CNCI ¶
type CNCI struct { TenantID string `json:"tenant_id"` IPv4 string `json:"ip"` Geography string `json:"geo"` Subnets []string `json:"subnets"` }
CNCI contains information about a CNCI
type ClusterStatus ¶
type ClusterStatus struct { TotalNodes int `json:"total_nodes"` TotalNodesReady int `json:"total_nodes_ready"` TotalNodesFull int `json:"total_nodes_full"` TotalNodesOffline int `json:"total_nodes_offline"` TotalNodesMaintenance int `json:"total_nodes_maintenance"` }
ClusterStatus contains information about the status of a ciao cluster
type Disk ¶
type Disk struct { ID *string `yaml:"volume_id"` Size int `yaml:"size"` Bootable bool `yaml:"bootable"` Source *Source `yaml:"source"` Ephemeral bool `yaml:"ephemeral"` }
Disk describes the storage for the workload definition.
type ExternalIP ¶
type ExternalIP struct { ExternalIP string `json:"external_ip"` InternalIP string `json:"internal_ip"` InstanceID string `json:"instance_id"` TenantID string `json:"tenant_id"` PoolName string `json:"pool_name"` }
ExternalIP contains information about a single external ip.
func ListExternalIPs ¶
func ListExternalIPs(ctx context.Context, tenant string) ([]*ExternalIP, error)
ListExternalIPs returns detailed information about all the external ips // defined for the given tenant. The information is retrieved using the ciao list external-ips command. An error will be returned if the following // environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
type Image ¶
type Image struct { ImageOptions SizeBytes int `json:"size"` Status string `json:"state"` CreatedDate string `json:"create_time"` }
Image contains all the meta data for a single image
func AddImage ¶
func AddImage(ctx context.Context, admin bool, tenant, path string, options *ImageOptions) (*Image, error)
AddImage uploads a new image to the ciao-image service. The caller can supply a number of pieces of meta data about the image via the options parameter. It is implemented by calling ciao create image . On success the function returns the entire meta data of the newly updated image that includes the caller supplied meta data and the meta data added by the image service. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE (if admin set) otherwise CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func AddRandomImage ¶
func AddRandomImage(ctx context.Context, admin bool, tenant string, size int, options *ImageOptions) (*Image, error)
AddRandomImage uploads a new image of the desired size using random data. The caller can supply a number of pieces of meta data about the image via the options parameter. It is implemented by calling ciao create image. On success the function returns the entire meta data of the newly updated image that includes the caller supplied meta data and the meta data added by the image service. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE (if admin set) otherwise CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
type ImageOptions ¶
ImageOptions contains user supplied image meta data
type Instance ¶
type Instance struct { NodeID string `json:"node_id"` TenantID string `json:"tenant_id"` WorkloadID string `json:"workload_id"` Status string `json:"status"` PrivateIP string `json:"private_ip"` MacAddress string `json:"mac_address"` SSHIP string `json:"ssh_ip"` SSHPort int `json:"ssh_port"` Volumes []string `json:"volumes"` }
Instance contains detailed information about an instance
func GetInstance ¶
GetInstance returns an Instance structure that contains information about a specific instance. The information is retrieved by calling ciao show instance. An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
type NodeStatus ¶
type NodeStatus struct { ID string `json:"id"` Timestamp time.Time `json:"updated"` Status string `json:"status"` MemTotal int `json:"ram_total"` MemAvailable int `json:"ram_available"` DiskTotal int `json:"disk_total"` DiskAvailable int `json:"disk_available"` Load int `json:"load"` OnlineCPUs int `json:"online_cpus"` TotalInstances int `json:"total_instances"` TotalRunningInstances int `json:"total_running_instances"` TotalPendingInstances int `json:"total_pending_instances"` TotalPausedInstances int `json:"total_paused_instances"` Hostname string `json:"hostname"` }
NodeStatus contains information about the status of a node
func GetComputeNode ¶
func GetComputeNode(ctx context.Context, nodeID string) (*NodeStatus, error)
GetComputeNode returns status information for a given node in the cluster. The information is retrieved using caio show node command. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
type QuotaDetails ¶
type QuotaDetails struct { Name string `json:"name"` Value string `json:"value"` Usage string `json:"usage"` }
QuotaDetails holds quota information returned by ListQuotas()
func ListQuotas ¶
ListQuotas returns the quotas by calling ciao list quotas. If a forTenantID is specified then it is run as an admin and the quotas for the the specified tenant will be returned. Otherwise it will provide the quotas for the current tenant.
type Source ¶
Source is provided to the disk structure to indicate whether the disk should be cloned from a volume or an image.
type TenantConfig ¶
type TenantConfig struct { Name string `json:"name"` SubnetBits int `json:"subnet_bits"` Permissions struct { PrivilegedContainers bool `json:"privileged_containers"` } `json:"permissions"` }
TenantConfig stores the configurable attributes of a tenant.
func GetTenantConfig ¶
func GetTenantConfig(ctx context.Context, ID string) (TenantConfig, error)
GetTenantConfig retrieves the configuration for the given tenant.
type TenantSummary ¶
TenantSummary is a short form of Tenant
func CreateTenant ¶
func CreateTenant(ctx context.Context, config TenantConfig) (TenantSummary, error)
CreateTenant creates a new tenant with the given config. It calls ciao create tenant
func GetAllTenants ¶
func GetAllTenants(ctx context.Context) ([]TenantSummary, error)
GetAllTenants retrieves a list of all tenants in the cluster by calling ciao list tenants. An error will be returned if the following environment variables are not set; CIAO_ADMIN_CLIENT_CERT_FILE, CIAO_CONTROLLER.
type Volume ¶
type Volume struct { VolumeOptions ID string TenantID string `json:"tenant_id"` CreatedAt string `json:"created"` Status string `json:"state"` }
Volume contains information about a single volume
type VolumeOptions ¶
VolumeOptions contains user supplied volume meta data
type Workload ¶
type Workload struct { ID string `json:"id"` Name string `json:"name"` CPUs int `json:"vcpus"` Mem int `json:"ram"` }
Workload contains detailed information about a workload
func GetAllWorkloads ¶
GetAllWorkloads retrieves a list of all workloads in the cluster by calling ciao list workloads . An error will be returned if the following environment variables are not set; CIAO_CLIENT_CERT_FILE, CIAO_CONTROLLER.
func GetWorkloadByID ¶
GetWorkloadByID will return a specific workload referenced by name. An error will be returned if either no workloads exist in the cluster, or if the specific workload does not exist. It inherits all error conditions of GetAllWorkloads.
func GetWorkloadByName ¶
GetWorkloadByName will return a specific workload referenced by name. An error will be returned if either no workloads exist in the cluster, or if the specific workload does not exist. It inherits all error conditions of GetAllWorkloads.
type WorkloadOptions ¶
type WorkloadOptions struct { Description string `yaml:"description"` VMType string `yaml:"vm_type"` FWType string `yaml:"fw_type"` ImageName string `yaml:"image_name"` Requirements WorkloadRequirements `yaml:"requirements"` CloudConfigFile string `yaml:"cloud_init"` Disks []Disk `yaml:"disks"` }
WorkloadOptions is used to generate a workload definition in yaml.
type WorkloadRequirements ¶
type WorkloadRequirements struct { VCPUs int `yaml:"vcpus"` MemMB int `yaml:"mem_mb"` NodeID string `yaml:"node_id,omitempty"` Hostname string `yaml:"hostname,omitempty"` Privileged bool `yaml:"privileged,omitempty"` }
WorkloadRequirements indicate how many cpus and mem to allocate.