openstack

package
v19.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 49 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromIntIPversion

func FromIntIPversion(v int) IPVersion.Enum

FromIntIPversion ...

func ParseNeutronError

func ParseNeutronError(neutronError string) map[string]string

ParseNeutronError parses neutron json error and returns fields

func ProviderErrorToString

func ProviderErrorToString(err error) string

ProviderErrorToString creates an error string from openstack api error

func ToGopherIPversion

func ToGopherIPversion(v IPVersion.Enum) gophercloud.IPVersion

ToGopherIPversion ...

func TranslateError

func TranslateError(err error) error

TranslateError translates gophercloud or openstack error to SafeScale error

Types

type Router

type Router struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	//NetworkID is the Network ID which the router gateway is connected to.
	NetworkID string `json:"network_id,omitempty"`
}

Router represents a router

type RouterRequest

type RouterRequest struct {
	Name string `json:"name,omitempty"`
	//NetworkID is the Network ID which the router gateway is connected to.
	NetworkID string `json:"network_id,omitempty"`
}

RouterRequest represents a router request

type Stack

type Stack struct {
	ComputeClient *gophercloud.ServiceClient
	NetworkClient *gophercloud.ServiceClient
	VolumeClient  *gophercloud.ServiceClient
	Driver        *gophercloud.ProviderClient

	// DefaultSecurityGroupName is the name of the default security groups
	DefaultSecurityGroupName string
	// DefaultSecurityGroupDescription contains a description for the default security groups
	DefaultSecurityGroupDescription string
	// SecurityGroup is an instance of the default security group
	SecurityGroup     *secgroups.SecGroup
	ProviderNetworkID string
	// contains filtered or unexported fields
}

Stack contains the needs to operate on stack OpenStack

func New

func New(
	auth stacks.AuthenticationOptions,
	authScope *gophercloud.AuthScope,
	cfg stacks.ConfigurationOptions,
	serviceVersions map[string]string,
) (*Stack, error)

New authenticates and returns a Stack pointer

func (*Stack) AddPublicIPToVIP

func (s *Stack) AddPublicIPToVIP(vip *resources.VIP) error

AddPublicIPToVIP adds a public IP to VIP

func (*Stack) BindHostToVIP

func (s *Stack) BindHostToVIP(vip *resources.VIP, host *resources.Host) error

BindHostToVIP makes the host passed as parameter an allowed "target" of the VIP

func (*Stack) CreateGateway

func (s *Stack) CreateGateway(req resources.GatewayRequest) (host *resources.Host, userData *userdata.Content, err error)

CreateGateway creates a public Gateway for a private network

func (*Stack) CreateHost

func (s *Stack) CreateHost(request resources.HostRequest) (host *resources.Host, userData *userdata.Content, err error)

CreateHost creates an host satisfying request

func (*Stack) CreateKeyPair

func (s *Stack) CreateKeyPair(name string) (*resources.KeyPair, error)

CreateKeyPair creates and import a key pair

func (*Stack) CreateNetwork

func (s *Stack) CreateNetwork(req resources.NetworkRequest) (newNet *resources.Network, err error)

CreateNetwork creates a network named name

func (*Stack) CreateVIP

func (s *Stack) CreateVIP(networkID string, name string) (*resources.VIP, error)

CreateVIP creates a private virtual IP If public is set to true,

func (*Stack) CreateVolume

func (s *Stack) CreateVolume(request resources.VolumeRequest) (volume *resources.Volume, err error)

CreateVolume creates a block volume - name is the name of the volume - size is the size of the volume in GB - volumeType is the type of volume to create, if volumeType is empty the driver use a default type

func (*Stack) CreateVolumeAttachment

func (s *Stack) CreateVolumeAttachment(request resources.VolumeAttachmentRequest) (string, error)

CreateVolumeAttachment attaches a volume to an host - 'name' of the volume attachment - 'volume' to attach - 'host' on which the volume is attached

func (*Stack) DeleteGateway

func (s *Stack) DeleteGateway(id string) error

DeleteGateway delete the public gateway of a private network

func (*Stack) DeleteHost

func (s *Stack) DeleteHost(id string) error

DeleteHost deletes the host identified by id

func (*Stack) DeleteKeyPair

func (s *Stack) DeleteKeyPair(id string) error

DeleteKeyPair deletes the key pair identified by id

func (*Stack) DeleteNetwork

func (s *Stack) DeleteNetwork(id string) error

DeleteNetwork deletes the network identified by id

func (*Stack) DeleteVIP

func (s *Stack) DeleteVIP(vip *resources.VIP) error

DeleteVIP deletes the port corresponding to the VIP

func (*Stack) DeleteVolume

func (s *Stack) DeleteVolume(id string) (err error)

DeleteVolume deletes the volume identified by id

func (*Stack) DeleteVolumeAttachment

func (s *Stack) DeleteVolumeAttachment(serverID, vaID string) error

DeleteVolumeAttachment deletes the volume attachment identified by id

func (*Stack) GetAuthenticationOptions

func (s *Stack) GetAuthenticationOptions() stacks.AuthenticationOptions

GetAuthenticationOptions ...

func (*Stack) GetAvailabilityZoneOfServer

func (s *Stack) GetAvailabilityZoneOfServer(serverID string) (string, error)

GetAvailabilityZoneOfServer retrieves the availability zone of server 'serverID'

func (*Stack) GetConfigurationOptions

