From 0b367007fc0d37d009de7cd7f90ab2964c5ab85c Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 28 May 2024 16:12:14 +0300 Subject: [PATCH] [#1152] go.mod: Update api-go and sdk versions * Resolve conflicts for apemanager since api-go contains ape and apemanager packages and SDK only ape package. Signed-off-by: Airat Arifullin --- .../modules/ape_manager/add_chain.go | 16 ++++----- go.mod | 4 +-- go.sum | 8 ++--- pkg/services/apemanager/executor.go | 35 ++++++++++--------- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/cmd/frostfs-cli/modules/ape_manager/add_chain.go b/cmd/frostfs-cli/modules/ape_manager/add_chain.go index dea7fb36e..c6622da25 100644 --- a/cmd/frostfs-cli/modules/ape_manager/add_chain.go +++ b/cmd/frostfs-cli/modules/ape_manager/add_chain.go @@ -9,7 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/modules/util" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" - apemanager_sdk "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/apemanager" + apeSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" client_sdk "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" apechain "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain" @@ -49,7 +49,7 @@ var addCmd = &cobra.Command{ }, } -func parseTarget(cmd *cobra.Command) (ct apemanager_sdk.ChainTarget) { +func parseTarget(cmd *cobra.Command) (ct apeSDK.ChainTarget) { typ, _ := cmd.Flags().GetString(targetTypeFlag) name, _ := cmd.Flags().GetString(targetNameFlag) @@ -57,22 +57,22 @@ func parseTarget(cmd *cobra.Command) (ct apemanager_sdk.ChainTarget) { switch typ { case namespaceTarget: - ct.TargetType = apemanager_sdk.TargetTypeNamespace + ct.TargetType = apeSDK.TargetTypeNamespace case containerTarget: var cnr cid.ID commonCmd.ExitOnErr(cmd, "can't decode container ID: %w", cnr.DecodeString(name)) - ct.TargetType = apemanager_sdk.TargetTypeContainer + ct.TargetType = apeSDK.TargetTypeContainer case userTarget: - ct.TargetType = apemanager_sdk.TargetTypeUser + ct.TargetType = apeSDK.TargetTypeUser case groupTarget: - ct.TargetType = apemanager_sdk.TargetTypeGroup + ct.TargetType = apeSDK.TargetTypeGroup default: commonCmd.ExitOnErr(cmd, "read target type error: %w", errUnknownTargetType) } return ct } -func parseChain(cmd *cobra.Command) apemanager_sdk.Chain { +func parseChain(cmd *cobra.Command) apeSDK.Chain { chainID, _ := cmd.Flags().GetString(chainIDFlag) hexEncoded, _ := cmd.Flags().GetBool(chainIDHexFlag) @@ -99,7 +99,7 @@ func parseChain(cmd *cobra.Command) apemanager_sdk.Chain { util.PrintHumanReadableAPEChain(cmd, chain) serialized := chain.Bytes() - return apemanager_sdk.Chain{ + return apeSDK.Chain{ Raw: serialized, } } diff --git a/go.mod b/go.mod index 1335747aa..6edd305bb 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.21 require ( code.gitea.io/sdk/gitea v0.17.1 - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240516133103-0803bc6ded00 + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240530152826-2f6d3209e1d3 git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240409111539-e7a05a49ff45 git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20231101111734-b3ad3335ff65 - git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240517121628-3de256d05e32 + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240531121442-717a7d00ef21 git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240513163744-1f6f4163d40d git.frostfs.info/TrueCloudLab/tzhash v1.8.0 diff --git a/go.sum b/go.sum index ce68ddb22..dcae21bc3 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,15 @@ code.gitea.io/sdk/gitea v0.17.1 h1:3jCPOG2ojbl8AcfaUCRYLT5MUcBMFwS0OSK2mA5Zok8= code.gitea.io/sdk/gitea v0.17.1/go.mod h1:aCnBqhHpoEWA180gMbaCtdX9Pl6BWBAuuP2miadoTNM= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240516133103-0803bc6ded00 h1:Q3B9WtFh05AXhUFs/2CLvhh9tuFs/Zd/XemWBbuzvg8= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240516133103-0803bc6ded00/go.mod h1:OBDSr+DqV1z4VDouoX3YMleNc4DPBVBWTG3WDT2PK1o= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240530152826-2f6d3209e1d3 h1:H5GvrVlowIMWfzqQkhY0p0myooJxQ1sMRVSFfXawwWg= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240530152826-2f6d3209e1d3/go.mod h1:OBDSr+DqV1z4VDouoX3YMleNc4DPBVBWTG3WDT2PK1o= git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240409111539-e7a05a49ff45 h1:Tp4I+XOLp3VCJORfxSamQtj3RZNISbaLM4WD5iIzXxg= git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240409111539-e7a05a49ff45/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20231101111734-b3ad3335ff65 h1:PaZ8GpnUoXxUoNsc1qp36bT2u7FU+neU4Jn9cl8AWqI= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20231101111734-b3ad3335ff65/go.mod h1:6aAX80dvJ3r5fjN9CzzPglRptoiPgIC9KFGGsUA+1Hw= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240517121628-3de256d05e32 h1:ebXBsKCAINoJLhBUqi1x3fToxUHUsUjEBGKo86JQoho= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240517121628-3de256d05e32/go.mod h1:Wu1jsGM6JhZwS5oMWeslKvMcvRbg8nGt/B/TfsQPoFA= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240531121442-717a7d00ef21 h1:ugo9k9s0+51BCMhD4mqHD+qD5P4BOTfDxcEMqTsM9+A= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240531121442-717a7d00ef21/go.mod h1:dwBHqBoseOpU4EiIPSGxhNeQx2QOEao/1r8h26syswI= git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc= git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM= git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240513163744-1f6f4163d40d h1:hHk8FWbWgEnwm2I045CaBIrZBjy/o81CehIVOySA/pQ= diff --git a/pkg/services/apemanager/executor.go b/pkg/services/apemanager/executor.go index 9cfc97473..25f43486a 100644 --- a/pkg/services/apemanager/executor.go +++ b/pkg/services/apemanager/executor.go @@ -8,7 +8,8 @@ import ( "errors" "fmt" - apemanager_v2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager" + apeV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape" + apemanagerV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" ape_contract "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/ape/contract_storage" @@ -83,13 +84,13 @@ func (s *Service) validateContainerTargetRequest(cid string, pubKey *keys.Public return nil } -func (s *Service) AddChain(_ context.Context, req *apemanager_v2.AddChainRequest) (*apemanager_v2.AddChainResponse, error) { +func (s *Service) AddChain(_ context.Context, req *apemanagerV2.AddChainRequest) (*apemanagerV2.AddChainResponse, error) { pub, err := getSignaturePublicKey(req.GetVerificationHeader()) if err != nil { return nil, err } - chain, err := decodeAndValidateChain(req.GetBody().GetChain().GetKind().(*apemanager_v2.ChainRaw).GetRaw()) + chain, err := decodeAndValidateChain(req.GetBody().GetChain().GetKind().(*apeV2.ChainRaw).GetRaw()) if err != nil { return nil, err } @@ -105,7 +106,7 @@ func (s *Service) AddChain(_ context.Context, req *apemanager_v2.AddChainRequest var target policy_engine.Target switch targetType := req.GetBody().GetTarget().GetTargetType(); targetType { - case apemanager_v2.TargetTypeContainer: + case apeV2.TargetTypeContainer: reqCID := req.GetBody().GetTarget().GetName() if err = s.validateContainerTargetRequest(reqCID, pub); err != nil { return nil, err @@ -119,16 +120,16 @@ func (s *Service) AddChain(_ context.Context, req *apemanager_v2.AddChainRequest return nil, err } - body := new(apemanager_v2.AddChainResponseBody) + body := new(apemanagerV2.AddChainResponseBody) body.SetChainID(chain.ID) - resp := new(apemanager_v2.AddChainResponse) + resp := new(apemanagerV2.AddChainResponse) resp.SetBody(body) return resp, nil } -func (s *Service) RemoveChain(_ context.Context, req *apemanager_v2.RemoveChainRequest) (*apemanager_v2.RemoveChainResponse, error) { +func (s *Service) RemoveChain(_ context.Context, req *apemanagerV2.RemoveChainRequest) (*apemanagerV2.RemoveChainResponse, error) { pub, err := getSignaturePublicKey(req.GetVerificationHeader()) if err != nil { return nil, err @@ -137,7 +138,7 @@ func (s *Service) RemoveChain(_ context.Context, req *apemanager_v2.RemoveChainR var target policy_engine.Target switch targetType := req.GetBody().GetTarget().GetTargetType(); targetType { - case apemanager_v2.TargetTypeContainer: + case apeV2.TargetTypeContainer: reqCID := req.GetBody().GetTarget().GetName() if err = s.validateContainerTargetRequest(reqCID, pub); err != nil { return nil, err @@ -151,15 +152,15 @@ func (s *Service) RemoveChain(_ context.Context, req *apemanager_v2.RemoveChainR return nil, err } - body := new(apemanager_v2.RemoveChainResponseBody) + body := new(apemanagerV2.RemoveChainResponseBody) - resp := new(apemanager_v2.RemoveChainResponse) + resp := new(apemanagerV2.RemoveChainResponse) resp.SetBody(body) return resp, nil } -func (s *Service) ListChains(_ context.Context, req *apemanager_v2.ListChainsRequest) (*apemanager_v2.ListChainsResponse, error) { +func (s *Service) ListChains(_ context.Context, req *apemanagerV2.ListChainsRequest) (*apemanagerV2.ListChainsResponse, error) { pub, err := getSignaturePublicKey(req.GetVerificationHeader()) if err != nil { return nil, err @@ -168,7 +169,7 @@ func (s *Service) ListChains(_ context.Context, req *apemanager_v2.ListChainsReq var target policy_engine.Target switch targetType := req.GetBody().GetTarget().GetTargetType(); targetType { - case apemanager_v2.TargetTypeContainer: + case apeV2.TargetTypeContainer: reqCID := req.GetBody().GetTarget().GetName() if err = s.validateContainerTargetRequest(reqCID, pub); err != nil { return nil, err @@ -183,21 +184,21 @@ func (s *Service) ListChains(_ context.Context, req *apemanager_v2.ListChainsReq return nil, err } - res := make([]*apemanager_v2.Chain, 0, len(chs)) + res := make([]*apeV2.Chain, 0, len(chs)) for _, ch := range chs { - v2chraw := new(apemanager_v2.ChainRaw) + v2chraw := new(apeV2.ChainRaw) v2chraw.SetRaw(ch.Bytes()) - v2ch := new(apemanager_v2.Chain) + v2ch := new(apeV2.Chain) v2ch.SetKind(v2chraw) res = append(res, v2ch) } - body := new(apemanager_v2.ListChainsResponseBody) + body := new(apemanagerV2.ListChainsResponseBody) body.SetChains(res) - resp := new(apemanager_v2.ListChainsResponse) + resp := new(apemanagerV2.ListChainsResponse) resp.SetBody(body) return resp, nil