@@ -24,10 +24,12 @@ type ObjectStorageBucket struct {
2424 Cluster string `json:"cluster"`
2525 Region string `json:"region"`
2626
27- Created * time.Time `json:"-"`
28- Hostname string `json:"hostname"`
29- Objects int `json:"objects"`
30- Size int `json:"size"`
27+ S3Endpoint string `json:"s3_endpoint"`
28+ EndpointType ObjectStorageEndpointType `json:"endpoint_type"`
29+ Created * time.Time `json:"-"`
30+ Hostname string `json:"hostname"`
31+ Objects int `json:"objects"`
32+ Size int `json:"size"`
3133}
3234
3335// ObjectStorageBucketAccess holds Object Storage access info
@@ -36,6 +38,13 @@ type ObjectStorageBucketAccess struct {
3638 CorsEnabled bool `json:"cors_enabled"`
3739}
3840
41+ type ObjectStorageBucketAccessV2 struct {
42+ ACL ObjectStorageACL `json:"acl"`
43+ ACLXML string `json:"acl_xml"`
44+ CorsEnabled * bool `json:"cors_enabled"`
45+ CorsXML * string `json:"cors_xml"`
46+ }
47+
3948// ObjectStorageBucketContent holds the content of an ObjectStorageBucket
4049type ObjectStorageBucketContent struct {
4150 Data []ObjectStorageBucketContentData `json:"data"`
@@ -82,7 +91,9 @@ type ObjectStorageBucketCreateOptions struct {
8291 Cluster string `json:"cluster,omitempty"`
8392 Region string `json:"region,omitempty"`
8493
85- Label string `json:"label"`
94+ Label string `json:"label"`
95+ S3Endpoint string `json:"s3_endpoint,omitempty"`
96+ EndpointType ObjectStorageEndpointType `json:"endpoint_type,omitempty"`
8697
8798 ACL ObjectStorageACL `json:"acl,omitempty"`
8899 CorsEnabled * bool `json:"cors_enabled,omitempty"`
@@ -115,55 +126,31 @@ const (
115126
116127// ListObjectStorageBuckets lists ObjectStorageBuckets
117128func (c * Client ) ListObjectStorageBuckets (ctx context.Context , opts * ListOptions ) ([]ObjectStorageBucket , error ) {
118- response , err := getPaginatedResults [ObjectStorageBucket ](ctx , c , "object-storage/buckets" , opts )
119- if err != nil {
120- return nil , err
121- }
122-
123- return response , nil
129+ return getPaginatedResults [ObjectStorageBucket ](ctx , c , "object-storage/buckets" , opts )
124130}
125131
126132// ListObjectStorageBucketsInCluster lists all ObjectStorageBuckets of a cluster
127133func (c * Client ) ListObjectStorageBucketsInCluster (ctx context.Context , opts * ListOptions , clusterOrRegionID string ) ([]ObjectStorageBucket , error ) {
128- response , err := getPaginatedResults [ObjectStorageBucket ](ctx , c , formatAPIPath ("object-storage/buckets/%s" , clusterOrRegionID ), opts )
129- if err != nil {
130- return nil , err
131- }
132-
133- return response , nil
134+ return getPaginatedResults [ObjectStorageBucket ](ctx , c , formatAPIPath ("object-storage/buckets/%s" , clusterOrRegionID ), opts )
134135}
135136
136137// GetObjectStorageBucket gets the ObjectStorageBucket with the provided label
137138func (c * Client ) GetObjectStorageBucket (ctx context.Context , clusterOrRegionID , label string ) (* ObjectStorageBucket , error ) {
138139 e := formatAPIPath ("object-storage/buckets/%s/%s" , clusterOrRegionID , label )
139- response , err := doGETRequest [ObjectStorageBucket ](ctx , c , e )
140- if err != nil {
141- return nil , err
142- }
143-
144- return response , nil
140+ return doGETRequest [ObjectStorageBucket ](ctx , c , e )
145141}
146142
147143// CreateObjectStorageBucket creates an ObjectStorageBucket
148144func (c * Client ) CreateObjectStorageBucket (ctx context.Context , opts ObjectStorageBucketCreateOptions ) (* ObjectStorageBucket , error ) {
149145 e := "object-storage/buckets"
150- response , err := doPOSTRequest [ObjectStorageBucket ](ctx , c , e , opts )
151- if err != nil {
152- return nil , err
153- }
154-
155- return response , nil
146+ return doPOSTRequest [ObjectStorageBucket ](ctx , c , e , opts )
156147}
157148
158149// GetObjectStorageBucketAccess gets the current access config for a bucket
150+ // Deprecated: use GetObjectStorageBucketAccessV2 for new implementations
159151func (c * Client ) GetObjectStorageBucketAccess (ctx context.Context , clusterOrRegionID , label string ) (* ObjectStorageBucketAccess , error ) {
160152 e := formatAPIPath ("object-storage/buckets/%s/%s/access" , clusterOrRegionID , label )
161- response , err := doGETRequest [ObjectStorageBucketAccess ](ctx , c , e )
162- if err != nil {
163- return nil , err
164- }
165-
166- return response , nil
153+ return doGETRequest [ObjectStorageBucketAccess ](ctx , c , e )
167154}
168155
169156// UpdateObjectStorageBucketAccess updates the access configuration for an ObjectStorageBucket
@@ -174,11 +161,16 @@ func (c *Client) UpdateObjectStorageBucketAccess(ctx context.Context, clusterOrR
174161 return err
175162}
176163
164+ // GetObjectStorageBucketAccess gets the current access config for a bucket
165+ func (c * Client ) GetObjectStorageBucketAccessV2 (ctx context.Context , clusterOrRegionID , label string ) (* ObjectStorageBucketAccessV2 , error ) {
166+ e := formatAPIPath ("object-storage/buckets/%s/%s/access" , clusterOrRegionID , label )
167+ return doGETRequest [ObjectStorageBucketAccessV2 ](ctx , c , e )
168+ }
169+
177170// DeleteObjectStorageBucket deletes the ObjectStorageBucket with the specified label
178171func (c * Client ) DeleteObjectStorageBucket (ctx context.Context , clusterOrRegionID , label string ) error {
179172 e := formatAPIPath ("object-storage/buckets/%s/%s" , clusterOrRegionID , label )
180- err := doDELETERequest (ctx , c , e )
181- return err
173+ return doDELETERequest (ctx , c , e )
182174}
183175
184176// Lists the contents of the specified ObjectStorageBucket
0 commit comments