compute

package
v0.0.0-...-d1703da Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2015 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package compute is used to manage hypervisors, virtual machines, and SSH key pairs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbsoluteLimits

type AbsoluteLimits struct {
	MaxImageMeta            int `json:"maxImageMeta"`
	MaxPersonality          int `json:"maxPersonality"`
	MaxPersonalitySize      int `json:"maxPersonalitySize"`
	MaxSecurityGroupRules   int `json:"maxSecurityGroupRules"`
	MaxSecurityGroups       int `json:"maxSecurityGroups"`
	MaxServerMeta           int `json:"maxServerMeta"`
	MaxTotalCores           int `json:"maxTotalCores"`
	MaxTotalFloatingIps     int `json:"maxTotalFloatingIps"`
	MaxTotalInstances       int `json:"maxTotalInstances"`
	MaxTotalKeypairs        int `json:"maxTotalKeypairs"`
	MaxTotalRAMSize         int `json:"maxTotalRAMSize"`
	TotalCoresUsed          int `json:"totalCoresUsed"`
	TotalInstancesUsed      int `json:"totalInstancesUsed"`
	TotalRAMUsed            int `json:"totalRAMUsed"`
	TotalSecurityGroupsUsed int `json:"totalSecurityGroupsUsed"`
	TotalFloatingIpsUsed    int `json:"totalFloatingIpsUsed"`
}

AbsoluteLimits is a structure for all properties of for the limits

type Address

type Address struct {
	Addr    string `json:"addr"`
	Version int    `json:"version"`
	Type    string `json:"OS-EXT-IPS:type"`
	MacAddr string `json:"OS-EXT-IPS-MAC:mac_addr"`
}

Address contains address information

type AvailabilityZone

type AvailabilityZone struct {
	ZoneState ZoneState `json:"zoneState"`
	ZoneName  string    `json:"zoneName"`
}

AvailabilityZone contains information of OpenStack availabilityZone

type AvailabilityZonesContainer

type AvailabilityZonesContainer struct {
	AvailabilityZones []AvailabilityZone `json:"availabilityZoneInfo"`
}

AvailabilityZonesContainer contains information for availability zones.

type CreateSecurityGroupParameters

type CreateSecurityGroupParameters struct {
	TenantID         string `json:"tenant_id"`
	AddSecurityGroup string `json:"addSecurityGroup"`
	Name             string `json:"name"`
	Description      string `json:"description"`
}

CreateSecurityGroupParameters contains the required parameters for creating a new security group.

type CreateSecurityGroupRuleParameters

type CreateSecurityGroupRuleParameters struct {
	FromPort      int32      `json:"from_port"`
	ToPort        int32      `json:"to_port"`
	IPProtocol    IPProtocol `json:"ip_protocol"`
	GroupID       *string    `json:"group_id"`
	ParentGroupID string     `json:"parent_group_id"`
	CIDR          *string    `json:"cidr"`
}

CreateSecurityGroupRuleParameters represents the request to create a new security group rule.

type CreateServerResponse

type CreateServerResponse struct {
	ID             string          `json:"id"`
	Links          []Link          `json:"links"`
	AdminPass      string          `json:"adminPass"`
	SecurityGroups []SecurityGroup `json:"security_groups"`
}

CreateServerResponse contains ID, links, admin password of the newly created server and the associated security groups the server was created with.

type Flavor

type Flavor struct {
	ID    string `json:"id"`
	Links []Link `json:"links"`
	Name  string `json:"name,omitempty"`
}

Flavor contains information of OpenStack nova from the types of servers.

type FlavorContainer

type FlavorContainer struct {
	Flavor Flavor `json:"flavor"`
}

FlavorContainer contains information for a flavor.

type FlavorDetail

type FlavorDetail struct {
	ID         string              `json:"id"`
	Name       string              `json:"name"`
	Links      []Link              `json:"links"`
	RAM        misc.Int64Wrapper   `json:"ram"`
	VCPUs      misc.Int64Wrapper   `json:"vcpus"`
	Swap       misc.Int64Wrapper   `json:"swap"`
	Disk       misc.Int64Wrapper   `json:"disk"`
	Ephemeral  misc.Int64Wrapper   `json:"OS-FLV-EXT-DATA:ephemeral"`
	RXTXFactor misc.Float64Wrapper `json:"rxtx_factor"`
}

