client

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerGroupPolicyAntiAffinity = "anti-affinity"
	ServerGroupPolicyAffinity     = "affinity"
)

Variables

This section is empty.

Functions

func IsNotFoundError added in v1.14.0

func IsNotFoundError(err error) bool

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

Types

type Compute added in v1.14.0

type Compute interface {
	CreateServerGroup(name, policy string) (*servergroups.ServerGroup, error)
	GetServerGroup(id string) (*servergroups.ServerGroup, error)
	DeleteServerGroup(id string) error
	ListServerGroups() ([]servergroups.ServerGroup, error)
}

Compute describes the operations of a client interacting with OpenStack's Compute service.

type ComputeClient added in v1.14.0

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

ComputeClient is a client for the Nova service.

func (*ComputeClient) CreateServerGroup added in v1.14.0

func (c *ComputeClient) CreateServerGroup(name, policy string) (*servergroups.ServerGroup, error)

CreateServerGroup creates a server group with the specified policy.

func (*ComputeClient) DeleteServerGroup added in v1.14.0

func (c *ComputeClient) DeleteServerGroup(id string) error

DeleteServerGroup deletes the server group with the specified id. It returns nil if the server group could not be found.

func (*ComputeClient) GetServerGroup added in v1.14.0

func (c *ComputeClient) GetServerGroup(id string) (*servergroups.ServerGroup, error)

GetServerGroup retrieves the server group with the specified id.

func (*ComputeClient) ListServerGroups added in v1.14.0

func (c *ComputeClient) ListServerGroups() ([]servergroups.ServerGroup, error)

ListServerGroups retrieves the list of server groups.

type Factory added in v1.14.0

type Factory interface {
	Compute(options ...Option) (Compute, error)
	Storage(options ...Option) (Storage, error)
}

Factory is an interface for constructing OpenStack service clients.

func NewOpenStackClientFromSecretRef added in v1.14.0

func NewOpenStackClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference, keyStoneUrl *string) (Factory, error)

NewOpenStackClientFromSecretRef returns a Factory implementation that can be used to create clients for OpenStack services. The credentials are fetched from the Kubernetes secret referenced by <secretRef>.

func NewOpenstackClientFromCredentials added in v1.14.0

func NewOpenstackClientFromCredentials(credentials *os.Credentials) (Factory, error)

NewOpenstackClientFromCredentials returns a Factory implementation that can be used to create clients for OpenStack services.

type OpenstackClientFactory added in v1.14.0

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

OpenstackClientFactory implements a factory that can construct clients for Openstack services.

func (*OpenstackClientFactory) Compute added in v1.14.0

func (oc *OpenstackClientFactory) Compute(options ...Option) (Compute, error)

Compute returns a Compute client. The client uses Nova v2 API for issuing calls.

func (*OpenstackClientFactory) Storage added in v1.14.0

func (oc *OpenstackClientFactory) Storage(options ...Option) (Storage, error)

Storage returns a Storage client. The client uses Swift v1 API for issuing calls.

type Option added in v1.14.0

Option can be passed to Factory implementations to modify the produced clients.

func WithRegion added in v1.14.0

func WithRegion(region string) Option

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

type Storage

type Storage interface {
	DeleteObjectsWithPrefix(ctx context.Context, container, prefix string) error
	CreateContainerIfNotExists(ctx context.Context, container string) error
	DeleteContainerIfExists(ctx context.Context, container string) error
}

Storage describes the operations of a client interacting with OpenStack's ObjectStorage service.

func NewStorageClientFromSecretRef

func NewStorageClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference, region string) (Storage, error)

NewStorageClientFromSecretRef retrieves the openstack client from specified by the secret reference.

type StorageClient

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

StorageClient is a client for the Swift service.

func (*StorageClient) CreateContainerIfNotExists

func (s *StorageClient) CreateContainerIfNotExists(ctx context.Context, container string) error

CreateContainerIfNotExists creates the openstack blob container with name <container>. If it already exist, no error is returned.

func (*StorageClient) DeleteContainerIfExists

func (s *StorageClient) DeleteContainerIfExists(ctx context.Context, container string) error

DeleteContainerIfExists deletes the openstack blob container with name <container>. If it does not exist, no error is returned.

func (*StorageClient) DeleteObjectsWithPrefix

func (s *StorageClient) DeleteObjectsWithPrefix(ctx context.Context, container, prefix string) error

DeleteObjectsWithPrefix deletes the blob objects with the specific <prefix> from <container>. If it does not exist, no error is returned.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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