swift

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConfig

type BackendConfig struct {
	BackendName   string `yaml:"name"`
	Username      string `yaml:"username"`
	APIKey        string `yaml:"apikey"`
	AuthURL       string `yaml:"authurl"`
	Region        string `yaml:"region"`
	Container     string `yaml:"container"`
	ExpireSeconds int    `yaml:"expireseconds"`
}

BackendConfig is the data structure containing all information required to connect to a single OpenStack Swift server

func (*BackendConfig) Name

func (conf *BackendConfig) Name() string

Name returns the name configured for this OpenStack Swift Backend

func (*BackendConfig) Validate

func (conf *BackendConfig) Validate() error

Validate validates the OpenStack Swift Backend and returns the first error that occured during validation.

type Client

type Client struct {
	Conn   swift.Connection
	Config BackendConfig
}

Client is an OpenStack Swift Client Object

func New

func New(ctx context.Context, conf BackendConfig) *Client

New creates a new OpenStack Swift client

func (*Client) BackendName

func (c *Client) BackendName() string

BackendName returns 'OpenStack Swift'

func (*Client) Bucket

func (c *Client) Bucket() string

Bucket returns the OpenStack Swift Container Name

func (*Client) BucketExists

func (c *Client) BucketExists(ctx context.Context, name string) (bool, error)

BucketExists returns if a particular bucket exists and is reachable by the OpenStack Swift client

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

Connect connects the OpenStack Swift client to the backend service and authenticates

func (*Client) Disconnect

func (c *Client) Disconnect(ctx context.Context) error

Disconnect terminates the connection of the OpenStack Swift client with the backend server

func (*Client) Name

func (c *Client) Name() string

Name returns the OpenStack Swift Client Name

func (*Client) ObjectExists

func (c *Client) ObjectExists(ctx context.Context, name string) (bool, error)

ObjectExists returns if a particular object exists and is reachable by the OpenStack Swift client

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, name string, file io.Reader, filesize int64) error

UploadFile uploads a file to the OpenStack Swift Backend, with a name of name.

Jump to

Keyboard shortcuts

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