FlavorDetail contains information of OpenStack nova flavor detail

type FlavorDetailContainer

type FlavorDetailContainer struct {
	FlavorDetail FlavorDetail `json:"flavor"`
}

FlavorDetailContainer contains information for a flavor detail.

type FlavorsContainer

type FlavorsContainer struct {
	Flavors []Flavor `json:"flavors"`
}

FlavorsContainer contains information for flavors.

type FlavorsDetailContainer

type FlavorsDetailContainer struct {
	FlavorsDetail []FlavorDetail `json:"flavors"`
}

FlavorsDetailContainer contains information for flavors detail.

type FloatingIP

type FloatingIP struct {
	ID         string `json:"id"`
	IP         string `json:"ip"`
	InstanceID string `json:"instance_id"`
	FixedIP    string `json:"fixed_ip"`
	Pool       string `json:"pool"`
}

FloatingIP contains properties is of an ip that can be associated with a server and can be in a specified pool.

type Group

type Group struct {
	TenantID string `json:"tenant_id"`
	Name     string `json:"from_port"`
}

Group contains properties of the name and TenantID of the Security Group

type IPProtocol

type IPProtocol string

IPProtocol is the type that can be ICMP, TCP, or UDP

const (
	// ICMP is a constant for IPProtocol type.
	ICMP IPProtocol = "ICMP"
	// TCP is a constant for IPProtocol type.
	TCP IPProtocol = "TCP"
	// UDP is a constant for IPProtocol type.
	UDP IPProtocol = "UDP"
)

type IPRange

type IPRange struct {
	CIDR string `json:"cidr"`
}

IPRange contains the CIDR information.

type Image

type Image struct {
	ID    string `json:"id"`
	Links []Link `json:"links"`
}

Image contains information of an image

type ImageWrapper

type ImageWrapper struct {
	Image *Image
}

ImageWrapper exists because an image can be returned as an empty string or an Image type

func (ImageWrapper) MarshalJSON

func (r ImageWrapper) MarshalJSON() ([]byte, error)

MarshalJSON converts a Image to a []byte.

func (*ImageWrapper) UnmarshalJSON

func (r *ImageWrapper) UnmarshalJSON(data []byte) error

UnmarshalJSON converts the bytes give to a Image

type KeyPairResponse

type KeyPairResponse struct {
	Name        string `json:"name"`
	PublicKey   string `json:"public_key"`
	FingerPrint string `json:"fingerprint"`
	UserID      string `json:"user_id"`
}

KeyPairResponse is a structure for all properties of for a tenant

type Limits

type Limits struct {
	AbsoluteLimits AbsoluteLimits        `json:"absolute"`
	Rate           []RateLimitsContainer `json:"rate"`
}

Limits has the absolute and Rate limits for the tenant

type Link struct {
	HRef string `json:"href"`
	Rel  string `json:"rel"`
}

Link contains information of a link

type QueryParameters

type QueryParameters struct {
	Limit  int64  `json:"limit"`
	Marker string `json:"marker"`
}

QueryParameters contains properties that allow filtering and paging of compute requests.

type RateLimit

type RateLimit struct {
	NextAvailable time.Time `json:"next-available"`
	Remaining     int       `json:"remaining"`
	Unit          string    `json:"unit"`
	Value         int       `json:"value"`
	Verb          string    `json:"verb"`
}

RateLimit has properties for the rate limit.

func ErrorIsRateLimit

func ErrorIsRateLimit(err error) (bool, RateLimit)

ErrorIsRateLimit will probe the error to see if its a RateLimit

type RateLimitsContainer

type RateLimitsContainer struct {
	Limit []RateLimit `json:"limit"`
	Regex string      `json:"regex"`
	URL   string      `json:"uri"`
}

RateLimitsContainer has the rate limits.

type SecurityGroup

type SecurityGroup struct {
	Description string              `json:"description,omitempty"`
	ID          string              `json:"id,omitempty"`
	Name        string              `json:"name,omitempty"`
	Rules       []SecurityGroupRule `json:"rules,omitempty"`
	TenantID    string              `json:"tenant_id,omitempty"`
}

