build: modernize with "go fix -newexpr": use go1.26 new(expr)
Also inline and remove the now unneeded pointer helper functions.
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
|
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
|
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
|
||||||
"github.com/apache/arrow-go/v18/arrow"
|
"github.com/apache/arrow-go/v18/arrow"
|
||||||
@@ -54,12 +53,12 @@ func TestPagerArrow(t *testing.T) {
|
|||||||
opts := &ListBlobsHierarchyOptions{
|
opts := &ListBlobsHierarchyOptions{
|
||||||
ListBlobsHierarchyOptions: container.ListBlobsHierarchyOptions{
|
ListBlobsHierarchyOptions: container.ListBlobsHierarchyOptions{
|
||||||
Include: container.ListBlobsInclude{Metadata: true, Tags: true},
|
Include: container.ListBlobsInclude{Metadata: true, Tags: true},
|
||||||
Prefix: to.Ptr("dir/"),
|
Prefix: new("dir/"),
|
||||||
MaxResults: to.Ptr(int32(1000)),
|
MaxResults: new(int32(1000)),
|
||||||
StartFrom: to.Ptr("testcontainer/dir/a"),
|
StartFrom: new("testcontainer/dir/a"),
|
||||||
},
|
},
|
||||||
EndBefore: to.Ptr("testcontainer/dir/n"),
|
EndBefore: new("testcontainer/dir/n"),
|
||||||
UseArrowFormat: to.Ptr(true),
|
UseArrowFormat: new(true),
|
||||||
}
|
}
|
||||||
pager := client.NewListBlobsHierarchyPager("/", opts)
|
pager := client.NewListBlobsHierarchyPager("/", opts)
|
||||||
|
|
||||||
@@ -125,7 +124,7 @@ func TestPagerXMLFallback(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
||||||
UseArrowFormat: to.Ptr(true),
|
UseArrowFormat: new(true),
|
||||||
})
|
})
|
||||||
page, err := pager.NextPage(context.Background())
|
page, err := pager.NextPage(context.Background())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -149,8 +148,8 @@ func TestPagerXMLFallbackWithEndBefore(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
||||||
EndBefore: to.Ptr("testcontainer/n"),
|
EndBefore: new("testcontainer/n"),
|
||||||
UseArrowFormat: to.Ptr(true),
|
UseArrowFormat: new(true),
|
||||||
})
|
})
|
||||||
_, err = pager.NextPage(context.Background())
|
_, err = pager.NextPage(context.Background())
|
||||||
require.ErrorIs(t, err, ErrEndBeforeXMLFallback)
|
require.ErrorIs(t, err, ErrEndBeforeXMLFallback)
|
||||||
@@ -172,7 +171,7 @@ func TestPagerSharedKeyAuth(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
||||||
UseArrowFormat: to.Ptr(true),
|
UseArrowFormat: new(true),
|
||||||
})
|
})
|
||||||
_, err = pager.NextPage(context.Background())
|
_, err = pager.NextPage(context.Background())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -191,7 +190,7 @@ func TestPagerResponseError(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
pager := client.NewListBlobsHierarchyPager("/", &ListBlobsHierarchyOptions{
|
||||||
UseArrowFormat: to.Ptr(true),
|
UseArrowFormat: new(true),
|
||||||
})
|
})
|
||||||
_, err = pager.NextPage(context.Background())
|
_, err = pager.NextPage(context.Background())
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
|
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob"
|
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob"
|
||||||
@@ -905,15 +904,15 @@ func mapMetadataToAzure(meta map[string]string, logf func(string, ...any)) (head
|
|||||||
lowerKey := strings.ToLower(k)
|
lowerKey := strings.ToLower(k)
|
||||||
switch lowerKey {
|
switch lowerKey {
|
||||||
case "cache-control":
|
case "cache-control":
|
||||||
headers.BlobCacheControl = pString(v)
|
headers.BlobCacheControl = new(v)
|
||||||
case "content-disposition":
|
case "content-disposition":
|
||||||
headers.BlobContentDisposition = pString(v)
|
headers.BlobContentDisposition = new(v)
|
||||||
case "content-encoding":
|
case "content-encoding":
|
||||||
headers.BlobContentEncoding = pString(v)
|
headers.BlobContentEncoding = new(v)
|
||||||
case "content-language":
|
case "content-language":
|
||||||
headers.BlobContentLanguage = pString(v)
|
headers.BlobContentLanguage = new(v)
|
||||||
case "content-type":
|
case "content-type":
|
||||||
headers.BlobContentType = pString(v)
|
headers.BlobContentType = new(v)
|
||||||
case "x-ms-tags":
|
case "x-ms-tags":
|
||||||
parsed, perr := parseXMsTags(v)
|
parsed, perr := parseXMsTags(v)
|
||||||
if perr != nil {
|
if perr != nil {
|
||||||
@@ -1207,7 +1206,7 @@ func (f *Fs) list(ctx context.Context, containerName, directory, prefix string,
|
|||||||
// maxResults==1 probe (isEmpty) which doesn't benefit.
|
// maxResults==1 probe (isEmpty) which doesn't benefit.
|
||||||
useArrow := f.opt.UseArrowList && maxResults != 1
|
useArrow := f.opt.UseArrowList && maxResults != 1
|
||||||
if useArrow {
|
if useArrow {
|
||||||
opts.UseArrowFormat = to.Ptr(true)
|
opts.UseArrowFormat = new(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
var foundItems int
|
var foundItems int
|
||||||
@@ -2636,11 +2635,6 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
|
|||||||
return downloadResponse.Body, nil
|
return downloadResponse.Body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts a string into a pointer to a string
|
|
||||||
func pString(s string) *string {
|
|
||||||
return &s
|
|
||||||
}
|
|
||||||
|
|
||||||
// readSeekCloser joins an io.Reader and an io.Seeker and provides a no-op io.Closer
|
// readSeekCloser joins an io.Reader and an io.Seeker and provides a no-op io.Closer
|
||||||
type readSeekCloser struct {
|
type readSeekCloser struct {
|
||||||
io.Reader
|
io.Reader
|
||||||
@@ -3167,7 +3161,7 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [
|
|||||||
|
|
||||||
// Start with default content-type based on source
|
// Start with default content-type based on source
|
||||||
ui.httpHeaders = blob.HTTPHeaders{
|
ui.httpHeaders = blob.HTTPHeaders{
|
||||||
BlobContentType: pString(fs.MimeType(ctx, src)),
|
BlobContentType: new(fs.MimeType(ctx, src)),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply mapped metadata/headers/tags if requested
|
// Apply mapped metadata/headers/tags if requested
|
||||||
@@ -3213,15 +3207,15 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [
|
|||||||
o.tags[parts[0]] = parts[1]
|
o.tags[parts[0]] = parts[1]
|
||||||
}
|
}
|
||||||
case "cache-control":
|
case "cache-control":
|
||||||
ui.httpHeaders.BlobCacheControl = pString(value)
|
ui.httpHeaders.BlobCacheControl = new(value)
|
||||||
case "content-disposition":
|
case "content-disposition":
|
||||||
ui.httpHeaders.BlobContentDisposition = pString(value)
|
ui.httpHeaders.BlobContentDisposition = new(value)
|
||||||
case "content-encoding":
|
case "content-encoding":
|
||||||
ui.httpHeaders.BlobContentEncoding = pString(value)
|
ui.httpHeaders.BlobContentEncoding = new(value)
|
||||||
case "content-language":
|
case "content-language":
|
||||||
ui.httpHeaders.BlobContentLanguage = pString(value)
|
ui.httpHeaders.BlobContentLanguage = new(value)
|
||||||
case "content-type":
|
case "content-type":
|
||||||
ui.httpHeaders.BlobContentType = pString(value)
|
ui.httpHeaders.BlobContentType = new(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -650,11 +650,6 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadClo
|
|||||||
return resp.Body, nil
|
return resp.Body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a pointer to t - useful for returning pointers to constants
|
|
||||||
func ptr[T any](t T) *T {
|
|
||||||
return &t
|
|
||||||
}
|
|
||||||
|
|
||||||
var warnStreamUpload sync.Once
|
var warnStreamUpload sync.Once
|
||||||
|
|
||||||
// Update the object with the contents of the io.Reader, modTime, size and MD5 hash
|
// Update the object with the contents of the io.Reader, modTime, size and MD5 hash
|
||||||
@@ -818,8 +813,8 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
|||||||
return nil, fmt.Errorf("Move: mkParentDir failed: %w", err)
|
return nil, fmt.Errorf("Move: mkParentDir failed: %w", err)
|
||||||
}
|
}
|
||||||
opt := file.RenameOptions{
|
opt := file.RenameOptions{
|
||||||
IgnoreReadOnly: ptr(true),
|
IgnoreReadOnly: new(true),
|
||||||
ReplaceIfExists: ptr(true),
|
ReplaceIfExists: new(true),
|
||||||
}
|
}
|
||||||
dstAbsPath := f.absPath(remote)
|
dstAbsPath := f.absPath(remote)
|
||||||
fc := srcObj.fileClient()
|
fc := srcObj.fileClient()
|
||||||
@@ -864,8 +859,8 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
|
|||||||
}
|
}
|
||||||
|
|
||||||
opt := directory.RenameOptions{
|
opt := directory.RenameOptions{
|
||||||
IgnoreReadOnly: ptr(false),
|
IgnoreReadOnly: new(false),
|
||||||
ReplaceIfExists: ptr(false),
|
ReplaceIfExists: new(false),
|
||||||
}
|
}
|
||||||
dstAbsPath := dstFs.absPath(dstRemote)
|
dstAbsPath := dstFs.absPath(dstRemote)
|
||||||
dirClient := srcFs.dirClient(srcRemote)
|
dirClient := srcFs.dirClient(srcRemote)
|
||||||
@@ -904,8 +899,8 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
|||||||
ChangeTime: file.SourceCopyFileChangeTime{},
|
ChangeTime: file.SourceCopyFileChangeTime{},
|
||||||
CreationTime: file.SourceCopyFileCreationTime{},
|
CreationTime: file.SourceCopyFileCreationTime{},
|
||||||
LastWriteTime: file.SourceCopyFileLastWriteTime{},
|
LastWriteTime: file.SourceCopyFileLastWriteTime{},
|
||||||
PermissionCopyMode: ptr(file.PermissionCopyModeTypeSource),
|
PermissionCopyMode: new(file.PermissionCopyModeTypeSource),
|
||||||
IgnoreReadOnly: ptr(true),
|
IgnoreReadOnly: new(true),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
srcURL := srcObj.fileClient().URL()
|
srcURL := srcObj.fileClient().URL()
|
||||||
|
|||||||
@@ -472,8 +472,8 @@ func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options .
|
|||||||
if updateOptions, ok := option.(*api.UpdateOptions); ok {
|
if updateOptions, ok := option.(*api.UpdateOptions); ok {
|
||||||
if updateOptions.PublicID != "" {
|
if updateOptions.PublicID != "" {
|
||||||
updateObject = true
|
updateObject = true
|
||||||
params.Overwrite = SDKApi.Bool(true)
|
params.Overwrite = new(true)
|
||||||
params.Invalidate = SDKApi.Bool(true)
|
params.Invalidate = new(true)
|
||||||
params.PublicID = updateOptions.PublicID
|
params.PublicID = updateOptions.PublicID
|
||||||
params.ResourceType = updateOptions.ResourceType
|
params.ResourceType = updateOptions.ResourceType
|
||||||
params.Type = SDKApi.DeliveryType(updateOptions.DeliveryType)
|
params.Type = SDKApi.DeliveryType(updateOptions.DeliveryType)
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
|
|||||||
}
|
}
|
||||||
|
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
item := ptr(it.File())
|
item := new(it.File())
|
||||||
remote := f.opt.Enc.ToStandardPath(item.DisplayName)
|
remote := f.opt.Enc.ToStandardPath(item.DisplayName)
|
||||||
remote = path.Join(dir, remote)
|
remote = path.Join(dir, remote)
|
||||||
if remote == dir {
|
if remote == dir {
|
||||||
@@ -416,7 +416,7 @@ func (f *Fs) mkdir(ctx context.Context, path string) error {
|
|||||||
|
|
||||||
params := files_sdk.FolderCreateParams{
|
params := files_sdk.FolderCreateParams{
|
||||||
Path: path,
|
Path: path,
|
||||||
MkdirParents: ptr(true),
|
MkdirParents: new(true),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := f.pacer.Call(func() (bool, error) {
|
err := f.pacer.Call(func() (bool, error) {
|
||||||
@@ -458,7 +458,7 @@ func (f *Fs) purgeCheck(ctx context.Context, dir string, check bool) error {
|
|||||||
|
|
||||||
params := files_sdk.FileDeleteParams{
|
params := files_sdk.FileDeleteParams{
|
||||||
Path: path,
|
Path: path,
|
||||||
Recursive: ptr(!check),
|
Recursive: new(!check),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := f.pacer.Call(func() (bool, error) {
|
err := f.pacer.Call(func() (bool, error) {
|
||||||
@@ -529,7 +529,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (dstObj fs.
|
|||||||
params := files_sdk.FileCopyParams{
|
params := files_sdk.FileCopyParams{
|
||||||
Path: srcPath,
|
Path: srcPath,
|
||||||
Destination: dstPath,
|
Destination: dstPath,
|
||||||
Overwrite: ptr(true),
|
Overwrite: new(true),
|
||||||
}
|
}
|
||||||
|
|
||||||
var action files_sdk.FileAction
|
var action files_sdk.FileAction
|
||||||
@@ -672,7 +672,7 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration,
|
|||||||
Paths: []string{f.absPath(remote)},
|
Paths: []string{f.absPath(remote)},
|
||||||
}
|
}
|
||||||
if expire < fs.DurationOff {
|
if expire < fs.DurationOff {
|
||||||
params.ExpiresAt = ptr(time.Now().Add(time.Duration(expire)))
|
params.ExpiresAt = new(time.Now().Add(time.Duration(expire)))
|
||||||
}
|
}
|
||||||
|
|
||||||
var bundle files_sdk.Bundle
|
var bundle files_sdk.Bundle
|
||||||
@@ -834,11 +834,6 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a pointer to t - useful for returning pointers to constants
|
|
||||||
func ptr[T any](t T) *T {
|
|
||||||
return &t
|
|
||||||
}
|
|
||||||
|
|
||||||
func isFolderNotEmpty(err error) bool {
|
func isFolderNotEmpty(err error) bool {
|
||||||
var re files_sdk.ResponseError
|
var re files_sdk.ResponseError
|
||||||
ok := errors.As(err, &re)
|
ok := errors.As(err, &re)
|
||||||
|
|||||||
@@ -224,11 +224,6 @@ var GlobalDomains = map[string]bool{
|
|||||||
"drive.cloud.hicloud.com": true,
|
"drive.cloud.hicloud.com": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// BoolPtr returns a pointer to a bool value (helper for UpdateFileRequest)
|
|
||||||
func BoolPtr(b bool) *bool {
|
|
||||||
return &b
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartCursor represents response to Changes.getStartCursor endpoint
|
// StartCursor represents response to Changes.getStartCursor endpoint
|
||||||
type StartCursor struct {
|
type StartCursor struct {
|
||||||
Category string `json:"category"` // "drive#startCursor"
|
Category string `json:"category"` // "drive#startCursor"
|
||||||
|
|||||||
@@ -2092,7 +2092,7 @@ func (o *Object) SetMetadata(ctx context.Context, metadata fs.Metadata) error {
|
|||||||
updateReq.Description = value
|
updateReq.Description = value
|
||||||
case "favorite":
|
case "favorite":
|
||||||
if favorite, err := strconv.ParseBool(value); err == nil {
|
if favorite, err := strconv.ParseBool(value); err == nil {
|
||||||
updateReq.Favorite = api.BoolPtr(favorite)
|
updateReq.Favorite = new(favorite)
|
||||||
}
|
}
|
||||||
case "content-type":
|
case "content-type":
|
||||||
// Allow setting/overriding MIME type
|
// Allow setting/overriding MIME type
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ func (s *Session) GetAuthState(ctx context.Context) (*AuthStateResponse, error)
|
|||||||
Path: "",
|
Path: "",
|
||||||
ExtraHeaders: s.GetAuthHeaders(map[string]string{}),
|
ExtraHeaders: s.GetAuthHeaders(map[string]string{}),
|
||||||
RootURL: authEndpoint,
|
RootURL: authEndpoint,
|
||||||
ContentLength: int64Ptr(0),
|
ContentLength: new(int64(0)),
|
||||||
}
|
}
|
||||||
// Use srv.Call directly to capture the raw response body for debugging
|
// Use srv.Call directly to capture the raw response body for debugging
|
||||||
resp, err := s.srv.Call(ctx, &opts)
|
resp, err := s.srv.Call(ctx, &opts)
|
||||||
@@ -828,7 +828,7 @@ func (s *Session) TrustSession(ctx context.Context) error {
|
|||||||
ExtraHeaders: s.GetAuthHeaders(map[string]string{}),
|
ExtraHeaders: s.GetAuthHeaders(map[string]string{}),
|
||||||
RootURL: authEndpoint,
|
RootURL: authEndpoint,
|
||||||
NoResponse: true,
|
NoResponse: true,
|
||||||
ContentLength: int64Ptr(0),
|
ContentLength: new(int64(0)),
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := s.Request(ctx, opts, nil, nil)
|
_, err := s.Request(ctx, opts, nil, nil)
|
||||||
@@ -846,7 +846,7 @@ func (s *Session) ValidateSession(ctx context.Context) error {
|
|||||||
Path: "/validate",
|
Path: "/validate",
|
||||||
ExtraHeaders: s.GetHeaders(map[string]string{}),
|
ExtraHeaders: s.GetHeaders(map[string]string{}),
|
||||||
RootURL: setupEndpoint,
|
RootURL: setupEndpoint,
|
||||||
ContentLength: int64Ptr(0),
|
ContentLength: new(int64(0)),
|
||||||
}
|
}
|
||||||
_, err := s.Request(ctx, opts, nil, &s.AccountInfo)
|
_, err := s.Request(ctx, opts, nil, &s.AccountInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -904,8 +904,6 @@ func GetCommonHeaders(overwrite map[string]string) map[string]string {
|
|||||||
return headers
|
return headers
|
||||||
}
|
}
|
||||||
|
|
||||||
func int64Ptr(v int64) *int64 { return &v }
|
|
||||||
|
|
||||||
// NewSession creates a new Session instance with default values
|
// NewSession creates a new Session instance with default values
|
||||||
func NewSession() *Session {
|
func NewSession() *Session {
|
||||||
session := &Session{
|
session := &Session{
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/oracle/oci-go-sdk/v65/common"
|
|
||||||
"github.com/oracle/oci-go-sdk/v65/objectstorage"
|
"github.com/oracle/oci-go-sdk/v65/objectstorage"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -73,54 +72,54 @@ func populateSSECustomerKeys(opt *Options) error {
|
|||||||
// https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/usingyourencryptionkeys.htm
|
// https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/usingyourencryptionkeys.htm
|
||||||
func useBYOKPutObject(fs *Fs, request *objectstorage.PutObjectRequest) {
|
func useBYOKPutObject(fs *Fs, request *objectstorage.PutObjectRequest) {
|
||||||
if fs.opt.SSEKMSKeyID != "" {
|
if fs.opt.SSEKMSKeyID != "" {
|
||||||
request.OpcSseKmsKeyId = common.String(fs.opt.SSEKMSKeyID)
|
request.OpcSseKmsKeyId = new(fs.opt.SSEKMSKeyID)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerAlgorithm != "" {
|
if fs.opt.SSECustomerAlgorithm != "" {
|
||||||
request.OpcSseCustomerAlgorithm = common.String(fs.opt.SSECustomerAlgorithm)
|
request.OpcSseCustomerAlgorithm = new(fs.opt.SSECustomerAlgorithm)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKey != "" {
|
if fs.opt.SSECustomerKey != "" {
|
||||||
request.OpcSseCustomerKey = common.String(fs.opt.SSECustomerKey)
|
request.OpcSseCustomerKey = new(fs.opt.SSECustomerKey)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKeySha256 != "" {
|
if fs.opt.SSECustomerKeySha256 != "" {
|
||||||
request.OpcSseCustomerKeySha256 = common.String(fs.opt.SSECustomerKeySha256)
|
request.OpcSseCustomerKeySha256 = new(fs.opt.SSECustomerKeySha256)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func useBYOKHeadObject(fs *Fs, request *objectstorage.HeadObjectRequest) {
|
func useBYOKHeadObject(fs *Fs, request *objectstorage.HeadObjectRequest) {
|
||||||
if fs.opt.SSECustomerAlgorithm != "" {
|
if fs.opt.SSECustomerAlgorithm != "" {
|
||||||
request.OpcSseCustomerAlgorithm = common.String(fs.opt.SSECustomerAlgorithm)
|
request.OpcSseCustomerAlgorithm = new(fs.opt.SSECustomerAlgorithm)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKey != "" {
|
if fs.opt.SSECustomerKey != "" {
|
||||||
request.OpcSseCustomerKey = common.String(fs.opt.SSECustomerKey)
|
request.OpcSseCustomerKey = new(fs.opt.SSECustomerKey)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKeySha256 != "" {
|
if fs.opt.SSECustomerKeySha256 != "" {
|
||||||
request.OpcSseCustomerKeySha256 = common.String(fs.opt.SSECustomerKeySha256)
|
request.OpcSseCustomerKeySha256 = new(fs.opt.SSECustomerKeySha256)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func useBYOKGetObject(fs *Fs, request *objectstorage.GetObjectRequest) {
|
func useBYOKGetObject(fs *Fs, request *objectstorage.GetObjectRequest) {
|
||||||
if fs.opt.SSECustomerAlgorithm != "" {
|
if fs.opt.SSECustomerAlgorithm != "" {
|
||||||
request.OpcSseCustomerAlgorithm = common.String(fs.opt.SSECustomerAlgorithm)
|
request.OpcSseCustomerAlgorithm = new(fs.opt.SSECustomerAlgorithm)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKey != "" {
|
if fs.opt.SSECustomerKey != "" {
|
||||||
request.OpcSseCustomerKey = common.String(fs.opt.SSECustomerKey)
|
request.OpcSseCustomerKey = new(fs.opt.SSECustomerKey)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKeySha256 != "" {
|
if fs.opt.SSECustomerKeySha256 != "" {
|
||||||
request.OpcSseCustomerKeySha256 = common.String(fs.opt.SSECustomerKeySha256)
|
request.OpcSseCustomerKeySha256 = new(fs.opt.SSECustomerKeySha256)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func useBYOKCopyObject(fs *Fs, request *objectstorage.CopyObjectRequest) {
|
func useBYOKCopyObject(fs *Fs, request *objectstorage.CopyObjectRequest) {
|
||||||
if fs.opt.SSEKMSKeyID != "" {
|
if fs.opt.SSEKMSKeyID != "" {
|
||||||
request.OpcSseKmsKeyId = common.String(fs.opt.SSEKMSKeyID)
|
request.OpcSseKmsKeyId = new(fs.opt.SSEKMSKeyID)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerAlgorithm != "" {
|
if fs.opt.SSECustomerAlgorithm != "" {
|
||||||
request.OpcSseCustomerAlgorithm = common.String(fs.opt.SSECustomerAlgorithm)
|
request.OpcSseCustomerAlgorithm = new(fs.opt.SSECustomerAlgorithm)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKey != "" {
|
if fs.opt.SSECustomerKey != "" {
|
||||||
request.OpcSseCustomerKey = common.String(fs.opt.SSECustomerKey)
|
request.OpcSseCustomerKey = new(fs.opt.SSECustomerKey)
|
||||||
}
|
}
|
||||||
if fs.opt.SSECustomerKeySha256 != "" {
|
if fs.opt.SSECustomerKeySha256 != "" {
|
||||||
request.OpcSseCustomerKeySha256 = common.String(fs.opt.SSECustomerKeySha256)
|
request.OpcSseCustomerKeySha256 = new(fs.opt.SSECustomerKeySha256)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,12 +198,12 @@ func (f *Fs) rename(ctx context.Context, remote, newName string) (any, error) {
|
|||||||
return nil, fs.ErrorNotAFile
|
return nil, fs.ErrorNotAFile
|
||||||
}
|
}
|
||||||
details := objectstorage.RenameObjectDetails{
|
details := objectstorage.RenameObjectDetails{
|
||||||
SourceName: common.String(objectPath),
|
SourceName: new(objectPath),
|
||||||
NewName: common.String(newName),
|
NewName: new(newName),
|
||||||
}
|
}
|
||||||
request := objectstorage.RenameObjectRequest{
|
request := objectstorage.RenameObjectRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
RenameObjectDetails: details,
|
RenameObjectDetails: details,
|
||||||
OpcClientRequestId: nil,
|
OpcClientRequestId: nil,
|
||||||
RequestMetadata: common.RequestMetadata{},
|
RequestMetadata: common.RequestMetadata{},
|
||||||
@@ -284,8 +284,8 @@ func (f *Fs) listMultipartUploadsObject(ctx context.Context, bucketName, directo
|
|||||||
|
|
||||||
uploads = []*objectstorage.MultipartUpload{}
|
uploads = []*objectstorage.MultipartUpload{}
|
||||||
req := objectstorage.ListMultipartUploadsRequest{
|
req := objectstorage.ListMultipartUploadsRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
}
|
}
|
||||||
|
|
||||||
var response objectstorage.ListMultipartUploadsResponse
|
var response objectstorage.ListMultipartUploadsResponse
|
||||||
@@ -322,11 +322,11 @@ func (f *Fs) listMultipartUploadParts(ctx context.Context, bucketName, bucketPat
|
|||||||
uploadedParts map[int]objectstorage.MultipartUploadPartSummary, err error) {
|
uploadedParts map[int]objectstorage.MultipartUploadPartSummary, err error) {
|
||||||
uploadedParts = make(map[int]objectstorage.MultipartUploadPartSummary)
|
uploadedParts = make(map[int]objectstorage.MultipartUploadPartSummary)
|
||||||
req := objectstorage.ListMultipartUploadPartsRequest{
|
req := objectstorage.ListMultipartUploadPartsRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
ObjectName: common.String(bucketPath),
|
ObjectName: new(bucketPath),
|
||||||
UploadId: common.String(uploadID),
|
UploadId: new(uploadID),
|
||||||
Limit: common.Int(1000),
|
Limit: new(1000),
|
||||||
}
|
}
|
||||||
|
|
||||||
var response objectstorage.ListMultipartUploadPartsResponse
|
var response objectstorage.ListMultipartUploadPartsResponse
|
||||||
@@ -351,7 +351,7 @@ func (f *Fs) listMultipartUploadParts(ctx context.Context, bucketName, bucketPat
|
|||||||
|
|
||||||
func (f *Fs) restore(ctx context.Context, opt map[string]string) (any, error) {
|
func (f *Fs) restore(ctx context.Context, opt map[string]string) (any, error) {
|
||||||
req := objectstorage.RestoreObjectsRequest{
|
req := objectstorage.RestoreObjectsRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
RestoreObjectsDetails: objectstorage.RestoreObjectsDetails{},
|
RestoreObjectsDetails: objectstorage.RestoreObjectsDetails{},
|
||||||
}
|
}
|
||||||
if hours := opt["hours"]; hours != "" {
|
if hours := opt["hours"]; hours != "" {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/oracle/oci-go-sdk/v65/common"
|
|
||||||
"github.com/oracle/oci-go-sdk/v65/objectstorage"
|
"github.com/oracle/oci-go-sdk/v65/objectstorage"
|
||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
)
|
)
|
||||||
@@ -61,16 +60,16 @@ func (f *Fs) copy(ctx context.Context, dstObj *Object, srcObj *Object) (err erro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
copyObjectDetails := objectstorage.CopyObjectDetails{
|
copyObjectDetails := objectstorage.CopyObjectDetails{
|
||||||
SourceObjectName: common.String(srcPath),
|
SourceObjectName: new(srcPath),
|
||||||
DestinationRegion: common.String(dstObj.fs.opt.Region),
|
DestinationRegion: new(dstObj.fs.opt.Region),
|
||||||
DestinationNamespace: common.String(dstObj.fs.opt.Namespace),
|
DestinationNamespace: new(dstObj.fs.opt.Namespace),
|
||||||
DestinationBucket: common.String(dstBucket),
|
DestinationBucket: new(dstBucket),
|
||||||
DestinationObjectName: common.String(dstPath),
|
DestinationObjectName: new(dstPath),
|
||||||
DestinationObjectMetadata: metadataWithOpcPrefix(srcObj.meta),
|
DestinationObjectMetadata: metadataWithOpcPrefix(srcObj.meta),
|
||||||
}
|
}
|
||||||
req := objectstorage.CopyObjectRequest{
|
req := objectstorage.CopyObjectRequest{
|
||||||
NamespaceName: common.String(srcObj.fs.opt.Namespace),
|
NamespaceName: new(srcObj.fs.opt.Namespace),
|
||||||
BucketName: common.String(srcBucket),
|
BucketName: new(srcBucket),
|
||||||
CopyObjectDetails: copyObjectDetails,
|
CopyObjectDetails: copyObjectDetails,
|
||||||
}
|
}
|
||||||
useBYOKCopyObject(f, &req)
|
useBYOKCopyObject(f, &req)
|
||||||
|
|||||||
@@ -161,13 +161,13 @@ func (w *objectChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, rea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
req := objectstorage.UploadPartRequest{
|
req := objectstorage.UploadPartRequest{
|
||||||
NamespaceName: common.String(w.f.opt.Namespace),
|
NamespaceName: new(w.f.opt.Namespace),
|
||||||
BucketName: w.bucket,
|
BucketName: w.bucket,
|
||||||
ObjectName: w.key,
|
ObjectName: w.key,
|
||||||
UploadId: w.uploadID,
|
UploadId: w.uploadID,
|
||||||
UploadPartNum: common.Int(ossPartNumber),
|
UploadPartNum: new(ossPartNumber),
|
||||||
ContentLength: common.Int64(currentChunkSize),
|
ContentLength: new(currentChunkSize),
|
||||||
ContentMD5: common.String(md5sum),
|
ContentMD5: new(md5sum),
|
||||||
}
|
}
|
||||||
w.o.applyPartUploadOptions(w.ui.req, &req)
|
w.o.applyPartUploadOptions(w.ui.req, &req)
|
||||||
var resp objectstorage.UploadPartResponse
|
var resp objectstorage.UploadPartResponse
|
||||||
@@ -213,7 +213,7 @@ func (w *objectChunkWriter) addCompletedPart(partNum *int, eTag *string) {
|
|||||||
|
|
||||||
func (w *objectChunkWriter) Close(ctx context.Context) (err error) {
|
func (w *objectChunkWriter) Close(ctx context.Context) (err error) {
|
||||||
req := objectstorage.CommitMultipartUploadRequest{
|
req := objectstorage.CommitMultipartUploadRequest{
|
||||||
NamespaceName: common.String(w.f.opt.Namespace),
|
NamespaceName: new(w.f.opt.Namespace),
|
||||||
BucketName: w.bucket,
|
BucketName: w.bucket,
|
||||||
ObjectName: w.key,
|
ObjectName: w.key,
|
||||||
UploadId: w.uploadID,
|
UploadId: w.uploadID,
|
||||||
@@ -290,9 +290,9 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [
|
|||||||
bucket, bucketPath := o.split()
|
bucket, bucketPath := o.split()
|
||||||
|
|
||||||
ui.req = &objectstorage.PutObjectRequest{
|
ui.req = &objectstorage.PutObjectRequest{
|
||||||
NamespaceName: common.String(o.fs.opt.Namespace),
|
NamespaceName: new(o.fs.opt.Namespace),
|
||||||
BucketName: common.String(bucket),
|
BucketName: new(bucket),
|
||||||
ObjectName: common.String(bucketPath),
|
ObjectName: new(bucketPath),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the mtime in the metadata
|
// Set the mtime in the metadata
|
||||||
@@ -305,7 +305,7 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [
|
|||||||
ui.req.OpcMeta = make(map[string]string, len(meta)+2)
|
ui.req.OpcMeta = make(map[string]string, len(meta)+2)
|
||||||
// merge metadata into request and user metadata
|
// merge metadata into request and user metadata
|
||||||
for k, v := range meta {
|
for k, v := range meta {
|
||||||
pv := common.String(v)
|
pv := new(v)
|
||||||
k = strings.ToLower(k)
|
k = strings.ToLower(k)
|
||||||
switch k {
|
switch k {
|
||||||
case "cache-control":
|
case "cache-control":
|
||||||
@@ -366,10 +366,10 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [
|
|||||||
}
|
}
|
||||||
// Set the content type if it isn't set already
|
// Set the content type if it isn't set already
|
||||||
if ui.req.ContentType == nil {
|
if ui.req.ContentType == nil {
|
||||||
ui.req.ContentType = common.String(fs.MimeType(ctx, src))
|
ui.req.ContentType = new(fs.MimeType(ctx, src))
|
||||||
}
|
}
|
||||||
if size >= 0 {
|
if size >= 0 {
|
||||||
ui.req.ContentLength = common.Int64(size)
|
ui.req.ContentLength = new(size)
|
||||||
}
|
}
|
||||||
if md5sumBase64 != "" {
|
if md5sumBase64 != "" {
|
||||||
ui.req.ContentMD5 = &md5sumBase64
|
ui.req.ContentMD5 = &md5sumBase64
|
||||||
@@ -420,10 +420,10 @@ func (o *Object) createMultipartUpload(ctx context.Context, putReq *objectstorag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
req := objectstorage.CreateMultipartUploadRequest{
|
req := objectstorage.CreateMultipartUploadRequest{
|
||||||
NamespaceName: common.String(o.fs.opt.Namespace),
|
NamespaceName: new(o.fs.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
}
|
}
|
||||||
req.Object = common.String(bucketPath)
|
req.Object = new(bucketPath)
|
||||||
if o.fs.opt.StorageTier != "" {
|
if o.fs.opt.StorageTier != "" {
|
||||||
storageTier, ok := objectstorage.GetMappingStorageTierEnum(o.fs.opt.StorageTier)
|
storageTier, ok := objectstorage.GetMappingStorageTierEnum(o.fs.opt.StorageTier)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
|
|||||||
func (o *Object) headObject(ctx context.Context) (info *objectstorage.HeadObjectResponse, err error) {
|
func (o *Object) headObject(ctx context.Context) (info *objectstorage.HeadObjectResponse, err error) {
|
||||||
bucketName, objectPath := o.split()
|
bucketName, objectPath := o.split()
|
||||||
req := objectstorage.HeadObjectRequest{
|
req := objectstorage.HeadObjectRequest{
|
||||||
NamespaceName: common.String(o.fs.opt.Namespace),
|
NamespaceName: new(o.fs.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
ObjectName: common.String(objectPath),
|
ObjectName: new(objectPath),
|
||||||
}
|
}
|
||||||
useBYOKHeadObject(o.fs, &req)
|
useBYOKHeadObject(o.fs, &req)
|
||||||
var response objectstorage.HeadObjectResponse
|
var response objectstorage.HeadObjectResponse
|
||||||
@@ -235,10 +235,10 @@ func (o *Object) SetTier(tier string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
req := objectstorage.UpdateObjectStorageTierRequest{
|
req := objectstorage.UpdateObjectStorageTierRequest{
|
||||||
NamespaceName: common.String(o.fs.opt.Namespace),
|
NamespaceName: new(o.fs.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
UpdateObjectStorageTierDetails: objectstorage.UpdateObjectStorageTierDetails{
|
UpdateObjectStorageTierDetails: objectstorage.UpdateObjectStorageTierDetails{
|
||||||
ObjectName: common.String(bucketPath),
|
ObjectName: new(bucketPath),
|
||||||
StorageTier: tierEnum,
|
StorageTier: tierEnum,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -321,9 +321,9 @@ func (o *Object) Storable() bool {
|
|||||||
func (o *Object) Remove(ctx context.Context) error {
|
func (o *Object) Remove(ctx context.Context) error {
|
||||||
bucketName, bucketPath := o.split()
|
bucketName, bucketPath := o.split()
|
||||||
req := objectstorage.DeleteObjectRequest{
|
req := objectstorage.DeleteObjectRequest{
|
||||||
NamespaceName: common.String(o.fs.opt.Namespace),
|
NamespaceName: new(o.fs.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
ObjectName: common.String(bucketPath),
|
ObjectName: new(bucketPath),
|
||||||
}
|
}
|
||||||
err := o.fs.pacer.Call(func() (bool, error) {
|
err := o.fs.pacer.Call(func() (bool, error) {
|
||||||
resp, err := o.fs.srv.DeleteObject(ctx, req)
|
resp, err := o.fs.srv.DeleteObject(ctx, req)
|
||||||
@@ -336,9 +336,9 @@ func (o *Object) Remove(ctx context.Context) error {
|
|||||||
func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error) {
|
func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error) {
|
||||||
bucketName, bucketPath := o.split()
|
bucketName, bucketPath := o.split()
|
||||||
req := objectstorage.GetObjectRequest{
|
req := objectstorage.GetObjectRequest{
|
||||||
NamespaceName: common.String(o.fs.opt.Namespace),
|
NamespaceName: new(o.fs.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
ObjectName: common.String(bucketPath),
|
ObjectName: new(bucketPath),
|
||||||
}
|
}
|
||||||
o.applyGetObjectOptions(&req, options...)
|
o.applyGetObjectOptions(&req, options...)
|
||||||
useBYOKGetObject(o.fs, &req)
|
useBYOKGetObject(o.fs, &req)
|
||||||
@@ -456,15 +456,15 @@ func (o *Object) applyPutOptions(req *objectstorage.PutObjectRequest, options ..
|
|||||||
case "":
|
case "":
|
||||||
// ignore
|
// ignore
|
||||||
case "cache-control":
|
case "cache-control":
|
||||||
req.CacheControl = common.String(value)
|
req.CacheControl = new(value)
|
||||||
case "content-disposition":
|
case "content-disposition":
|
||||||
req.ContentDisposition = common.String(value)
|
req.ContentDisposition = new(value)
|
||||||
case "content-encoding":
|
case "content-encoding":
|
||||||
req.ContentEncoding = common.String(value)
|
req.ContentEncoding = new(value)
|
||||||
case "content-language":
|
case "content-language":
|
||||||
req.ContentLanguage = common.String(value)
|
req.ContentLanguage = new(value)
|
||||||
case "content-type":
|
case "content-type":
|
||||||
req.ContentType = common.String(value)
|
req.ContentType = new(value)
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(lowerKey, ociMetaPrefix) {
|
if strings.HasPrefix(lowerKey, ociMetaPrefix) {
|
||||||
req.OpcMeta[lowerKey] = value
|
req.OpcMeta[lowerKey] = value
|
||||||
@@ -496,15 +496,15 @@ func (o *Object) applyGetObjectOptions(req *objectstorage.GetObjectRequest, opti
|
|||||||
case "":
|
case "":
|
||||||
// ignore
|
// ignore
|
||||||
case "cache-control":
|
case "cache-control":
|
||||||
req.HttpResponseCacheControl = common.String(value)
|
req.HttpResponseCacheControl = new(value)
|
||||||
case "content-disposition":
|
case "content-disposition":
|
||||||
req.HttpResponseContentDisposition = common.String(value)
|
req.HttpResponseContentDisposition = new(value)
|
||||||
case "content-encoding":
|
case "content-encoding":
|
||||||
req.HttpResponseContentEncoding = common.String(value)
|
req.HttpResponseContentEncoding = new(value)
|
||||||
case "content-language":
|
case "content-language":
|
||||||
req.HttpResponseContentLanguage = common.String(value)
|
req.HttpResponseContentLanguage = new(value)
|
||||||
case "content-type":
|
case "content-type":
|
||||||
req.HttpResponseContentType = common.String(value)
|
req.HttpResponseContentType = new(value)
|
||||||
case "range":
|
case "range":
|
||||||
// do nothing
|
// do nothing
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -329,14 +329,14 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuck
|
|||||||
chunkSize = limit
|
chunkSize = limit
|
||||||
}
|
}
|
||||||
var request = objectstorage.ListObjectsRequest{
|
var request = objectstorage.ListObjectsRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
BucketName: common.String(bucket),
|
BucketName: new(bucket),
|
||||||
Prefix: common.String(directory),
|
Prefix: new(directory),
|
||||||
Limit: common.Int(chunkSize),
|
Limit: new(chunkSize),
|
||||||
Fields: common.String("name,size,etag,timeCreated,md5,timeModified,storageTier,archivalState"),
|
Fields: new("name,size,etag,timeCreated,md5,timeModified,storageTier,archivalState"),
|
||||||
}
|
}
|
||||||
if delimiter != "" {
|
if delimiter != "" {
|
||||||
request.Delimiter = common.String(delimiter)
|
request.Delimiter = new(delimiter)
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@@ -471,8 +471,8 @@ func (f *Fs) listBuckets(ctx context.Context) (entries fs.DirEntries, err error)
|
|||||||
return nil, fmt.Errorf("can't list buckets with %v provider, use a valid auth provider in config file", noAuth)
|
return nil, fmt.Errorf("can't list buckets with %v provider, use a valid auth provider in config file", noAuth)
|
||||||
}
|
}
|
||||||
var request = objectstorage.ListBucketsRequest{
|
var request = objectstorage.ListBucketsRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
CompartmentId: common.String(f.opt.Compartment),
|
CompartmentId: new(f.opt.Compartment),
|
||||||
}
|
}
|
||||||
var resp objectstorage.ListBucketsResponse
|
var resp objectstorage.ListBucketsResponse
|
||||||
for {
|
for {
|
||||||
@@ -569,12 +569,12 @@ func (f *Fs) makeBucket(ctx context.Context, bucketName string) error {
|
|||||||
}
|
}
|
||||||
return f.cache.Create(bucketName, func() error {
|
return f.cache.Create(bucketName, func() error {
|
||||||
details := objectstorage.CreateBucketDetails{
|
details := objectstorage.CreateBucketDetails{
|
||||||
Name: common.String(bucketName),
|
Name: new(bucketName),
|
||||||
CompartmentId: common.String(f.opt.Compartment),
|
CompartmentId: new(f.opt.Compartment),
|
||||||
PublicAccessType: objectstorage.CreateBucketDetailsPublicAccessTypeNopublicaccess,
|
PublicAccessType: objectstorage.CreateBucketDetailsPublicAccessTypeNopublicaccess,
|
||||||
}
|
}
|
||||||
req := objectstorage.CreateBucketRequest{
|
req := objectstorage.CreateBucketRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
CreateBucketDetails: details,
|
CreateBucketDetails: details,
|
||||||
}
|
}
|
||||||
err := f.pacer.Call(func() (bool, error) {
|
err := f.pacer.Call(func() (bool, error) {
|
||||||
@@ -601,8 +601,8 @@ func (f *Fs) makeBucket(ctx context.Context, bucketName string) error {
|
|||||||
// NB this can return incorrect results if called immediately after bucket deletion
|
// NB this can return incorrect results if called immediately after bucket deletion
|
||||||
func (f *Fs) bucketExists(ctx context.Context, bucketName string) (bool, error) {
|
func (f *Fs) bucketExists(ctx context.Context, bucketName string) (bool, error) {
|
||||||
req := objectstorage.HeadBucketRequest{
|
req := objectstorage.HeadBucketRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
}
|
}
|
||||||
err := f.pacer.Call(func() (bool, error) {
|
err := f.pacer.Call(func() (bool, error) {
|
||||||
resp, err := f.srv.HeadBucket(ctx, req)
|
resp, err := f.srv.HeadBucket(ctx, req)
|
||||||
@@ -627,8 +627,8 @@ func (f *Fs) Rmdir(ctx context.Context, dir string) error {
|
|||||||
}
|
}
|
||||||
return f.cache.Remove(bucketName, func() error {
|
return f.cache.Remove(bucketName, func() error {
|
||||||
req := objectstorage.DeleteBucketRequest{
|
req := objectstorage.DeleteBucketRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
BucketName: common.String(bucketName),
|
BucketName: new(bucketName),
|
||||||
}
|
}
|
||||||
err := f.pacer.Call(func() (bool, error) {
|
err := f.pacer.Call(func() (bool, error) {
|
||||||
resp, err := f.srv.DeleteBucket(ctx, req)
|
resp, err := f.srv.DeleteBucket(ctx, req)
|
||||||
@@ -646,7 +646,7 @@ func (f *Fs) abortMultiPartUpload(ctx context.Context, bucketName, bucketPath, u
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
request := objectstorage.AbortMultipartUploadRequest{
|
request := objectstorage.AbortMultipartUploadRequest{
|
||||||
NamespaceName: common.String(f.opt.Namespace),
|
NamespaceName: new(f.opt.Namespace),
|
||||||
BucketName: bucketName,
|
BucketName: bucketName,
|
||||||
ObjectName: bucketPath,
|
ObjectName: bucketPath,
|
||||||
UploadId: uploadID,
|
UploadId: uploadID,
|
||||||
|
|||||||
Reference in New Issue
Block a user