client

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// VolumeStatusAvailable indicates that he volume is available to be attached.
	VolumeStatusAvailable = "available"
	// VolumeStatusCreating indicates that the volume is being created.
	VolumeStatusCreating = "creating"
	// VolumeStatusDownloading indicates that the volume is in downloading state.
	VolumeStatusDownloading = "downloading"
	// VolumeStatusDeleting indicates that the volume is in the process of being deleted.
	VolumeStatusDeleting = "deleting"
	// VolumeStatusError indicates that the volume is in error state.
	VolumeStatusError = "error"
	// VolumeStatusInUse indicates that the volume is currently in use.
	VolumeStatusInUse = "in-use"
)
View Source
const (

	// ServerStatusActive indicates that the server is active.
	ServerStatusActive = "ACTIVE"
	// ServerStatusBuild indicates tha the server has not yet finished the build process.
	ServerStatusBuild = "BUILD"
	// ServerStatusDeleted indicates that the server is deleted.
	ServerStatusDeleted = "DELETED"
	// ServerStatusError indicates that the server is in error.
	ServerStatusError = "ERROR"
)

Variables

This section is empty.

Functions

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if an error returned by OpenStack service calls is caused by HTTP 404 status code.

func IsUnauthenticated

func IsUnauthenticated(err error) bool

IsUnauthenticated checks if an error returned by OpenStack service calls is caused by HTTP 401 status code.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized checks if an error returned by OpenStack service calls is caused by HTTP 403 status code.

Types

type Compute

type Compute interface {
	// CreateServer creates a server.
	CreateServer(opts servers.CreateOptsBuilder) (*servers.Server, error)
	// BootFromVolume creates a server from a block device mapping.
	BootFromVolume(opts servers.CreateOptsBuilder) (*servers.Server, error)
	// GetServer fetches server data from the supplied ID.
	GetServer(id string) (*servers.Server, error)
	// ListServers lists all servers based on opts constraints.
	ListServers(opts servers.ListOptsBuilder) ([]servers.Server, error)
	// DeleteServer deletes a server with the supplied ID. If the server does not exist it returns nil.
	DeleteServer(id string) error

	// FlavorIDFromName resolves the given flavor name to a unique ID.
	FlavorIDFromName(name string) (string, error)
	// ImageIDFromName resolves the given image name to a unique ID.
	ImageIDFromName(name string) (string, error)
}

Compute is an interface for communication with Nova service.

type Factory

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

Factory can create clients for Nova and Neutron OpenStack services.

func NewFactoryFromSecret

func NewFactoryFromSecret(secret *corev1.Secret) (*Factory, error)

NewFactoryFromSecret can create a Factory from the a kubernetes secret.

func NewFactoryFromSecretData

func NewFactoryFromSecretData(data map[string][]byte) (*Factory, error)

NewFactoryFromSecretData can create a Factory from the a kubernetes secret's data.

func (*Factory) Compute

func (f *Factory) Compute(opts ...Option) (Compute, error)

Compute returns a client for OpenStack's Nova service.

func (*Factory) Network

func (f *Factory) Network(opts ...Option) (Network, error)

Network returns a client for OpenStack's Neutron service.

func (*Factory) Storage

func (f *Factory) Storage(opts ...Option) (Storage, error)

Storage returns a client for OpenStack's Cinder service.

type Network

type Network interface {
	// GetSubnet fetches the subnet data from the supplied ID.
	GetSubnet(id string) (*subnets.Subnet, error)

	// CreatePort creates a Neutron port.
	CreatePort(opts ports.CreateOptsBuilder) (*ports.Port, error)
	// ListPorts lists all ports.
	ListPorts(opts ports.ListOptsBuilder) ([]ports.Port, error)
	// UpdatePort updates the port from the supplied ID.
	UpdatePort(id string, opts ports.UpdateOptsBuilder) error
	// DeletePort deletes the port from the supplied ID.
	DeletePort(id string) error

	// NetworkIDFromName resolves the given network name to a unique ID.
	NetworkIDFromName(name string) (string, error)
	// GroupIDFromName resolves the given security group name to a unique ID.
	GroupIDFromName(name string) (string, error)
	// PortIDFromName resolves the given port name to a unique ID.
	PortIDFromName(name string) (string, error)
	// TagPort tags a port with the specified labels.
	TagPort(id string, tags []string) error
}

Network is an interface for communication with Neutron service.

type Option

Option can modify client parameters by manipulating EndpointOpts.

func WithRegion

func WithRegion(region string) Option

WithRegion returns an Option that can modify the region a client targets.

type Storage

type Storage interface {
	// CreateVolume creates a Cinder volume.
	CreateVolume(opts volumes.CreateOptsBuilder) (*volumes.Volume, error)
	// GetVolume retrieves information about a volume.
	GetVolume(id string) (*volumes.Volume, error)
	// DeleteVolume deletes a volume
	DeleteVolume(id string) error
	// VolumeIDFromName resolves the given volume name to a unique ID.
	VolumeIDFromName(name string) (string, error)
	// ListVolumes lists all volumes
	ListVolumes(opts volumes.ListOptsBuilder) ([]volumes.Volume, error)
}

Storage is an interface for communication with Cinder service.

Jump to

Keyboard shortcuts

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