SecurityGroup is a structure has properties of the security group from open stack.

type SecurityGroupRule

type SecurityGroupRule struct {
	FromPort      int32       `json:"from_port"`
	Group         *Group      `json:"group,omitempty"`
	ID            string      `json:"id,omitempty"`
	IPProtocol    *IPProtocol `json:"ip_protocol"`
	IPRange       IPRange     `json:"ip_range,omitempty"`
	ParentGroupID string      `json:"parent_group_id"`
	ToPort        int         `json:"to_port"`
}

SecurityGroupRule contains the parameters for specifying which network is allowed for the rule.

type SecurityGroupsContainer

type SecurityGroupsContainer struct {
	SecurityGroups []SecurityGroup `json:"security_groups"`
}

SecurityGroupsContainer contains a list of security groups. Used to response to json as a container wrapper.

type Server

type Server struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Links []Link `json:"links"`
}

Server contains basic information of a server

type ServerBlockDeviceMappingV2

type ServerBlockDeviceMappingV2 struct {
	DeviceName          string `json:"device_name"`
	SourceType          string `json:"source_type"`
	DestinationType     string `json:"destination_type,omitempty"`
	DeleteOnTermination bool   `json:"delete_on_termination,string"`
	GuestFormat         string `json:"guest_format"`
	BootIndex           int    `json:"boot_index,string"`
	UUID                string `json:"uuid,omitempty"`
	ConfigDrive         bool   `json:"config_drive,omitempty"`
}

ServerBlockDeviceMappingV2 contains properties related to booting a new server using devices in block storage.

type ServerCreationParameters

type ServerCreationParameters struct {
	Name        string `json:"name"`
	ImageRef    string `json:"imageRef"`
	KeyPairName string `json:"key_name"`
	FlavorRef   string `json:"flavorRef"`

	// optional parameters
	MaxCount             *int32                       `json:"maxcount,omitempty"`
	MinCount             *int32                       `json:"mincount,omitempty"`
	UserData             *string                      `json:"user_data,omitempty"`
	AvailabilityZone     *string                      `json:"availability_zone,omitempty"`
	Networks             []ServerNetworkParameters    `json:"networks,omitempty"`
	SecurityGroups       []SecurityGroup              `json:"security_groups,omitempty"`
	Metadata             map[string]string            `json:"metadata,omitempty"`
	Personality          []ServerPersonality          `json:"personality,omitempty"`
	BlockDeviceMappingV2 []ServerBlockDeviceMappingV2 `json:"block_device_mapping_v2,omitempty"`
}

ServerCreationParameters contains server service parameters

type ServerDetail

type ServerDetail struct {
	ID               string               `json:"id"`
	Name             string               `json:"name"`
	Status           string               `json:"status"`
	Created          time.Time            `json:"created"`
	Updated          *time.Time           `json:"updated"`
	HostID           string               `json:"hostId"`
	Addresses        map[string][]Address `json:"addresses"`
	Links            []Link               `json:"links"`
	Image            ImageWrapper         `json:"image"`
	Flavor           Flavor               `json:"flavor"`
	TaskState        string               `json:"OS-EXT-STS:task_state"`
	VMState          string               `json:"OS-EXT-STS:vm_state"`
	PowerState       int                  `json:"OS-EXT-STS:power_state"`
	AvailabilityZone string               `json:"OS-EXT-AZ:availability_zone"`
	UserID           string               `json:"user_id"`
	TenantID         string               `json:"tenant_id"`
	AccessIPv4       string               `json:"accessIPv4"`
	AccessIPv6       string               `json:"accessIPv6"`
	ConfigDrive      string               `json:"config_drive"`
	Progress         int                  `json:"progress"`
	MetaData         map[string]string    `json:"metadata"`
	AdminPass        string               `json:"adminPass"`
	KeyName          string               `json:"key_name"`
}

ServerDetail contains detailed information of a server

type ServerDetailQueryParameters

type ServerDetailQueryParameters struct {
	Name   string `json:"name"`
	Limit  int64  `json:"limit"`
	Marker string `json:"marker"`
}

