[#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 <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-05-28 16:12:14 +03:00
parent 92e19feb57
commit 0b367007fc
4 changed files with 28 additions and 27 deletions

View file

@ -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,
}
}

4
go.mod
View file

@ -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

BIN
go.sum

Binary file not shown.

View file

@ -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