@@ -35,8 +35,13 @@ type ObjectStorageBucket struct {
3535// ObjectStorageBucketAccess holds Object Storage access info
3636type ObjectStorageBucketAccess struct {
3737 ACL ObjectStorageACL `json:"acl"`
38- ACLXML string `json:"acl_xml"`
3938 CorsEnabled bool `json:"cors_enabled"`
39+ }
40+
41+ type ObjectStorageBucketAccessV2 struct {
42+ ACL ObjectStorageACL `json:"acl"`
43+ ACLXML string `json:"acl_xml"`
44+ CorsEnabled * bool `json:"cors_enabled"`
4045 CorsXML * string `json:"cors_xml"`
4146}
4247
@@ -121,55 +126,31 @@ const (
121126
122127// ListObjectStorageBuckets lists ObjectStorageBuckets
123128func (c * Client ) ListObjectStorageBuckets (ctx context.Context , opts * ListOptions ) ([]ObjectStorageBucket , error ) {
124- response , err := getPaginatedResults [ObjectStorageBucket ](ctx , c , "object-storage/buckets" , opts )
125- if err != nil {
126- return nil , err
127- }
128-
129- return response , nil
129+ return getPaginatedResults [ObjectStorageBucket ](ctx , c , "object-storage/buckets" , opts )
130130}
131131
132132// ListObjectStorageBucketsInCluster lists all ObjectStorageBuckets of a cluster
133133func (c * Client ) ListObjectStorageBucketsInCluster (ctx context.Context , opts * ListOptions , clusterOrRegionID string ) ([]ObjectStorageBucket , error ) {
134- response , err := getPaginatedResults [ObjectStorageBucket ](ctx , c , formatAPIPath ("object-storage/buckets/%s" , clusterOrRegionID ), opts )
135- if err != nil {
136- return nil , err
137- }
138-
139- return response , nil
134+ return getPaginatedResults [ObjectStorageBucket ](ctx , c , formatAPIPath ("object-storage/buckets/%s" , clusterOrRegionID ), opts )
140135}
141136
142137// GetObjectStorageBucket gets the ObjectStorageBucket with the provided label
143138func (c * Client ) GetObjectStorageBucket (ctx context.Context , clusterOrRegionID , label string ) (* ObjectStorageBucket , error ) {
144139 e := formatAPIPath ("object-storage/buckets/%s/%s" , clusterOrRegionID , label )
145- response , err := doGETRequest [ObjectStorageBucket ](ctx , c , e )
146- if err != nil {
147- return nil , err
148- }
149-
150- return response , nil
140+ return doGETRequest [ObjectStorageBucket ](ctx , c , e )
151141}
152142
153143// CreateObjectStorageBucket creates an ObjectStorageBucket
154144func (c * Client ) CreateObjectStorageBucket (ctx context.Context , opts ObjectStorageBucketCreateOptions ) (* ObjectStorageBucket , error ) {
155145 e := "object-storage/buckets"
156- response , err := doPOSTRequest [ObjectStorageBucket ](ctx , c , e , opts )
157- if err != nil {
158- return nil , err
159- }
160-
161- return response , nil
146+ return doPOSTRequest [ObjectStorageBucket ](ctx , c , e , opts )
162147}
163148
164149// GetObjectStorageBucketAccess gets the current access config for a bucket
150+ // Deprecated: use GetObjectStorageBucketAccessV2 for new implementations
165151func (c * Client ) GetObjectStorageBucketAccess (ctx context.Context , clusterOrRegionID , label string ) (* ObjectStorageBucketAccess , error ) {
166152 e := formatAPIPath ("object-storage/buckets/%s/%s/access" , clusterOrRegionID , label )
167- response , err := doGETRequest [ObjectStorageBucketAccess ](ctx , c , e )
168- if err != nil {
169- return nil , err
170- }
171-
172- return response , nil
153+ return doGETRequest [ObjectStorageBucketAccess ](ctx , c , e )
173154}
174155
175156// UpdateObjectStorageBucketAccess updates the access configuration for an ObjectStorageBucket
@@ -180,11 +161,16 @@ func (c *Client) UpdateObjectStorageBucketAccess(ctx context.Context, clusterOrR
180161 return err
181162}
182163
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+
183170// DeleteObjectStorageBucket deletes the ObjectStorageBucket with the specified label
184171func (c * Client ) DeleteObjectStorageBucket (ctx context.Context , clusterOrRegionID , label string ) error {
185172 e := formatAPIPath ("object-storage/buckets/%s/%s" , clusterOrRegionID , label )
186- err := doDELETERequest (ctx , c , e )
187- return err
173+ return doDELETERequest (ctx , c , e )
188174}
189175
190176// Lists the contents of the specified ObjectStorageBucket
0 commit comments