ServerDetailQueryParameters contains properties that allow filtering and paging of servers.

type ServerNetworkParameters

type ServerNetworkParameters struct {
	UUID    string `json:"uuid,omitempty"`
	Port    string `json:"port,omitempty"`
	FixedIP string `json:"fixed_ip,omitempty"`
}

ServerNetworkParameters contains server network related parameters

type ServerPersonality

type ServerPersonality struct {
	Path     string `json:"path"`
	Contents string `json:"contents"`
}

ServerPersonality contains server personaility information.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a client service that can make requests against a OpenStack compute v2 service.

func NewService

func NewService(authenticator common.Authenticator) Service

NewService creates a new compute service client.

func (Service) AttachVolume

func (computeService Service) AttachVolume(serverID string, volumeID string, device string) (VolumeAttachment, error)

AttachVolume attaches a volume to the specified server.

func (Service) AvailabilityZones

func (computeService Service) AvailabilityZones() ([]AvailabilityZone, error)

AvailabilityZones will issue a GET request to retrieve all availability zones.

func (Service) CreateFloatingIP

func (computeService Service) CreateFloatingIP(pool string) (FloatingIP, error)

CreateFloatingIP will issue a Post query creates a new floating ip and return the created value.

func (Service) CreateFloatingIPInDefaultPool

func (computeService Service) CreateFloatingIPInDefaultPool() (FloatingIP, error)

CreateFloatingIPInDefaultPool will issue a Post query to create a floating ip in the default pool and returns the created value.

func (Service) CreateKeyPair

func (computeService Service) CreateKeyPair(name string, publickey string) (KeyPairResponse, error)

CreateKeyPair will send a POST request to create a new keypair with the specified parameters.

func (Service) CreateSecurityGroup

func (computeService Service) CreateSecurityGroup(parameters CreateSecurityGroupParameters) (SecurityGroup, error)

CreateSecurityGroup will issue a Post query creates a new security group and returns the created value.

func (Service) CreateSecurityGroupRule

func (computeService Service) CreateSecurityGroupRule(sgr CreateSecurityGroupRuleParameters) (SecurityGroupRule, error)

CreateSecurityGroupRule creates a new security group rule in the specified parent.

func (Service) CreateServer

func (computeService Service) CreateServer(serverCreationParameters ServerCreationParameters) (CreateServerResponse, error)

CreateServer creates a virtual machine cloud server

func (Service) DeleteFloatingIP

func (computeService Service) DeleteFloatingIP(floatingIPID string) (err error)

DeleteFloatingIP will issue a delete query to delete the floating ip.

func (Service) DeleteKeyPair

func (computeService Service) DeleteKeyPair(name string) (err error)

DeleteKeyPair will delete the keypair.

func (Service) DeleteSecurityGroup

func (computeService Service) DeleteSecurityGroup(securityGroupID string) (err error)

DeleteSecurityGroup will issue a delete query to delete the specified security group.

func (Service) DeleteSecurityGroupRule

func (computeService Service) DeleteSecurityGroupRule(securityGroupRuleID string) (err error)

DeleteSecurityGroupRule will issue a delete query to delete the specified security group rule.

func (Service) DeleteServer

func (computeService Service) DeleteServer(id string) (err error)

DeleteServer deletes a virtual machine cloud server

func (Service) DeleteServerMetadata

func (computeService Service) DeleteServerMetadata(serverID string) error

DeleteServerMetadata deletes the metadata of the server by sending an empty metadata to the specified server.

func (Service) DeleteServerMetadataItem

func (computeService Service) DeleteServerMetadataItem(serverID string, metaItemName string) error

DeleteServerMetadataItem deletes the specified metaItem from the metadata the server.

func (Service) DeleteVolumeAttachment

func (computeService Service) DeleteVolumeAttachment(serverID string, attachmentID string) (err error)

DeleteVolumeAttachment deletes the specified volume attachment from a specified server.

func (Service) FlavorDetail

func (computeService Service) FlavorDetail(flavorID string) (FlavorDetail, error)

FlavorDetail will issue a GET request to retrieve the specified flavor detail.

func (Service) Flavors

