frostfs-node/pkg/services/object/delete/v2/service.go
Airat Arifullin 9b13a18aac [#1479] go.mod: Bump frostfs-sdk-go version
* Update version within go.mod;
* Fix deprecated frostfs-api-go/v2 package and use frostfs-sdk-go/api
  instead.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-11-08 10:43:19 +03:00

40 lines
860 B
Go

package deletesvc
import (
"context"
deletesvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/delete"
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
)
// Service implements Delete operation of Object service v2.
type Service struct {
svc *deletesvc.Service
}
// NewService constructs Service instance from provided options.
func NewService(svc *deletesvc.Service) *Service {
return &Service{
svc: svc,
}
}
// Delete calls internal service.
func (s *Service) Delete(ctx context.Context, req *objectV2.DeleteRequest) (*objectV2.DeleteResponse, error) {
resp := new(objectV2.DeleteResponse)
body := new(objectV2.DeleteResponseBody)
resp.SetBody(body)
p, err := s.toPrm(req, body)
if err != nil {
return nil, err
}
err = s.svc.Delete(ctx, *p)
if err != nil {
return nil, err
}
return resp, nil
}