object_storage_object.go raw
1 package linodego
2
3 import (
4 "context"
5 )
6
7 type ObjectStorageObjectURLCreateOptions struct {
8 Name string `json:"name"`
9 Method string `json:"method"`
10 ContentType string `json:"content_type,omitempty"`
11 ContentDisposition string `json:"content_disposition,omitempty"`
12 ExpiresIn *int `json:"expires_in,omitempty"`
13 }
14
15 type ObjectStorageObjectURL struct {
16 URL string `json:"url"`
17 Exists bool `json:"exists"`
18 }
19
20 // Deprecated: Please use ObjectStorageObjectACLConfigV2 for all new implementations.
21 type ObjectStorageObjectACLConfig struct {
22 ACL string `json:"acl"`
23 ACLXML string `json:"acl_xml"`
24 }
25
26 type ObjectStorageObjectACLConfigV2 struct {
27 ACL *string `json:"acl"`
28 ACLXML *string `json:"acl_xml"`
29 }
30
31 type ObjectStorageObjectACLConfigUpdateOptions struct {
32 Name string `json:"name"`
33 ACL string `json:"acl"`
34 }
35
36 func (c *Client) CreateObjectStorageObjectURL(
37 ctx context.Context,
38 objectID, label string,
39 opts ObjectStorageObjectURLCreateOptions,
40 ) (*ObjectStorageObjectURL, error) {
41 e := formatAPIPath("object-storage/buckets/%s/%s/object-url", objectID, label)
42 return doPOSTRequest[ObjectStorageObjectURL](ctx, c, e, opts)
43 }
44
45 // Deprecated: use GetObjectStorageObjectACLConfigV2 for new implementations
46 func (c *Client) GetObjectStorageObjectACLConfig(ctx context.Context, objectID, label, object string) (*ObjectStorageObjectACLConfig, error) {
47 e := formatAPIPath("object-storage/buckets/%s/%s/object-acl?name=%s", objectID, label, object)
48 return doGETRequest[ObjectStorageObjectACLConfig](ctx, c, e)
49 }
50
51 // Deprecated: use UpdateObjectStorageObjectACLConfigV2 for new implementations
52 func (c *Client) UpdateObjectStorageObjectACLConfig(
53 ctx context.Context,
54 objectID, label string,
55 opts ObjectStorageObjectACLConfigUpdateOptions,
56 ) (*ObjectStorageObjectACLConfig, error) {
57 e := formatAPIPath("object-storage/buckets/%s/%s/object-acl", objectID, label)
58 return doPUTRequest[ObjectStorageObjectACLConfig](ctx, c, e, opts)
59 }
60
61 func (c *Client) GetObjectStorageObjectACLConfigV2(ctx context.Context, objectID, label, object string) (*ObjectStorageObjectACLConfigV2, error) {
62 e := formatAPIPath("object-storage/buckets/%s/%s/object-acl?name=%s", objectID, label, object)
63 return doGETRequest[ObjectStorageObjectACLConfigV2](ctx, c, e)
64 }
65
66 func (c *Client) UpdateObjectStorageObjectACLConfigV2(
67 ctx context.Context,
68 objectID, label string,
69 opts ObjectStorageObjectACLConfigUpdateOptions,
70 ) (*ObjectStorageObjectACLConfigV2, error) {
71 e := formatAPIPath("object-storage/buckets/%s/%s/object-acl", objectID, label)
72 return doPUTRequest[ObjectStorageObjectACLConfigV2](ctx, c, e, opts)
73 }
74