update github.com/ncw/swift package in vendor to v1.0.40
Signed-off-by: Corey Quon <corey.quon@gmail.com>
This commit is contained in:
parent
5a74b806f0
commit
fd32d5f962
4 changed files with 46 additions and 28 deletions
|
@ -23,11 +23,11 @@ github.com/satori/go.uuid f58768cc1a7a7e77a3bd49e98cdd21419399b6a3
|
|||
github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c
|
||||
github.com/miekg/dns 271c58e0c14f552178ea321a545ff9af38930f39
|
||||
github.com/mitchellh/mapstructure 482a9fd5fa83e8c4e7817413b80f3eb8feec03ef
|
||||
github.com/ncw/swift a0320860b16212c2b59b4912bb6508cda1d7cee6
|
||||
github.com/prometheus/client_golang c332b6f63c0658a65eca15c0e5247ded801cf564
|
||||
github.com/prometheus/client_model 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c
|
||||
github.com/prometheus/common 89604d197083d4781071d3c65855d24ecfb0a563
|
||||
github.com/prometheus/procfs cb4147076ac75738c9a7d279075a253c0cc5acbd
|
||||
github.com/ncw/swift c95c6e5c2d1a3d37fc44c8c6dc9e231c7500667d
|
||||
github.com/spf13/cobra 312092086bed4968099259622145a0c9ae280064
|
||||
github.com/spf13/pflag 5644820622454e71517561946e3d94b9f9db6842
|
||||
github.com/stevvooe/resumable 2aaf90b2ceea5072cb503ef2a620b08ff3119870
|
||||
|
|
39
vendor/github.com/ncw/swift/README.md
generated
vendored
39
vendor/github.com/ncw/swift/README.md
generated
vendored
|
@ -26,26 +26,27 @@ See here for full package docs
|
|||
- http://godoc.org/github.com/ncw/swift
|
||||
|
||||
Here is a short example from the docs
|
||||
```go
|
||||
import "github.com/ncw/swift"
|
||||
|
||||
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...
|
||||
// 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
|
||||
---------
|
||||
|
|
11
vendor/github.com/ncw/swift/slo.go
generated
vendored
11
vendor/github.com/ncw/swift/slo.go
generated
vendored
|
@ -88,7 +88,10 @@ func (c *Connection) StaticLargeObjectMove(srcContainer string, srcObjectName st
|
|||
return err
|
||||
}
|
||||
|
||||
if err := c.createSLOManifest(dstContainer, dstObjectName, info.ContentType, container, segments); err != nil {
|
||||
//copy only metadata during move (other headers might not be safe for copying)
|
||||
headers = headers.ObjectMetadata().ObjectHeaders()
|
||||
|
||||
if err := c.createSLOManifest(dstContainer, dstObjectName, info.ContentType, container, segments, headers); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -100,7 +103,7 @@ func (c *Connection) StaticLargeObjectMove(srcContainer string, srcObjectName st
|
|||
}
|
||||
|
||||
// createSLOManifest creates a static large object manifest
|
||||
func (c *Connection) createSLOManifest(container string, path string, contentType string, segmentContainer string, segments []Object) error {
|
||||
func (c *Connection) createSLOManifest(container string, path string, contentType string, segmentContainer string, segments []Object, h Headers) error {
|
||||
sloSegments := make([]swiftSegment, len(segments))
|
||||
for i, segment := range segments {
|
||||
sloSegments[i].Path = fmt.Sprintf("%s/%s", segmentContainer, segment.Name)
|
||||
|
@ -115,7 +118,7 @@ func (c *Connection) createSLOManifest(container string, path string, contentTyp
|
|||
|
||||
values := url.Values{}
|
||||
values.Set("multipart-manifest", "put")
|
||||
if _, err := c.objectPut(container, path, bytes.NewBuffer(content), false, "", contentType, nil, values); err != nil {
|
||||
if _, err := c.objectPut(container, path, bytes.NewBuffer(content), false, "", contentType, h, values); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -127,7 +130,7 @@ func (file *StaticLargeObjectCreateFile) Close() error {
|
|||
}
|
||||
|
||||
func (file *StaticLargeObjectCreateFile) Flush() error {
|
||||
if err := file.conn.createSLOManifest(file.container, file.objectName, file.contentType, file.segmentContainer, file.segments); err != nil {
|
||||
if err := file.conn.createSLOManifest(file.container, file.objectName, file.contentType, file.segmentContainer, file.segments, file.headers); err != nil {
|
||||
return err
|
||||
}
|
||||
return file.conn.waitForSegmentsToShowUp(file.container, file.objectName, file.Size())
|
||||
|
|
22
vendor/github.com/ncw/swift/swift.go
generated
vendored
22
vendor/github.com/ncw/swift/swift.go
generated
vendored
|
@ -297,6 +297,7 @@ var (
|
|||
TimeoutError = newError(408, "Timeout when reading or writing data")
|
||||
Forbidden = newError(403, "Operation forbidden")
|
||||
TooLargeObject = newError(413, "Too Large Object")
|
||||
RateLimit = newError(498, "Rate Limit")
|
||||
|
||||
// Mappings for authentication errors
|
||||
authErrorMap = errorMap{
|
||||
|
@ -311,6 +312,7 @@ var (
|
|||
403: Forbidden,
|
||||
404: ContainerNotFound,
|
||||
409: ContainerNotEmpty,
|
||||
498: RateLimit,
|
||||
}
|
||||
|
||||
// Mappings for object errors
|
||||
|
@ -321,6 +323,7 @@ var (
|
|||
404: ObjectNotFound,
|
||||
413: TooLargeObject,
|
||||
422: ObjectCorrupted,
|
||||
498: RateLimit,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -1840,14 +1843,16 @@ type BulkDeleteResult struct {
|
|||
func (c *Connection) doBulkDelete(objects []string) (result BulkDeleteResult, err error) {
|
||||
var buffer bytes.Buffer
|
||||
for _, s := range objects {
|
||||
buffer.WriteString(url.QueryEscape(s) + "\n")
|
||||
u := url.URL{Path: s}
|
||||
buffer.WriteString(u.String() + "\n")
|
||||
}
|
||||
resp, headers, err := c.storage(RequestOpts{
|
||||
Operation: "DELETE",
|
||||
Parameters: url.Values{"bulk-delete": []string{"1"}},
|
||||
Headers: Headers{
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "text/plain",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "text/plain",
|
||||
"Content-Length": strconv.Itoa(buffer.Len()),
|
||||
},
|
||||
ErrorMap: ContainerErrorMap,
|
||||
Body: &buffer,
|
||||
|
@ -2074,6 +2079,15 @@ func (c *Connection) ObjectUpdate(container string, objectName string, h Headers
|
|||
return err
|
||||
}
|
||||
|
||||
// urlPathEscape escapes URL path the in string using URL escaping rules
|
||||
//
|
||||
// This mimics url.PathEscape which only available from go 1.8
|
||||
func urlPathEscape(in string) string {
|
||||
var u url.URL
|
||||
u.Path = in
|
||||
return u.String()
|
||||
}
|
||||
|
||||
// ObjectCopy does a server side copy of an object to a new position
|
||||
//
|
||||
// All metadata is preserved. If metadata is set in the headers then
|
||||
|
@ -2086,7 +2100,7 @@ func (c *Connection) ObjectUpdate(container string, objectName string, h Headers
|
|||
func (c *Connection) ObjectCopy(srcContainer string, srcObjectName string, dstContainer string, dstObjectName string, h Headers) (headers Headers, err error) {
|
||||
// Meta stuff
|
||||
extraHeaders := map[string]string{
|
||||
"Destination": dstContainer + "/" + dstObjectName,
|
||||
"Destination": urlPathEscape(dstContainer + "/" + dstObjectName),
|
||||
}
|
||||
for key, value := range h {
|
||||
extraHeaders[key] = value
|
||||
|
|
Loading…
Reference in a new issue