func (computeService Service) Flavors() ([]Flavor, error)

Flavors will issue a GET request to retrieve all flavors.

func (Service) FlavorsDetail

func (computeService Service) FlavorsDetail() ([]FlavorDetail, error)

FlavorsDetail will issue a GET request to retrieve all flavors detail.

func (Service) FloatingIP

func (computeService Service) FloatingIP(id string) (FloatingIP, error)

FloatingIP will issue a get query that returns a floating ip.

func (Service) FloatingIPs

func (computeService Service) FloatingIPs() ([]FloatingIP, error)

FloatingIPs will issue a get query that returns a list of floating ips.

func (Service) KeyPair

func (computeService Service) KeyPair(name string) (KeyPairResponse, error)

KeyPair will issue a get request to retrieve the specified keypair.

func (Service) KeyPairs

func (computeService Service) KeyPairs() ([]KeyPairResponse, error)

KeyPairs will issue a get request to retrieve the all keypairs.

func (Service) Limits

func (computeService Service) Limits() (Limits, error)

Limits will issue a get request to retrieve the all limits for the user.

func (Service) QueryServersDetail

func (computeService Service) QueryServersDetail(queryParameters ServerDetailQueryParameters) ([]ServerDetail, error)

QueryServersDetail retrieves detailed information of servers based on the query parameters provided

func (Service) SecurityGroup

func (computeService Service) SecurityGroup(id string) (SecurityGroup, error)

SecurityGroup will issue a get query that returns a security group based on the id.

func (Service) SecurityGroups

func (computeService Service) SecurityGroups() ([]SecurityGroup, error)

SecurityGroups will issue a get query that returns a list of security groups in the system.

func (Service) ServerAction

func (computeService Service) ServerAction(id string, action string, key string, value string) (err error)

ServerAction invokes an action on a virtual machine cloud server

func (Service) ServerDetail

func (computeService Service) ServerDetail(id string) (serverDetail ServerDetail, err error)

ServerDetail retrieves detailed information of a server

func (Service) ServerDetails

func (computeService Service) ServerDetails() (serverDetails []ServerDetail, err error)

ServerDetails retrieves detailed information of servers

func (Service) ServerMetadata

func (computeService Service) ServerMetadata(serverID string) (map[string]string, error)

ServerMetadata retrieves all metadata properties of the specified server.

func (Service) ServerMetadataItem

func (computeService Service) ServerMetadataItem(serverID string, metaItemName string) (string, error)

ServerMetadataItem retrieves the specific metadata item of the specified server.

func (Service) ServerSecurityGroups

func (computeService Service) ServerSecurityGroups(serverID string) ([]SecurityGroup, error)

ServerSecurityGroups will issue a get query that returns the security groups for the specified server.

func (Service) Servers

func (computeService Service) Servers() ([]Server, error)

Servers retrieves basic server information

func (Service) SetServerMetadata

func (computeService Service) SetServerMetadata(serverID string, metadata map[string]string) (map[string]string, error)

SetServerMetadata sets the metadata to the specified server.

func (Service) SetServerMetadataItem

func (computeService Service) SetServerMetadataItem(serverID string, metaItemName string, value string) (map[string]string, error)

SetServerMetadataItem sets the specific metadata item to the a value for the specified server. It returns the value that was specified.

func (Service) VolumeAttachment

func (computeService Service) VolumeAttachment(serverID string, attachmentID string) (VolumeAttachment, error)

VolumeAttachment shows details for the specified volume attachment.

func (Service) VolumeAttachments

func (computeService Service) VolumeAttachments(serverID string) ([]VolumeAttachment, error)

VolumeAttachments lists the volume attachments for a specified server.

type VolumeAttachment

type VolumeAttachment struct {
	ID       string `json:"id,omitempty"`
	Device   string `json:"device"`
	ServerID string `json:"serverId,omitempty"`
	VolumeID string `json:"volumeId"`
}

VolumeAttachment contains properties a volume that can be attached to a server and can be in a specified pool.

type ZoneState

type ZoneState struct {
	Available bool `json:"available"`
}

ZoneState contains state of OpenStack availability zone

Jump to

Keyboard shortcuts

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