PUT on a bucket creates the bucket. http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html
(a *action)
| 492 | // PUT on a bucket creates the bucket. |
| 493 | // http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html |
| 494 | func (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 | |
| 519 | func (bucketResource) post(a *action) interface{} { |
| 520 | fatalError(400, "Method", "bucket POST method not available") |
nothing calls this directly
no test coverage detected