func (s *Stack) GetConfigurationOptions() stacks.ConfigurationOptions

GetConfigurationOptions ...

func (*Stack) GetHostByName

func (s *Stack) GetHostByName(name string) (*resources.Host, error)

GetHostByName returns the host using the name passed as parameter

func (*Stack) GetHostState

func (s *Stack) GetHostState(hostParam interface{}) (HostState.Enum, error)

GetHostState returns the current state of host identified by id hostParam can be a string or an instance of *resources.Host; any other type will return an scerr.InvalidParameterError

func (*Stack) GetImage

func (s *Stack) GetImage(id string) (image *resources.Image, err error)

GetImage returns the Image referenced by id

func (*Stack) GetKeyPair

func (s *Stack) GetKeyPair(id string) (*resources.KeyPair, error)

GetKeyPair returns the key pair identified by id

func (*Stack) GetNetwork

func (s *Stack) GetNetwork(id string) (*resources.Network, error)

GetNetwork returns the network identified by id

func (*Stack) GetNetworkByName

func (s *Stack) GetNetworkByName(name string) (*resources.Network, error)

GetNetworkByName ...

func (*Stack) GetSecurityGroup

func (s *Stack) GetSecurityGroup(name string) (*secgroups.SecGroup, error)

GetSecurityGroup returns the default security group

func (*Stack) GetTemplate

func (s *Stack) GetTemplate(id string) (template *resources.HostTemplate, err error)

GetTemplate returns the Template referenced by id

func (*Stack) GetVolume

func (s *Stack) GetVolume(id string) (*resources.Volume, error)

GetVolume returns the volume identified by id

func (*Stack) GetVolumeAttachment

func (s *Stack) GetVolumeAttachment(serverID, id string) (*resources.VolumeAttachment, error)

GetVolumeAttachment returns the volume attachment identified by id

func (*Stack) InitDefaultSecurityGroup

func (s *Stack) InitDefaultSecurityGroup() error

InitDefaultSecurityGroup create an open Security Group The default security group opens all TCP, UDP, ICMP ports Security is managed individually on each host using a linux firewall

func (*Stack) InspectHost

func (s *Stack) InspectHost(hostParam interface{}) (*resources.Host, error)

InspectHost updates the data inside host with the data from provider

func (*Stack) ListAvailabilityZones

func (s *Stack) ListAvailabilityZones() (list map[string]bool, err error)

ListAvailabilityZones lists the usable AvailabilityZones

func (*Stack) ListHosts

func (s *Stack) ListHosts() ([]*resources.Host, error)

ListHosts lists all hosts

func (*Stack) ListImages

func (s *Stack) ListImages() (imgList []resources.Image, err error)

ListImages lists available OS images

func (*Stack) ListKeyPairs

func (s *Stack) ListKeyPairs() ([]resources.KeyPair, error)

ListKeyPairs lists available key pairs Returned list can be empty

func (*Stack) ListNetworks

func (s *Stack) ListNetworks() ([]*resources.Network, error)

ListNetworks lists available networks

func (*Stack) ListRegions

func (s *Stack) ListRegions() ([]string, error)

ListRegions ...

func (*Stack) ListRouters

func (s *Stack) ListRouters() ([]Router, error)

ListRouters lists available routers

func (*Stack) ListTemplates

func (s *Stack) ListTemplates() ([]resources.HostTemplate, error)

ListTemplates lists available Host templates Host templates are sorted using Dominant Resource Fairness Algorithm

func (*Stack) ListVolumeAttachments

func (s *Stack) ListVolumeAttachments(serverID string) ([]resources.VolumeAttachment, error)

ListVolumeAttachments lists available volume attachment

func (*Stack) ListVolumes

func (s *Stack) ListVolumes() ([]resources.Volume, error)

ListVolumes returns the list of all volumes known on the current tenant

func (*Stack) RebootHost

func (s *Stack) RebootHost(id string) error

RebootHost reboots unconditionally the host identified by id

func (*Stack) ResizeHost

func (s *Stack) ResizeHost(id string, request resources.SizingRequirements) (*resources.Host, error)

ResizeHost ...

func (*Stack) SelectedAvailabilityZone

func (s *Stack) SelectedAvailabilityZone() (string, error)

SelectedAvailabilityZone returns the selected availability zone

func (*Stack) StartHost

func (s *Stack) StartHost(id string) error

StartHost starts the host identified by id

func (*Stack) StopHost

func (s *Stack) StopHost(id string) error

StopHost stops the host identified by id

func (*Stack) UnbindHostFromVIP

func (s *Stack) UnbindHostFromVIP(vip *resources.VIP, host *resources.Host) error

UnbindHostFromVIP removes the bind between the VIP and a host

func (*Stack) WaitHostReady

func (s *Stack) WaitHostReady(hostParam interface{}, timeout time.Duration) (*resources.Host, error)

WaitHostReady waits an host achieve ready state hostParam can be an ID of host, or an instance of *resources.Host; any other type will return an utils.ErrInvalidParameter

type Subnet

type Subnet struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	//IPVersion is IPv4 or IPv6 (see IPVersion)
	IPVersion IPVersion.Enum `json:"ip_version,omitempty"`
	//Mask mask in CIDR notation
	Mask string `json:"mask,omitempty"`
	//NetworkID id of the parent network
	NetworkID string `json:"network_id,omitempty"`
}

Subnet define a sub network

Jump to

Keyboard shortcuts

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