• Stars
    star
    313
  • Rank 133,714 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created about 12 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go language interface to Swift / Openstack Object Storage / Rackspace cloud files (golang)

Swift

This package provides an easy to use library for interfacing with Swift / Openstack Object Storage / Rackspace cloud files from the Go Language

Build Status Go Reference

Install

Use go to install the library

go get github.com/ncw/swift/v2

Usage

See here for full package docs

Here is a short example from the docs

import "github.com/ncw/swift/v2"

// Create a connection
c := swift.Connection{
UserName: "user",
ApiKey:   "key",
AuthUrl:  "auth_url",
Domain:   "domain", // Name of the domain (v3 auth only)
Tenant:   "tenant", // Name of the tenant (v2 auth only)
}
// Authenticate
err := c.Authenticate()
if err != nil {
panic(err)
}
// List all the containers
containers, err := c.ContainerNames(nil)
fmt.Println(containers)
// etc...

Migrating from v1

The library has current major version v2. If you want to migrate from the first version of library github.com/ncw/swift you have to explicitly add the /v2 suffix to the imports.

Most of the exported functions were added a new context.Context parameter in the v2, which you will have to provide when migrating.

Additions

The rs sub project contains a wrapper for the Rackspace specific CDN Management interface.

Testing

To run the tests you can either use an embedded fake Swift server either use a real Openstack Swift server or a Rackspace Cloud files account.

When using a real Swift server, you need to set these environment variables before running the tests

export SWIFT_API_USER='user'
export SWIFT_API_KEY='key'
export SWIFT_AUTH_URL='https://url.of.auth.server/v1.0'

And optionally these if using v2 authentication

export SWIFT_TENANT='TenantName'
export SWIFT_TENANT_ID='TenantId'

And optionally these if using v3 authentication

export SWIFT_TENANT='TenantName'
export SWIFT_TENANT_ID='TenantId'
export SWIFT_API_DOMAIN_ID='domain id'
export SWIFT_API_DOMAIN='domain name'

And optionally these if using v3 trust

export SWIFT_TRUST_ID='TrustId'

And optionally this if you want to skip server certificate validation

export SWIFT_AUTH_INSECURE=1

And optionally this to configure the connect channel timeout, in seconds

export SWIFT_CONNECTION_CHANNEL_TIMEOUT=60

And optionally this to configure the data channel timeout, in seconds

export SWIFT_DATA_CHANNEL_TIMEOUT=60

Then run the tests with go test

License

This is free software under the terms of MIT license (check COPYING file included in this package).

Contact and support

The project website is at:

There you can file bug reports, ask for help or contribute patches.

Authors

Contributors

More Repositories

1

stressdisk

Stress test your disks / memory cards / USB sticks before trusting your valuable data to them
Go
320
star
2

directio

This is library for the Go language to enable use of Direct IO under all OSes
Go
298
star
3

gotemplate

Package based templating system for Go
Go
258
star
4

gmp

Go language interface to GMP - GNU Multiprecision Library (golang)
Go
108
star
5

go-nflog-acctd

IP accounting using NFLOG under Linux iptables
Go
53
star
6

oauthproxy

This is an oauth2 proxy server
Go
34
star
7

johnroids

Johnroids is an old style asteroids game implemented in go, gopherjs and go/wasm
Go
29
star
8

dropbox

Go (golang) client library for the Dropbox core and Datastore API with support for uploading and downloading encrypted files.
Go
11
star
9

go-deadlocks-talk

Sample code for my Go Deadlocks talk
Go
9
star
10

make_test_files

A program to generate test files
Go
8
star
11

fsyncbench

Benchmark fsync
Go
8
star
12

fetch-actions-logs

Fetch your GitHub Actions logs
Go
8
star
13

iprime

All integer Mersenne prime checker
C++
7
star
14

oxo3d

Oxo3d - 3D noughts and crosses / tic tac toe
Go
6
star
15

ioccc2012

Mersenne prime prover for IOCCC 2012
C
6
star
16

mirror

Neopixel based Infinity Mirror running on Raspbery Pi Pico-W with Micropython
Python
5
star
17

snake-puzzle

A solver for the Snake Puzzle using python with a Jupyter notebook
Jupyter Notebook
5
star
18

rcloneguiexperiment

Rclone GUI experiment
JavaScript
5
star
19

pwhash

Mirror of antihe.ro/pwhash
Go
5
star
20

pslq

Go (golang) library and cli tool for using the PSLQ integer relation algorithm.
Go
3
star
21

mandelterm

View Mandelbrot sets in your terminal
Go
3
star
22

www

Nick Craig-Wood's Website
Python
2
star
23

router-rebooter

Reboots your Netgear DG834 ADSL router when the internet connection drops
Python
2
star
24

parse-actions-logs

Parse GitHub actions logs for go test results
Go
2
star
25

.github

Default community health files for ncw
1
star
26

rclone-archive

Archive of old rclone branches
Go
1
star
27

euler_bbp

Programs and paper to demonstrate Euler's BBP-type formulae for pi
TeX
1
star