MCPcopy Create free account
hub / github.com/aptly-dev/aptly / put

Method put

s3/server_test.go:494–517  ·  view source on GitHub ↗

PUT on a bucket creates the bucket. http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html

(a *action)

Source from the content-addressed store, hash-verified

492// PUT on a bucket creates the bucket.
493// http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html
494func (r bucketResource) put(a *action) interface{} {
495 var created bool
496 if r.bucket == nil {
497 if !validBucketName(r.name) {
498 fatalError(400, "InvalidBucketName", "The specified bucket is not valid")
499 }
500 if loc := locationConstraint(a); loc == "" {
501 fatalError(400, "InvalidRequets", "The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.")
502 }
503 // TODO validate acl
504 r.bucket = &bucket{
505 name: r.name,
506 // TODO default acl
507 objects: make(map[string]*object),
508 }
509 a.srv.buckets[r.name] = r.bucket
510 created = true
511 }
512 if !created && a.srv.config.send409Conflict() {
513 fatalError(409, "BucketAlreadyOwnedByYou", "Your previous request to create the named bucket succeeded and you already own it.")
514 }
515 r.bucket.acl = a.req.Header.Get("x-amz-acl")
516 return nil
517}
518
519func (bucketResource) post(a *action) interface{} {
520 fatalError(400, "Method", "bucket POST method not available")

Callers

nothing calls this directly

Calls 5

validBucketNameFunction · 0.85
fatalErrorFunction · 0.85
locationConstraintFunction · 0.85
send409ConflictMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected