Go language interface to Swift / Openstack Object Storage / Rackspace cloud files (golang)
Go Shell
Latest commit 8e9b102 Mar 15, 2017 @cezarsa cezarsa committed on GitHub Merge pull request #86 from majewsky/watchdog-reader-fix
fix slicing in watchdog reader
Permalink
Failed to load latest commit information.
rs Fix stale targetUrl on re authentication - fixes #22 Mar 11, 2014
swifttest Rework tests to avoid shared state between test cases Mar 5, 2017
.gitignore Ignore some more rubbish Nov 11, 2012
.travis.yml travis: run tests pointing to rackspace and memset swift APIs Mar 5, 2017
COPYING Sort out documentation Nov 11, 2012
README.md Add Christopher Waldon to contributors Dec 13, 2016
auth.go Allow using adminURL as endpoint type on v2/v3 auth May 17, 2016
auth_v3.go Support different region endpoints in v3 auth May 17, 2016
compatibility_1_0.go Export Connection.Transport for use on Appengine Jan 23, 2014
compatibility_1_1.go Export Connection.Transport for use on Appengine Jan 23, 2014
dlo.go Improve performance by using bufio with large objects by default Aug 29, 2016
doc.go Document methods are safe to use concurrently - fixes #23 May 30, 2014
example_test.go Rework tests to avoid shared state between test cases Mar 5, 2017
largeobjects.go Handle large objects correctly when /info is not supported Mar 5, 2017
meta.go Fix documentation Nov 28, 2012
meta_test.go Factor Metadata code into own file and add tests and mtime manipulation Nov 27, 2012
notes.txt Implement timeouts. Use go 1.1 CancelRequest feature if available Aug 19, 2013
slo.go Handle large objects correctly when /info is not supported Mar 5, 2017
swift.go Handle large objects correctly when /info is not supported Mar 5, 2017
swift_internal_test.go Automatically set Content-Length in ObjectPutBytes/String Jun 21, 2016
swift_test.go Handle large objects correctly when /info is not supported Mar 5, 2017
timeout_reader.go Fix data race found with go build -race Aug 19, 2013
timeout_reader_test.go Fix Authenticate() race - fixes #26 May 30, 2014
travis_realserver.sh travis: run tests pointing to rackspace and memset swift APIs Mar 5, 2017
watchdog_reader.go fix slicing in watchdog reader Mar 15, 2017
watchdog_reader_test.go add failing testcase for watchdog reader chunked read Mar 15, 2017

README.md

Swift

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

See here for package docs

http://godoc.org/github.com/ncw/swift

Build Status GoDoc

Install

Use go to install the library

go get github.com/ncw/swift

Usage

See here for full package docs

Here is a short example from the docs

import "github.com/ncw/swift"

// 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...

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