"git.arvados.org/arvados.git/sdk/go/arvados"
"git.arvados.org/arvados.git/sdk/go/ctxlog"
- "github.com/AdRoll/goamz/s3"
)
const (
}
type listV1Resp struct {
- XMLName string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult"`
- s3.ListResp
- // s3.ListResp marshals an empty tag when
- // CommonPrefixes is nil, which confuses some clients.
- // Fix by using this nested struct instead.
+ XMLName string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult"`
+ Name string
+ Prefix string
+ Delimiter string
+ Marker string
+ MaxKeys int
+ IsTruncated bool
+ Contents []s3Key
+ // If we use a []string here, xml marshals an empty tag when
+ // CommonPrefixes is nil, which confuses some clients. Fix by
+ // using this nested struct instead.
CommonPrefixes []commonPrefix
// Similarly, we need omitempty here, because an empty
// tag confuses some clients (e.g.,
type listV2Resp struct {
XMLName string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult"`
IsTruncated bool
- Contents []s3.Key
+ Contents []s3Key
Name string
Prefix string
Delimiter string
StartAfter string `xml:",omitempty"`
}
+type s3Key struct {
+ Key string
+ LastModified string
+ Size int64
+ // The following fields are not populated, but are here in
+ // case clients rely on the keys being present in xml
+ // responses.
+ ETag string
+ StorageClass string
+ Owner struct {
+ ID string
+ DisplayName string
+ }
+}
+
func hmacstring(msg string, key []byte) []byte {
h := hmac.New(sha256.New, key)
io.WriteString(h, msg)
return filepath.SkipDir
}
}
- resp.Contents = append(resp.Contents, s3.Key{
+ resp.Contents = append(resp.Contents, s3Key{
Key: path,
LastModified: fi.ModTime().UTC().Format("2006-01-02T15:04:05.999") + "Z",
Size: filesize,
CommonPrefixes: resp.CommonPrefixes,
NextMarker: nextMarker,
KeyCount: resp.KeyCount,
- ListResp: s3.ListResp{
- IsTruncated: resp.IsTruncated,
- Name: bucket,
- Prefix: params.prefix,
- Delimiter: params.delimiter,
- Marker: params.marker,
- MaxKeys: params.maxKeys,
- Contents: resp.Contents,
- },
+ IsTruncated: resp.IsTruncated,
+ Name: bucket,
+ Prefix: params.prefix,
+ Delimiter: params.delimiter,
+ Marker: params.marker,
+ MaxKeys: params.maxKeys,
+ Contents: resp.Contents,
}
}