We are migrating to the AWS Golang SDK v2 and could easily migrate everything except the (s3) Storage usage endpoint which basically, was retrieving the total amount of storage across buckets used by the account. This was in v1 possible to be done using a custom request created by the client client.NewRequest()
where in the request.Operation struct you would specify the x-ntap-sg-usage
query parameter as documented here.
Unfortunately, in the v2 client there is no option to create a 'custom request' and it is only possible to call the predefined operation functions (ex. PutObject, DeleteObject etc.). I couldn't find any function that would offer the similar option.
The only option of retrieving the total storage usage I could find, was iterating over all bucket objects retrieved with the ListObjectsV2 function and summing up their sizes, but I assume this is not very scalable for very large buckets and IMO there should be a simpler way of achieving this.
Thank you very much in advance.