From fa3ab6094d698798d4d76fff05fceb5785d9d2ea Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 4 Sep 2023 18:40:22 +0300 Subject: [PATCH] [#675] client: Refactor PrmObjectDelete usage Signed-off-by: Airat Arifullin --- cmd/frostfs-cli/internal/client/client.go | 19 ++++++++----------- go.mod | 2 +- go.sum | Bin 100798 -> 100798 bytes 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/cmd/frostfs-cli/internal/client/client.go b/cmd/frostfs-cli/internal/client/client.go index 22ca0aa7d..7fbfd5105 100644 --- a/cmd/frostfs-cli/internal/client/client.go +++ b/cmd/frostfs-cli/internal/client/client.go @@ -507,20 +507,17 @@ func (x DeleteObjectRes) Tombstone() oid.ID { // // Returns any error which prevented the operation from completing correctly in error return. func DeleteObject(ctx context.Context, prm DeleteObjectPrm) (*DeleteObjectRes, error) { - var delPrm client.PrmObjectDelete - delPrm.FromContainer(prm.objAddr.Container()) - delPrm.ByID(prm.objAddr.Object()) + cnr := prm.objAddr.Container() + obj := prm.objAddr.Object() - if prm.sessionToken != nil { - delPrm.WithinSession(*prm.sessionToken) + delPrm := client.PrmObjectDelete{ + XHeaders: prm.xHeaders, + ContainerID: &cnr, + ObjectID: &obj, + Session: prm.sessionToken, + BearerToken: prm.bearerToken, } - if prm.bearerToken != nil { - delPrm.WithBearerToken(*prm.bearerToken) - } - - delPrm.WithXHeaders(prm.xHeaders...) - cliRes, err := prm.cli.ObjectDelete(ctx, delPrm) if err != nil { return nil, fmt.Errorf("remove object via client: %w", err) diff --git a/go.mod b/go.mod index 114c95adb..6d5382b75 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 - git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230828082657-84e7e69f98ac + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230904141422-5a471e5002a7 git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 github.com/cheggaaa/pb v1.0.29 diff --git a/go.sum b/go.sum index 4b5e401741cdf144b5a43a8cd3329e25cf000a2c..6c8b417041d823f7cea6b64f8438d0af5b54c7b9 100644 GIT binary patch delta 119 zcmdltnQh->whiWju9gNShCpa!q-&aJVs4mfYG7cLXs(c9Xq8s(>Qbg}=;@b~ALX8u z7U)uuQ=F0%whiWjt`