-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathedge_share.go
48 lines (42 loc) · 1.33 KB
/
edge_share.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
41
42
43
44
45
46
47
48
// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package main
// #include "uplink_definitions.h"
import "C"
import "storj.io/uplink/edge"
// edge_join_share_url concats a linkshare URL
// Example result: https://link.us1.storjshare.io/s/l5pucy3dmvzxgs3fpfewix27l5pq/mybucket/myprefix/myobject
// The existence or accessibility of the object is not checked,
// the object might not exist or be inaccessible.
//
// baseURL: linkshare service, e.g. https://link.us1.storjshare.io
// accessKeyId: as returned from RegisterAccess. Must be associated with public visibility.
// bucket: optional bucket, if empty shares the entire project.
// key: optional object key or prefix, if empty shares the entire bucket. A prefix must end with "/".
//
//export edge_join_share_url
func edge_join_share_url(
baseURL *C.uplink_const_char,
accessKeyID *C.uplink_const_char,
bucket *C.uplink_const_char,
key *C.uplink_const_char,
options *C.EdgeShareURLOptions,
) C.UplinkStringResult {
var goOptions *edge.ShareURLOptions
if options != nil {
goOptions = &edge.ShareURLOptions{
Raw: bool(options.raw),
}
}
url, err := edge.JoinShareURL(
C.GoString(baseURL),
C.GoString(accessKeyID),
C.GoString(bucket),
C.GoString(key),
goOptions,
)
return C.UplinkStringResult{
error: mallocError(err),
string: C.CString(url),
}
}