From 140befc1de86104688525c8471888101f3a0f53a Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 29 Jan 2024 11:23:56 +0300 Subject: [PATCH 1/5] [#922] go.mod: Update APE Signed-off-by: Anton Nikiforov --- go.mod | 4 +- go.sum | Bin 39484 -> 39828 bytes pkg/ape/chainbase/boltdb.go | 49 ++++++++++++++++++- pkg/services/control/server/policy_engine.go | 2 +- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index a5cffc28c..07097c547 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20231101111734-b3ad3335ff65 git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240126141009-65b4525b3bf0 git.frostfs.info/TrueCloudLab/hrw v1.2.1 - git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240122104724-06cbfe8691ad + git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240129064140-8d21ab2d99d9 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 github.com/cheggaaa/pb v1.0.29 github.com/chzyer/readline v1.5.1 @@ -76,8 +76,10 @@ require ( github.com/holiman/uint256 v1.2.4 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect diff --git a/go.sum b/go.sum index 4462c3575136bfba18ab55cc88457e01e25afd30..5243ac4350b2d7d5edf3cc8fa3ebd24be41d10ff 100644 GIT binary patch delta 502 zcmZ|Jy>8k-003YGDH%GYLo>A!89F(&?}80>r4A7A53z8;!PIR2_Zgcb=RbT)9)dhb zBr0|3kf+Jgu`kfDB~tnVpT6HeTlc?O53Q3c33PeLgD;|g2_5&+mn2_m$M9>s8fsCu zq89YvrYVFnkw$2MR_g7wM?*Z>e2?oz^~0Hj;_m%Xd-rtwQG3hcBFtvkKajSi_Zr!` z0n>@O=>y8l)Y8{0qSrS}n#;D*3{1;|WnSz~kIwghPCk6TOK=`L1UYLCt&4!H+ZAL1 z3l3bBnmiSFZ2CzC+$fo$NMjVJZe*s=7>SGoU8hDQs+s-mU4)9bbXgB)+<(XyQDKM! z%K~{fIUhTodo@B`nAX0MaE_IdX+>38_C>XhIL_YxWzLT8P)bTJaPlU}@$(U|J+^l^ z&K0{~U2lUW}&490p;4Jrp`qb z0ouhyiB%;TB~gwU27!i_P919@xo@7etN!MZa&z^f?~6L zZ-0Z_io^h~DsSV&l-v*} Date: Mon, 29 Jan 2024 11:16:59 +0300 Subject: [PATCH 2/5] [#922] Update files generated by protoc Signed-off-by: Anton Nikiforov --- pkg/services/control/ir/service.pb.go | Bin 46268 -> 46268 bytes pkg/services/control/ir/service_grpc.pb.go | Bin 8779 -> 9163 bytes pkg/services/control/ir/types.pb.go | Bin 7799 -> 7799 bytes pkg/services/control/service.pb.go | Bin 209554 -> 209554 bytes pkg/services/control/types.pb.go | Bin 33771 -> 33771 bytes pkg/services/tree/service.pb.go | Bin 124265 -> 124265 bytes pkg/services/tree/service_grpc.pb.go | Bin 18231 -> 19139 bytes pkg/services/tree/types.pb.go | Bin 9911 -> 9911 bytes 8 files changed, 0 insertions(+), 0 deletions(-) diff --git a/pkg/services/control/ir/service.pb.go b/pkg/services/control/ir/service.pb.go index a9be56cd9be97d73d9ca7e673e8baffbfe30b286..7dc8f3affab0c9d2347feabd2de3196e964db10a 100644 GIT binary patch delta 14 Wcmdn?Y delta 14 Wcmdn`#3ojLh8NA6@JjwK-1@u3>K`8S6sBgjo?;y^9M zlUH(W1GxlK%5U=x?piM59k97ZER6|^?UQT7$~V_ZzQgJQkQ}GXe@1Lh0Lo2XEi1Zt Izg!P90DW$so&W#< delta 143 zcmX@@e%fV19HY_3__K_g=P(zsPTt2PJ-LC2XL3GQ?&Kw$OMraU&G}rSj9>`^W^SNF z@nm_PZBRbjKN04~-rO8@`> diff --git a/pkg/services/control/ir/types.pb.go b/pkg/services/control/ir/types.pb.go index cc39ad572cad58a879fea8549bfb1411bed98984..819cedf6a53954a26865651e1ceea1a56e6b1a50 100644 GIT binary patch delta 12 Tcmexv^WA1b2&2))P$fA4CFcah delta 12 Tcmexv^WA1b2&3V~P$fA4CE^6b diff --git a/pkg/services/control/service.pb.go b/pkg/services/control/service.pb.go index 9fb6f865e50e227eb653dcab8623c007293768da..f6b9ef60874664cafa1b5ffc729cb3e7babbaf89 100644 GIT binary patch delta 23 ecmbRAlxNaYo(Un0MvbAZp^UAeOj|>lZH)kMZ3rg- delta 23 ecmbRAlxNaYo(Un0hK-@Ep^UAeOj|>lZH)kMUkD}u diff --git a/pkg/services/control/types.pb.go b/pkg/services/control/types.pb.go index 8f083d69546141facdf8a0778650c9fe9b0d1b7f..4556e8a5555a809469adb55b7360873e2c064343 100644 GIT binary patch delta 14 VcmaFe&h)ySX+j92(ZXcp1|I+b delta 14 VcmaFe&h)ySX+j92;l|Ku%>Xck1|9$a diff --git a/pkg/services/tree/service.pb.go b/pkg/services/tree/service.pb.go index 5346613895989cf6ba53fcaee985b5308a50177c..441ae79272c68b9526dab231d53bf4604d9e544c 100644 GIT binary patch delta 17 ZcmaEPiv8s&_6ZG)MvaYI8yR0b0RT^d2)zIR delta 17 ZcmaEPiv8s&_6ZG)hK-F|8yR0b0RT^V2)qCQ diff --git a/pkg/services/tree/service_grpc.pb.go b/pkg/services/tree/service_grpc.pb.go index 66850c90e1f1989c4ad65f3746613b10a1b2b1c3..63f96e11a561bc8a96b26272e90478e59539536b 100644 GIT binary patch delta 1153 zcmdnq$9Q-uqmI757MH%hLU3wPS!QyoLRx;2LV12sc4l6>LV0FMhJtgDONc^AQEI9l z7uSS1M&pg~M;MKh^Ye;J6g0RvLx2)ct?`a2De-QlIXS+mB^miCeu=rM3J733xj{sP z4X8wki*xb^XE6~hD#2=afNGp70}@LzKq?dUg~hR`1eyz0Jo$qGyAG-=eDljvaXJI6 zi5;W_WcULYDFHOY!3qT2Q%n5vQ&JJm*k~>$g2hmX8+--1(cAzE6`#!F5-eIE4wpsK z;8;+QQ;AhI+^6eA+0ZlrUFl!olb?=NAH->I#5kFN9-V71A%x~pSODrv@i1{|ZdPQn z=aj=AnUgQ@Wles_y#y3{e5j^@rFeK}fT9bVlm_1fd1S+}#L?ypd~%GS7{Sz^JGn++ z-{d4!F@7|kPHx~f+T11hok_o8HIJrwu zWb#@G?#*uE*O)*-i|Jy&&7D%sf`r2JylKhg-P)X+7wBAI#1^O^c}YF~%>w#o8L@>d zP=0f^;RQxQK|2|w@VN1FY{9$vylEv1QNaf?+m2rC?<3yb}Mx%}0M;JF7vf6S^7GxG?aZE{3n*2~8Yw|a~B_M&xx0txVd<}sa zK)w`^{RYHDd3Q?INv<0kk12Z330ntStPscTFiDISm1#GI0h*zm&39#+1wk?pS0|X1Oy<|;-27Yr0wYKi>~x^u=47KgAOWe(2_`OJlc0_V$(fr! zhbRWQ9we~Kl9dId8_C5WgEMXUHmBH~1gnKP8zg?qo_q5dhlgNKqB;;{n7eBYD*(+^ Bd1(U9&I%MBl`s9 delta 12 Tcmdn)yWMv}H>2Uk9&I%MBlZO3 -- 2.45.2 From e638b4fc1bd49dd13e95ae8a0b6918a199d2bf73 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Fri, 26 Jan 2024 17:10:26 +0300 Subject: [PATCH 3/5] [#922] control: Extend api with `ListOverrideDefinedTargets` Signed-off-by: Anton Nikiforov --- pkg/services/control/rpc.go | 48 +++++++++++------ pkg/services/control/server/policy_engine.go | 54 +++++++++++++++++++ pkg/services/control/service.pb.go | Bin 209554 -> 221750 bytes pkg/services/control/service.proto | 29 +++++++++- pkg/services/control/service_frostfs.pb.go | Bin 96685 -> 102396 bytes pkg/services/control/service_grpc.pb.go | Bin 33410 -> 35467 bytes 6 files changed, 113 insertions(+), 18 deletions(-) diff --git a/pkg/services/control/rpc.go b/pkg/services/control/rpc.go index 3fd4d4ae9..24b20f873 100644 --- a/pkg/services/control/rpc.go +++ b/pkg/services/control/rpc.go @@ -8,23 +8,24 @@ import ( const serviceName = "control.ControlService" const ( - rpcHealthCheck = "HealthCheck" - rpcSetNetmapStatus = "SetNetmapStatus" - rpcDropObjects = "DropObjects" - rpcListShards = "ListShards" - rpcSetShardMode = "SetShardMode" - rpcSynchronizeTree = "SynchronizeTree" - rpcEvacuateShard = "EvacuateShard" - rpcStartShardEvacuation = "StartShardEvacuation" - rpcGetShardEvacuationStatus = "GetShardEvacuationStatus" - rpcStopShardEvacuation = "StopShardEvacuation" - rpcFlushCache = "FlushCache" - rpcDoctor = "Doctor" - rpcAddChainLocalOverride = "AddChainLocalOverride" - rpcGetChainLocalOverride = "GetChainLocalOverride" - rpcListChainLocalOverrides = "ListChainLocalOverrides" - rpcRemoveChainLocalOverride = "RemoveChainLocalOverride" - rpcSealWriteCache = "SealWriteCache" + rpcHealthCheck = "HealthCheck" + rpcSetNetmapStatus = "SetNetmapStatus" + rpcDropObjects = "DropObjects" + rpcListShards = "ListShards" + rpcSetShardMode = "SetShardMode" + rpcSynchronizeTree = "SynchronizeTree" + rpcEvacuateShard = "EvacuateShard" + rpcStartShardEvacuation = "StartShardEvacuation" + rpcGetShardEvacuationStatus = "GetShardEvacuationStatus" + rpcStopShardEvacuation = "StopShardEvacuation" + rpcFlushCache = "FlushCache" + rpcDoctor = "Doctor" + rpcAddChainLocalOverride = "AddChainLocalOverride" + rpcGetChainLocalOverride = "GetChainLocalOverride" + rpcListChainLocalOverrides = "ListChainLocalOverrides" + rpcRemoveChainLocalOverride = "RemoveChainLocalOverride" + rpcSealWriteCache = "SealWriteCache" + rpcListTargetsLocalOverrides = "ListTargetsLocalOverrides" ) // HealthCheck executes ControlService.HealthCheck RPC. @@ -240,6 +241,19 @@ func ListChainLocalOverrides(cli *client.Client, req *ListChainLocalOverridesReq return wResp.message, nil } +// ListTargetsLocalOverrides executes ControlService.ListTargetsLocalOverrides RPC. +func ListTargetsLocalOverrides(cli *client.Client, req *ListTargetsLocalOverridesRequest, opts ...client.CallOption) (*ListTargetsLocalOverridesResponse, error) { + wResp := newResponseWrapper[ListTargetsLocalOverridesResponse]() + wReq := &requestWrapper{m: req} + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcListTargetsLocalOverrides), wReq, wResp, opts...) + if err != nil { + return nil, err + } + + return wResp.message, nil +} + // RemoveChainLocalOverride executes ControlService.RemoveChainLocalOverride RPC. func GetChainLocalOverride(cli *client.Client, req *GetChainLocalOverrideRequest, opts ...client.CallOption) (*GetChainLocalOverrideResponse, error) { wResp := newResponseWrapper[GetChainLocalOverrideResponse]() diff --git a/pkg/services/control/server/policy_engine.go b/pkg/services/control/server/policy_engine.go index bd7f35f46..079b605ac 100644 --- a/pkg/services/control/server/policy_engine.go +++ b/pkg/services/control/server/policy_engine.go @@ -25,6 +25,29 @@ func apeTarget(chainTarget *control.ChainTarget) (engine.Target, error) { fmt.Errorf("target type is not supported: %s", chainTarget.GetType().String()).Error()) } +func controlTarget(chainTarget *engine.Target) (control.ChainTarget, error) { + switch chainTarget.Type { + case engine.Container: + return control.ChainTarget{ + Name: chainTarget.Name, + Type: control.ChainTarget_CONTAINER, + }, nil + case engine.Namespace: + // If namespace is empty, we take it for root namespace. + nm := chainTarget.Name + if nm == "root" { + nm = "" + } + return control.ChainTarget{ + Name: nm, + Type: control.ChainTarget_NAMESPACE, + }, nil + default: + } + return control.ChainTarget{}, status.Error(codes.InvalidArgument, + fmt.Errorf("target type is not supported: %c", chainTarget.Type).Error()) +} + func (s *Server) AddChainLocalOverride(_ context.Context, req *control.AddChainLocalOverrideRequest) (*control.AddChainLocalOverrideResponse, error) { if err := s.isValidRequest(req); err != nil { return nil, status.Error(codes.PermissionDenied, err.Error()) @@ -157,6 +180,37 @@ func (s *Server) RemoveChainLocalOverride(_ context.Context, req *control.Remove return resp, nil } +func (s *Server) ListTargetsLocalOverrides(_ context.Context, req *control.ListTargetsLocalOverridesRequest) (*control.ListTargetsLocalOverridesResponse, error) { + if err := s.isValidRequest(req); err != nil { + return nil, status.Error(codes.PermissionDenied, err.Error()) + } + + apeChainName := apechain.Name(req.GetBody().GetChainName()) + apeTargets, err := s.localOverrideStorage.LocalStorage().ListOverrideDefinedTargets(apeChainName) + if err != nil { + return nil, status.Error(getCodeByLocalStorageErr(err), err.Error()) + } + targets := make([]*control.ChainTarget, 0, len(apeTargets)) + for i := range apeTargets { + target, err := controlTarget(&apeTargets[i]) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + targets = append(targets, &target) + } + + resp := &control.ListTargetsLocalOverridesResponse{ + Body: &control.ListTargetsLocalOverridesResponse_Body{ + Targets: targets, + }, + } + err = SignMessage(s.key, resp) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + return resp, nil +} + func getCodeByLocalStorageErr(err error) codes.Code { if errors.Is(err, engine.ErrChainNotFound) || errors.Is(err, engine.ErrChainNameNotFound) { return codes.NotFound diff --git a/pkg/services/control/service.pb.go b/pkg/services/control/service.pb.go index f6b9ef60874664cafa1b5ffc729cb3e7babbaf89..e0c6e0622a41e8dfe2520f75aadee8d9b07e45bf 100644 GIT binary patch delta 11076 zcmaJ{d0f?H*8e=`!UZnd1zBWYG!Xt%fKyr80`+_4 zG?{=|YA%UcUaeG`QnM7$7IR9aw`^?6q^72(T;A{V{O-NLI5Ypi{hjBW^PKZN%X5Cq zGZ%dJzU$kXe^hH|^YFO6bkW?h#rJFf+#l!q{r16N?XHmJTI(DBP8x4~PK0ac-l*0Z zp1ad~^1S;OI|U{4kea|7X~*8afwpzmSgj<>&8bwAvKa^B`&_RHE7eRNe9Z+dqBrBH zK1@-E%C!T>&20AV!vstGeYMtfm!NKTRQ}C3m@=ZR$ffc5HkS!3o);n7nYPEBi;@tj zHMcL)%pEg&YtcFH`*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E)AQ1itIsltf*` zDshPCOaWuwx=f+#HY)f6@&tT9C1hQVlCJZmNNDo(XQyG?gwjJAW-)X5J^X@0PMuh5 zF#;w*T%jnzynvL>nyAGYW5DCws(gg8+@vTbXT@0XBCjE4Q1q49G^B^xClC zJ<0|W>(P92oFeb6Mo#Fg9O8f&WvC=Y@q}pQFb|5w zGH0TqermU@7!ad{qBCUc7TSl$=V?N!q8&Dt>5&z*$eF zjq3l!A!S4p98HZ)yv>3!@zjZ3Rd{oRFbZ z@ups2%?whWe&xci1ihi-M7q8a$W1+5c0S6$sT=w#HT+B;{mGjn|B2$)zF2)S5@Ij( z#YRJaz7%Fbqn*8UlfeOr_=HjPpQcm`=aO z1BSz#KG6sRe&^Ru}bxM=tugXnMXsn%{pU22IIWt_C1Ezj*;4ab0@lCBLTJkIzWj8geFd++W2MR7@ zVu#rd8orR55V;bx-*JR?(*iH?5}7vd8(%%H`Gvt zYA(*nhRqsm5dP-7p7R;eHLYX?OHS7*VswP6n_TO&1X-En<~hBZC~lt)v{7<CO^fdC`x_6AQzT>}7Dj*V>q delta 17 Zcmew}pKa}D)`l&NiJsdx#54LB002z62WbER diff --git a/pkg/services/control/service_grpc.pb.go b/pkg/services/control/service_grpc.pb.go index e09f6750b66eea396b4f5deb3be059fa191cf88a..89337323f97e2ff62cb110042a41e4c6ece0d404 100644 GIT binary patch delta 697 zcmZo_W$K>Fv>}seasZpm*ximzaHnXJPsGnt*m4Ja== zIg`Z$%s<28KKTW!+++h*pUL;wWhPH&4Vt{2Lv}JNn-5rD4x0;*j+tBnlv88(2h!P- zg;-@K|6&gWt54(5;`YfbE(u92N>42*o_v5^ZgLH)v;>lvPkwS@j(=HdQBh_}>g0{g zqLT%hcqh;2kes}MMP~D5j#6G(kZOezh!G0;X$mD7sR}tDZ3>P7u9F)?W%=~DIFXE; zd_hEq9cCq?s2QAXBdWaFL(E+q#Z9;s%S{fjWtqG|m3y**HVfPkOKlf8`vAM_WC69@ z&HcI&Jfu5wy@e{=Bt}uu$?q&U;C!G{CwquRY__+m;74&TeobidU?3??`{kc$V{oh~$x5c8-aPqyzB><1}_Dlc( delta 179 zcmeC4%GA`#v>}seatxdFNoi$hxFtHtU;5dS!E{+uz7>^m9v5L%S^t(WX#K((A4fnYsl99on4IW<7$Z4Txv<(=GW8?pJf_ Date: Fri, 26 Jan 2024 17:13:40 +0300 Subject: [PATCH 4/5] [#922] Fix linter issue Signed-off-by: Anton Nikiforov --- Makefile | 2 +- README.md | 2 +- dev/.vscode-example/launch.json | 2 +- dev/.vscode-example/tasks.json | 2 +- dev/ir/az.json | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 84653a03a..4ff42b7e4 100755 --- a/Makefile +++ b/Makefile @@ -259,4 +259,4 @@ env-down: docker volume rm -f frostfs-node_neo-go rm -f ./.cache/.frostfs-ir-state rm -f ./.cache/.frostfs-node-state - rm -rf ./.cache/storage \ No newline at end of file + rm -rf ./.cache/storage diff --git a/README.md b/README.md index ff816f2c7..ecd162a85 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Enter password > <- press ENTER, the is no password for wallet CID: CfPhEuHQ2PRvM4gfBQDC4dWZY3NccovyfcnEdiq2ixju ./bin/frostfs-cli object put -r 127.0.0.1:8080 --wallet ./dev/wallet.json --file README.md --cid CfPhEuHQ2PRvM4gfBQDC4dWZY3NccovyfcnEdiq2ixju -Enter password > +Enter password > 4300 / 4300 [===========================================================================================================================================================================================================] 100.00% 0s [README.md] Object successfully stored OID: 78sohnudVMnPsczXqsTUcvezosan2YDNVZwDE8Kq5YwU diff --git a/dev/.vscode-example/launch.json b/dev/.vscode-example/launch.json index cf91c0d24..07d39482e 100644 --- a/dev/.vscode-example/launch.json +++ b/dev/.vscode-example/launch.json @@ -86,4 +86,4 @@ "stopAll": true } ] -} \ No newline at end of file +} diff --git a/dev/.vscode-example/tasks.json b/dev/.vscode-example/tasks.json index 8c6099a05..0ccd9d110 100644 --- a/dev/.vscode-example/tasks.json +++ b/dev/.vscode-example/tasks.json @@ -16,4 +16,4 @@ "detail": "Down debug environment" } ] -} \ No newline at end of file +} diff --git a/dev/ir/az.json b/dev/ir/az.json index a16aec295..8e88b432c 100644 --- a/dev/ir/az.json +++ b/dev/ir/az.json @@ -66,4 +66,3 @@ "Tokens": null } } - -- 2.45.2 From 89f63ed41adb4ccb14331d4570499e8b587bd342 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Fri, 26 Jan 2024 17:15:28 +0300 Subject: [PATCH 5/5] [#922] cli: Add new command `control list-targets` Signed-off-by: Anton Nikiforov --- .../modules/control/list_targets.go | 82 +++++++++++++++++++ cmd/frostfs-cli/modules/control/root.go | 2 + 2 files changed, 84 insertions(+) create mode 100644 cmd/frostfs-cli/modules/control/list_targets.go diff --git a/cmd/frostfs-cli/modules/control/list_targets.go b/cmd/frostfs-cli/modules/control/list_targets.go new file mode 100644 index 000000000..29033d017 --- /dev/null +++ b/cmd/frostfs-cli/modules/control/list_targets.go @@ -0,0 +1,82 @@ +package control + +import ( + "bytes" + "crypto/sha256" + "fmt" + "strconv" + "text/tabwriter" + + "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + "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-node/pkg/services/control" + cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "github.com/spf13/cobra" +) + +const ( + chainNameFlag = "chain-name" + chainNameFlagUsage = "Chain name(ingress|s3)" +) + +var listTargetsCmd = &cobra.Command{ + Use: "list-targets", + Short: "List local targets", + Long: "List local APE overrides of the node", + Run: listTargets, +} + +func listTargets(cmd *cobra.Command, _ []string) { + pk := key.Get(cmd) + + var cnr cid.ID + chainName, _ := cmd.Flags().GetString(chainNameFlag) + + rawCID := make([]byte, sha256.Size) + cnr.Encode(rawCID) + + req := &control.ListTargetsLocalOverridesRequest{ + Body: &control.ListTargetsLocalOverridesRequest_Body{ + ChainName: chainName, + }, + } + + signRequest(cmd, pk, req) + + cli := getClient(cmd, pk) + + var resp *control.ListTargetsLocalOverridesResponse + var err error + err = cli.ExecRaw(func(client *client.Client) error { + resp, err = control.ListTargetsLocalOverrides(client, req) + return err + }) + commonCmd.ExitOnErr(cmd, "rpc error: %w", err) + + verifyResponse(cmd, resp.GetSignature(), resp.GetBody()) + + targets := resp.GetBody().GetTargets() + if len(targets) == 0 { + cmd.Println("Local overrides are not defined for the container.") + return + } + + buf := bytes.NewBuffer(nil) + tw := tabwriter.NewWriter(buf, 0, 2, 2, ' ', 0) + _, _ = tw.Write([]byte("#\tName\tType\n")) + for i, t := range targets { + _, _ = tw.Write([]byte(fmt.Sprintf("%s\t%s\t%s\n", strconv.Itoa(i), t.GetName(), t.GetType()))) + } + _ = tw.Flush() + cmd.Print(buf.String()) +} + +func initControlListTargetsCmd() { + initControlFlags(listTargetsCmd) + + ff := listTargetsCmd.Flags() + ff.String(chainNameFlag, "", chainNameFlagUsage) + + _ = cobra.MarkFlagRequired(ff, chainNameFlag) +} diff --git a/cmd/frostfs-cli/modules/control/root.go b/cmd/frostfs-cli/modules/control/root.go index f7c846eba..41222fc00 100644 --- a/cmd/frostfs-cli/modules/control/root.go +++ b/cmd/frostfs-cli/modules/control/root.go @@ -38,6 +38,7 @@ func init() { removeRuleCmd, listRulesCmd, getRuleCmd, + listTargetsCmd, ) initControlHealthCheckCmd() @@ -50,4 +51,5 @@ func init() { initControlRemoveRuleCmd() initControlListRulesCmd() initControGetRuleCmd() + initControlListTargetsCmd() } -- 2.45.2