-
Notifications
You must be signed in to change notification settings - Fork 8
/
move.go
40 lines (35 loc) · 1.14 KB
/
move.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package main
// #include "uplink_definitions.h"
import "C"
// uplink_move_object moves object to a different bucket or/and key.
//
//export uplink_move_object
func uplink_move_object(project *C.UplinkProject, old_bucket_name, old_object_key, new_bucket_name, new_object_key *C.uplink_const_char,
options *C.UplinkMoveObjectOptions) *C.UplinkError { //nolint:golint
if project == nil {
return mallocError(ErrNull.New("project"))
}
if old_bucket_name == nil {
return mallocError(ErrNull.New("old_bucket_name"))
}
if old_object_key == nil {
return mallocError(ErrNull.New("old_object_key"))
}
if new_bucket_name == nil {
return mallocError(ErrNull.New("new_bucket_name"))
}
if new_object_key == nil {
return mallocError(ErrNull.New("new_object_key"))
}
proj, ok := universe.Get(project._handle).(*Project)
if !ok {
return mallocError(ErrInvalidHandle.New("project"))
}
err := proj.MoveObject(proj.scope.ctx,
C.GoString(old_bucket_name), C.GoString(old_object_key),
C.GoString(new_bucket_name), C.GoString(new_object_key),
nil)
return mallocError(err)
}