diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ef50662..7fa05646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] ### Added -- Managed Load Balancer: `MatchingCondition` field to frontend rule for controlling which operator to use when combining matchers +- managed load balancer: `MatchingCondition` field to frontend rule for controlling which operator to use when combining matchers +- managed object storage: support for creating and deleting buckets +- managed object storage: `Deleted` field to `upcloud.ManagedObjectStorageBucketMetrics` ## [8.8.1] diff --git a/upcloud/managed_object_storage.go b/upcloud/managed_object_storage.go index 3844ebf3..0ae0c297 100644 --- a/upcloud/managed_object_storage.go +++ b/upcloud/managed_object_storage.go @@ -133,6 +133,7 @@ type ManagedObjectStorageUserAccessKey struct { // ManagedObjectStorageBucketMetrics represents metrics for a Managed Object Storage service bucket type ManagedObjectStorageBucketMetrics struct { Name string `json:"name"` + Deleted bool `json:"deleted"` TotalObjects int `json:"total_objects"` TotalSizeBytes int `json:"total_size_bytes"` } diff --git a/upcloud/request/managed_object_storage.go b/upcloud/request/managed_object_storage.go index 2a8c6e2c..53d6fa46 100644 --- a/upcloud/request/managed_object_storage.go +++ b/upcloud/request/managed_object_storage.go @@ -134,6 +134,26 @@ func (r *GetManagedObjectStorageBucketMetricsRequest) RequestURL() string { return path } +type CreateManagedObjectStorageBucketRequest struct { + ServiceUUID string `json:"-"` + Name string `json:"name"` +} + +// RequestURL implements the Request interface +func (r *CreateManagedObjectStorageBucketRequest) RequestURL() string { + return fmt.Sprintf("%s/%s/buckets", managedObjectStorageBasePath, r.ServiceUUID) +} + +type DeleteManagedObjectStorageBucketRequest struct { + ServiceUUID string `json:"-"` + Name string `json:"-"` +} + +// RequestURL implements the Request interface +func (r *DeleteManagedObjectStorageBucketRequest) RequestURL() string { + return fmt.Sprintf("%s/%s/buckets/%s", managedObjectStorageBasePath, r.ServiceUUID, r.Name) +} + // CreateManagedObjectStorageNetworkRequest represents a request for creating a network type CreateManagedObjectStorageNetworkRequest struct { Family string `json:"family"` @@ -442,7 +462,7 @@ func (r *WaitForManagedObjectStorageOperationalStateRequest) RequestURL() string // WaitForManagedObjectStorageDeletionRequest represents a request to wait for a Managed Object Storage service // to be deleted type WaitForManagedObjectStorageDeletionRequest struct { - DesiredState upcloud.ManagedObjectStorageOperationalState `json:"-"` + DesiredState upcloud.ManagedObjectStorageOperationalState `json:"-"` // Deprecated: The managed object storage instance has no state after being deleted. UUID string `json:"-"` } @@ -450,3 +470,15 @@ type WaitForManagedObjectStorageDeletionRequest struct { func (r *WaitForManagedObjectStorageDeletionRequest) RequestURL() string { return fmt.Sprintf("%s/%s", managedObjectStorageBasePath, r.UUID) } + +// WaitForManagedObjectStorageDeletionRequest represents a request to wait for a Managed Object Storage service +// to be deleted +type WaitForManagedObjectStorageBucketDeletionRequest struct { + ServiceUUID string `json:"-"` + Name string `json:"-"` +} + +// RequestURL implements the Request interface +func (r *WaitForManagedObjectStorageBucketDeletionRequest) RequestURL() string { + return fmt.Sprintf("%s/%s/buckets", managedObjectStorageBasePath, r.ServiceUUID) +} diff --git a/upcloud/service/fixtures/getmanagedobjectstoragebucketmetrics.yaml b/upcloud/service/fixtures/getmanagedobjectstoragebucketmetrics.yaml deleted file mode 100644 index e9473340..00000000 --- a/upcloud/service/fixtures/getmanagedobjectstoragebucketmetrics.yaml +++ /dev/null @@ -1,129 +0,0 @@ ---- -version: 1 -interactions: -- request: - body: "" - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - upcloud-go-api/7.0.0 - url: https://api.upcloud.com/1.3/object-storage-2/regions - method: GET - response: - body: '[{"name":"europe-1","primary_zone":"fi-hel2","zones":[{"name":"fi-hel2"},{"name":"de-fra1"},{"name":"es-mad1"},{"name":"fi-hel1"},{"name":"nl-ams1"},{"name":"pl-waw1"},{"name":"uk-lon1"},{"name":"se-sto1"}]}]' - headers: - Content-Length: - - "208" - Content-Type: - - application/json - Date: - - Thu, 29 Feb 2024 11:29:13 GMT - Strict-Transport-Security: - - max-age=63072000 - status: 200 OK - code: 200 - duration: "" -- request: - body: '{"configured_status":"started","labels":[{"key":"example-key","value":"example-value"}],"name":"go-sdk-integration-test","networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"region":"europe-1"}' - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - upcloud-go-api/7.0.0 - url: https://api.upcloud.com/1.3/object-storage-2 - method: POST - response: - body: '{"configured_status":"started","created_at":"2024-02-29T11:29:13.986533Z","endpoints":[{"domain_name":"ops4m.upcloudobjects.com","iam_url":"https://ops4m.upcloudobjects.com:4443/iam","sts_url":"https://ops4m.upcloudobjects.com:4443/sts","type":"public"}],"labels":[{"key":"example-key","value":"example-value"}],"name":"go-sdk-integration-test","networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"operational_state":"pending","region":"europe-1","updated_at":"2024-02-29T11:29:13.986533Z","usage":{"total_objects":0,"total_size_bytes":0},"users":[],"uuid":"12c6784b-b0fe-4936-9e19-e394750686b5"}' - headers: - Content-Length: - - "623" - Content-Type: - - application/json - Date: - - Thu, 29 Feb 2024 11:29:14 GMT - Strict-Transport-Security: - - max-age=63072000 - status: 201 Created - code: 201 - duration: "" -- request: - body: "" - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - upcloud-go-api/7.0.0 - url: https://api.upcloud.com/1.3/object-storage-2/12c6784b-b0fe-4936-9e19-e394750686b5/buckets - method: GET - response: - body: '[]' - headers: - Content-Length: - - "2" - Content-Type: - - application/json - Date: - - Thu, 29 Feb 2024 11:29:14 GMT - Strict-Transport-Security: - - max-age=63072000 - status: 200 OK - code: 200 - duration: "" -- request: - body: "" - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - upcloud-go-api/7.0.0 - url: https://api.upcloud.com/1.3/object-storage-2/12c6784b-b0fe-4936-9e19-e394750686b5/users - method: GET - response: - body: '[]' - headers: - Content-Length: - - "2" - Content-Type: - - application/json - Date: - - Thu, 29 Feb 2024 11:29:14 GMT - Strict-Transport-Security: - - max-age=63072000 - status: 200 OK - code: 200 - duration: "" -- request: - body: "" - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - upcloud-go-api/7.0.0 - url: https://api.upcloud.com/1.3/object-storage-2/12c6784b-b0fe-4936-9e19-e394750686b5 - method: DELETE - response: - body: "" - headers: - Date: - - Thu, 29 Feb 2024 11:29:14 GMT - Strict-Transport-Security: - - max-age=63072000 - status: 204 No Content - code: 204 - duration: "" diff --git a/upcloud/service/fixtures/managedobjectstoragebucketoperations.yaml b/upcloud/service/fixtures/managedobjectstoragebucketoperations.yaml new file mode 100644 index 00000000..12fbd78f --- /dev/null +++ b/upcloud/service/fixtures/managedobjectstoragebucketoperations.yaml @@ -0,0 +1,1347 @@ +--- +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/regions + method: GET + response: + body: '[{"name":"apac-1","primary_zone":"sg-sin1","zones":[{"name":"sg-sin1"}]},{"name":"europe-1","primary_zone":"fi-hel2","zones":[{"name":"fi-hel2"},{"name":"de-fra1"},{"name":"es-mad1"},{"name":"fi-hel1"},{"name":"nl-ams1"},{"name":"pl-waw1"},{"name":"uk-lon1"},{"name":"se-sto1"}]},{"name":"europe-2","primary_zone":"de-fra1","zones":[{"name":"de-fra1"},{"name":"fi-hel2"},{"name":"es-mad1"},{"name":"fi-hel1"},{"name":"nl-ams1"},{"name":"pl-waw1"},{"name":"uk-lon1"},{"name":"se-sto1"}]}]' + headers: + Content-Length: + - "487" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:16 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"configured_status":"started","labels":[{"key":"example-key","value":"example-value"}],"name":"go-sdk-integration-test","networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"region":"apac-1"}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2 + method: POST + response: + body: '{"configured_status":"started","created_at":"2024-10-08T07:54:16.556935Z","custom_domains":[],"endpoints":[{"domain_name":"07ftk.upcloudobjects.com","iam_url":"https://07ftk.upcloudobjects.com:4443/iam","sts_url":"https://07ftk.upcloudobjects.com:4443/sts","type":"public"}],"labels":[{"key":"example-key","value":"example-value"}],"name":"go-sdk-integration-test","networks":[{"family":"IPv4","name":"example-public-network","type":"public"}],"operational_state":"pending","region":"apac-1","updated_at":"2024-10-08T07:54:16.556935Z","usage":{"total_objects":0,"total_size_bytes":0},"users":[],"uuid":"1201dfda-697f-4620-9b53-9c75f2afce93"}' + headers: + Content-Length: + - "641" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:18 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[]' + headers: + Content-Length: + - "2" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:18 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"name":"test"}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: POST + response: + body: '{"deleted":false,"name":"test","total_objects":0,"total_size_bytes":0}' + headers: + Content-Length: + - "70" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:19 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":false,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "72" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:19 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets/test + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 08 Oct 2024 07:54:20 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 204 No Content + code: 204 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:20 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:25 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:30 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:35 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:40 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:45 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:50 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:54:56 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:00 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:05 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:10 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:15 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:20 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:25 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:30 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:35 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:40 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:45 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:50 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:55:55 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:00 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:05 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:10 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:15 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:20 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:25 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:30 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:35 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:40 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:45 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:50 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:56:55 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:00 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:05 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:10 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:15 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:20 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:25 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:30 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:35 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:40 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:45 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[{"deleted":true,"name":"test","total_objects":0,"total_size_bytes":0}]' + headers: + Content-Length: + - "71" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:50 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/buckets + method: GET + response: + body: '[]' + headers: + Content-Length: + - "2" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:55 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93/users + method: GET + response: + body: '[]' + headers: + Content-Length: + - "2" + Content-Type: + - application/json + Date: + - Tue, 08 Oct 2024 07:57:56 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - upcloud-go-api/8.8.1 + url: https://api.upcloud.com/1.3/object-storage-2/1201dfda-697f-4620-9b53-9c75f2afce93 + method: DELETE + response: + body: "" + headers: + Date: + - Tue, 08 Oct 2024 07:57:57 GMT + Strict-Transport-Security: + - max-age=63072000 + status: 204 No Content + code: 204 + duration: "" diff --git a/upcloud/service/managed_object_storage.go b/upcloud/service/managed_object_storage.go index d733689c..d3bb5aca 100644 --- a/upcloud/service/managed_object_storage.go +++ b/upcloud/service/managed_object_storage.go @@ -19,6 +19,8 @@ type ManagedObjectStorage interface { ModifyManagedObjectStorage(ctx context.Context, r *request.ModifyManagedObjectStorageRequest) (*upcloud.ManagedObjectStorage, error) DeleteManagedObjectStorage(ctx context.Context, r *request.DeleteManagedObjectStorageRequest) error GetManagedObjectStorageMetrics(ctx context.Context, r *request.GetManagedObjectStorageMetricsRequest) (*upcloud.ManagedObjectStorageMetrics, error) + CreateManagedObjectStorageBucket(ctx context.Context, r *request.CreateManagedObjectStorageBucketRequest) (upcloud.ManagedObjectStorageBucketMetrics, error) + DeleteManagedObjectStorageBucket(ctx context.Context, r *request.DeleteManagedObjectStorageBucketRequest) error GetManagedObjectStorageBucketMetrics(ctx context.Context, r *request.GetManagedObjectStorageBucketMetricsRequest) ([]upcloud.ManagedObjectStorageBucketMetrics, error) CreateManagedObjectStorageNetwork(ctx context.Context, r *request.CreateManagedObjectStorageNetworkRequest) (*upcloud.ManagedObjectStorageNetwork, error) GetManagedObjectStorageNetworks(ctx context.Context, r *request.GetManagedObjectStorageNetworksRequest) ([]upcloud.ManagedObjectStorageNetwork, error) @@ -47,6 +49,7 @@ type ManagedObjectStorage interface { DeleteManagedObjectStorageCustomDomain(ctx context.Context, r *request.DeleteManagedObjectStorageCustomDomainRequest) error WaitForManagedObjectStorageOperationalState(ctx context.Context, r *request.WaitForManagedObjectStorageOperationalStateRequest) (*upcloud.ManagedObjectStorage, error) WaitForManagedObjectStorageDeletion(ctx context.Context, r *request.WaitForManagedObjectStorageDeletionRequest) error + WaitForManagedObjectStorageBucketDeletion(ctx context.Context, r *request.WaitForManagedObjectStorageBucketDeletionRequest) error } func (s *Service) GetManagedObjectStorageRegions(ctx context.Context, r *request.GetManagedObjectStorageRegionsRequest) ([]upcloud.ManagedObjectStorageRegion, error) { @@ -93,6 +96,15 @@ func (s *Service) GetManagedObjectStorageMetrics(ctx context.Context, r *request return &metrics, s.get(ctx, r.RequestURL(), &metrics) } +func (s *Service) CreateManagedObjectStorageBucket(ctx context.Context, r *request.CreateManagedObjectStorageBucketRequest) (upcloud.ManagedObjectStorageBucketMetrics, error) { + var bucketMetrics upcloud.ManagedObjectStorageBucketMetrics + return bucketMetrics, s.create(ctx, r, &bucketMetrics) +} + +func (s *Service) DeleteManagedObjectStorageBucket(ctx context.Context, r *request.DeleteManagedObjectStorageBucketRequest) error { + return s.delete(ctx, r) +} + func (s *Service) GetManagedObjectStorageBucketMetrics(ctx context.Context, r *request.GetManagedObjectStorageBucketMetricsRequest) ([]upcloud.ManagedObjectStorageBucketMetrics, error) { bucketMetrics := make([]upcloud.ManagedObjectStorageBucketMetrics, 0) return bucketMetrics, s.get(ctx, r.RequestURL(), &bucketMetrics) @@ -234,8 +246,7 @@ func (s *Service) WaitForManagedObjectStorageOperationalState(ctx context.Contex }, nil) } -// WaitForManagedObjectStorageDeletion blocks execution until the specified Managed Object Storage service -// has been deleted. The method will give upafter the specified timeout +// WaitForManagedObjectStorageDeletion blocks execution until the specified Managed Object Storage service has been deleted. func (s *Service) WaitForManagedObjectStorageDeletion(ctx context.Context, r *request.WaitForManagedObjectStorageDeletionRequest) error { _, err := retry(ctx, func(_ int, c context.Context) (*upcloud.ManagedObjectStorage, error) { details, err := s.GetManagedObjectStorage(c, &request.GetManagedObjectStorageRequest{ @@ -254,3 +265,28 @@ func (s *Service) WaitForManagedObjectStorageDeletion(ctx context.Context, r *re }, &retryConfig{inverse: true}) return err } + +// WaitForManagedObjectStorageBucketDeletion blocks execution until the specified Managed Object Storage bucket has been deleted. +func (s *Service) WaitForManagedObjectStorageBucketDeletion(ctx context.Context, r *request.WaitForManagedObjectStorageBucketDeletionRequest) error { + _, err := retry(ctx, func(_ int, c context.Context) (*upcloud.ManagedObjectStorageBucketMetrics, error) { + buckets, err := s.GetManagedObjectStorageBucketMetrics(c, &request.GetManagedObjectStorageBucketMetricsRequest{ + ServiceUUID: r.ServiceUUID, + }) + if err != nil { + var ucErr *upcloud.Problem + if errors.As(err, &ucErr) && ucErr.Status == http.StatusNotFound { + return nil, nil + } + + return nil, err + } + + for _, bucket := range buckets { + if bucket.Name == r.Name { + return &bucket, nil + } + } + return nil, err + }, &retryConfig{inverse: true}) + return err +} diff --git a/upcloud/service/managed_object_storage_test.go b/upcloud/service/managed_object_storage_test.go index 6d5acc4a..49518c42 100644 --- a/upcloud/service/managed_object_storage_test.go +++ b/upcloud/service/managed_object_storage_test.go @@ -161,19 +161,40 @@ func TestGetManagedObjectStorageMetrics(t *testing.T) { }) } -func TestGetManagedObjectStorageBucketMetrics(t *testing.T) { - record(t, "getmanagedobjectstoragebucketmetrics", func(ctx context.Context, t *testing.T, rec *recorder.Recorder, svc *Service) { - storage, err := createManagedObjectStorage(ctx, svc) +func TestManagedObjectStorageBucketOperations(t *testing.T) { + record(t, "managedobjectstoragebucketoperations", func(ctx context.Context, t *testing.T, rec *recorder.Recorder, svc *Service) { + objsto, err := createManagedObjectStorage(ctx, svc) require.NoError(t, err) defer func(uuid string) { err = deleteManagedObjectStorageAndUsers(ctx, svc, uuid) require.NoError(t, err) - }(storage.UUID) + }(objsto.UUID) - m, err := svc.GetManagedObjectStorageBucketMetrics(ctx, &request.GetManagedObjectStorageBucketMetricsRequest{ServiceUUID: storage.UUID}) + m, err := svc.GetManagedObjectStorageBucketMetrics(ctx, &request.GetManagedObjectStorageBucketMetricsRequest{ServiceUUID: objsto.UUID}) require.NoError(t, err) assert.Len(t, m, 0) + + _, err = svc.CreateManagedObjectStorageBucket(ctx, &request.CreateManagedObjectStorageBucketRequest{Name: "test", ServiceUUID: objsto.UUID}) + require.NoError(t, err) + + m, err = svc.GetManagedObjectStorageBucketMetrics(ctx, &request.GetManagedObjectStorageBucketMetricsRequest{ServiceUUID: objsto.UUID}) + require.NoError(t, err) + assert.Len(t, m, 1) + assert.Equal(t, "test", m[0].Name) + assert.False(t, m[0].Deleted) + + err = svc.DeleteManagedObjectStorageBucket(ctx, &request.DeleteManagedObjectStorageBucketRequest{Name: "test", ServiceUUID: objsto.UUID}) + require.NoError(t, err) + + m, err = svc.GetManagedObjectStorageBucketMetrics(ctx, &request.GetManagedObjectStorageBucketMetricsRequest{ServiceUUID: objsto.UUID}) + require.NoError(t, err) + assert.Len(t, m, 1) + assert.Equal(t, "test", m[0].Name) + assert.True(t, m[0].Deleted) + + err = svc.WaitForManagedObjectStorageBucketDeletion(ctx, &request.WaitForManagedObjectStorageBucketDeletionRequest{Name: "test", ServiceUUID: objsto.UUID}) + require.NoError(t, err) }) }