MCPcopy
hub / github.com/rclone/rclone / makeBucket

Method makeBucket

backend/oracleobjectstorage/oracleobjectstorage.go:560–591  ·  view source on GitHub ↗

makeBucket creates the bucket if it doesn't exist

(ctx context.Context, bucketName string)

Source from the content-addressed store, hash-verified

558
559// makeBucket creates the bucket if it doesn't exist
560func (f *Fs) makeBucket(ctx context.Context, bucketName string) error {
561 if f.opt.NoCheckBucket {
562 return nil
563 }
564 return f.cache.Create(bucketName, func() error {
565 details := objectstorage.CreateBucketDetails{
566 Name: common.String(bucketName),
567 CompartmentId: common.String(f.opt.Compartment),
568 PublicAccessType: objectstorage.CreateBucketDetailsPublicAccessTypeNopublicaccess,
569 }
570 req := objectstorage.CreateBucketRequest{
571 NamespaceName: common.String(f.opt.Namespace),
572 CreateBucketDetails: details,
573 }
574 err := f.pacer.Call(func() (bool, error) {
575 resp, err := f.srv.CreateBucket(ctx, req)
576 return shouldRetry(ctx, resp.HTTPResponse(), err)
577 })
578 if err == nil {
579 fs.Infof(f, "Bucket %q created with accessType %q", bucketName,
580 objectstorage.CreateBucketDetailsPublicAccessTypeNopublicaccess)
581 }
582 if svcErr, ok := err.(common.ServiceError); ok {
583 if code := svcErr.GetCode(); code == "BucketAlreadyOwnedByYou" || code == "BucketAlreadyExists" {
584 err = nil
585 }
586 }
587 return err
588 }, func() (bool, error) {
589 return f.bucketExists(ctx, bucketName)
590 })
591}
592
593// Check if the bucket exists
594//

Callers 4

copyMethod · 0.95
MkdirMethod · 0.95
createMultipartUploadMethod · 0.45
UpdateMethod · 0.45

Calls 8

bucketExistsMethod · 0.95
InfofFunction · 0.92
CreateBucketMethod · 0.80
shouldRetryFunction · 0.70
CreateMethod · 0.65
StringMethod · 0.65
GetCodeMethod · 0.65
CallMethod · 0.45

Tested by

no test coverage detected