From 84ea07558767bfddf9edf1f3aa36baf224545a54 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 18 Aug 2023 17:44:17 +0300 Subject: [PATCH] [#625] cli: Fix SDK EACLPrm usage for PrmContainerEACL Signed-off-by: Airat Arifullin --- cmd/frostfs-cli/internal/client/client.go | 6 +++--- cmd/frostfs-cli/modules/container/get_eacl.go | 10 +++++++--- cmd/frostfs-cli/modules/container/set_eacl.go | 10 +++++++--- go.mod | 2 +- go.sum | Bin 100798 -> 100798 bytes 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cmd/frostfs-cli/internal/client/client.go b/cmd/frostfs-cli/internal/client/client.go index f09468973..ae76780bd 100644 --- a/cmd/frostfs-cli/internal/client/client.go +++ b/cmd/frostfs-cli/internal/client/client.go @@ -176,8 +176,8 @@ func DeleteContainer(ctx context.Context, prm DeleteContainerPrm) (res DeleteCon // EACLPrm groups parameters of EACL operation. type EACLPrm struct { - commonPrm - client.PrmContainerEACL + Client *client.Client + ClientParams client.PrmContainerEACL } // EACLRes groups the resulting values of EACL operation. @@ -194,7 +194,7 @@ func (x EACLRes) EACL() eacl.Table { // // Returns any error which prevented the operation from completing correctly in error return. func EACL(ctx context.Context, prm EACLPrm) (res EACLRes, err error) { - res.cliRes, err = prm.cli.ContainerEACL(ctx, prm.PrmContainerEACL) + res.cliRes, err = prm.Client.ContainerEACL(ctx, prm.ClientParams) return } diff --git a/cmd/frostfs-cli/modules/container/get_eacl.go b/cmd/frostfs-cli/modules/container/get_eacl.go index 21ea5b5bc..6746132eb 100644 --- a/cmd/frostfs-cli/modules/container/get_eacl.go +++ b/cmd/frostfs-cli/modules/container/get_eacl.go @@ -8,6 +8,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "github.com/spf13/cobra" ) @@ -20,9 +21,12 @@ var getExtendedACLCmd = &cobra.Command{ pk := key.GetOrGenerate(cmd) cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC) - var eaclPrm internalclient.EACLPrm - eaclPrm.SetClient(cli) - eaclPrm.SetContainer(id) + eaclPrm := internalclient.EACLPrm{ + Client: cli, + ClientParams: client.PrmContainerEACL{ + ContainerID: &id, + }, + } res, err := internalclient.EACL(cmd.Context(), eaclPrm) commonCmd.ExitOnErr(cmd, "rpc error: %w", err) diff --git a/cmd/frostfs-cli/modules/container/set_eacl.go b/cmd/frostfs-cli/modules/container/set_eacl.go index c88d5767b..51805d69d 100644 --- a/cmd/frostfs-cli/modules/container/set_eacl.go +++ b/cmd/frostfs-cli/modules/container/set_eacl.go @@ -10,6 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "github.com/spf13/cobra" ) @@ -65,9 +66,12 @@ Container ID in EACL table will be substituted with ID from the CLI.`, cmd.Println("awaiting...") - var getEACLPrm internalclient.EACLPrm - getEACLPrm.SetClient(cli) - getEACLPrm.SetContainer(id) + getEACLPrm := internalclient.EACLPrm{ + Client: cli, + ClientParams: client.PrmContainerEACL{ + ContainerID: &id, + }, + } for i := 0; i < awaitTimeout; i++ { time.Sleep(1 * time.Second) diff --git a/go.mod b/go.mod index 4173ad0df..a1d99fcc6 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-20230809065235-d48788c7a946 + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230816095347-6fdbe755179e 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 7dda288281f69be3c0ebd9e2f52fad8e932d55e0..fd7be9463bc70207a5388f6821be3d81aa74b8b0 100644 GIT binary patch delta 117 zcmdltnQh->whb17E{0|XmZrug=DKESDM_j3rlyAGmZ=IEhF03<7R6C1A#SPOMkU%t zgwhb17&IXnSW~N5Qrn)I67UmWf$>xccCT0p5hF1FFVd)uB`ca97sgC8Y zLC!uVUg_bczJ6s%spct0E}<5M8E#QdZs~sRlk0gkC#wjGh+;LX`K;jfvx1Bt%K^hk BB7Fb=