From 90f6afbdffb11be947d9cb8ad267f9a3bf6b28e2 Mon Sep 17 00:00:00 2001 From: Fynn Date: Mon, 13 Mar 2023 20:19:11 +0800 Subject: [PATCH] add group test --- e2e/tests/storage_test.go | 58 + go.mod | 3 +- proto/greenfield/storage/query.proto | 78 +- x/permission/keeper/keeper.go | 47 +- x/permission/types/common.go | 7 + x/permission/types/keys.go | 44 +- x/storage/client/cli/flags.go | 40 +- x/storage/client/cli/query.go | 92 +- x/storage/client/cli/tx.go | 245 +- x/storage/keeper/msg_server.go | 2 +- x/storage/keeper/permission.go | 55 + x/storage/keeper/query.go | 137 +- x/storage/types/errors.go | 32 +- x/storage/types/expected_keepers.go | 6 +- x/storage/types/keys.go | 5 + x/storage/types/query.pb.go | 3217 +++++++++++++++++++++----- x/storage/types/query.pb.gw.go | 478 +++- 17 files changed, 3627 insertions(+), 919 deletions(-) diff --git a/e2e/tests/storage_test.go b/e2e/tests/storage_test.go index 282cd43d8..e8ffffd40 100644 --- a/e2e/tests/storage_test.go +++ b/e2e/tests/storage_test.go @@ -5,6 +5,7 @@ import ( "context" "fmt" "math" + "strings" "testing" "time" @@ -187,6 +188,63 @@ func (s *StorageTestSuite) TestCreateObject() { s.SendTxBlock(msgDeleteBucket, user) } +func (s *StorageTestSuite) TestCreateGroup() { + ctx := context.Background() + + owner := s.GenAndChargeAccounts(1, 1000000)[0] + member := s.GenAndChargeAccounts(1, 1000000)[0] + groupName := storageutils.GenRandomGroupName() + + // 1. CreateGroup + msgCreateGroup := storagetypes.NewMsgCreateGroup(owner.GetAddr(), groupName, []sdk.AccAddress{member.GetAddr()}) + s.SendTxBlock(msgCreateGroup, owner) + s.T().Logf("CerateGroup success, owner: %s, group name: %s", owner.GetAddr().String(), groupName) + + // 2. HeadGroup + queryHeadGroupReq := storagetypes.QueryHeadGroupRequest{GroupOwner: owner.GetAddr().String(), GroupName: groupName} + queryHeadGroupResp, err := s.Client.HeadGroup(ctx, &queryHeadGroupReq) + s.Require().NoError(err) + s.Require().Equal(queryHeadGroupResp.GroupInfo.GroupName, groupName) + s.Require().Equal(queryHeadGroupResp.GroupInfo.Owner, owner.GetAddr().String()) + + // 3. HeadGroupMember + queryHeadGroupMemberReq := storagetypes.QueryHeadGroupMemberRequest{ + Member: member.GetAddr().String(), + GroupName: groupName, + GroupOwner: owner.GetAddr().String(), + } + queryHeadGroupMemberResp, err := s.Client.HeadGroupMember(ctx, &queryHeadGroupMemberReq) + s.Require().NoError(err) + s.Require().Equal(queryHeadGroupMemberResp.GroupInfo.GroupName, groupName) + s.Require().Equal(queryHeadGroupMemberResp.GroupInfo.Owner, owner.GetAddr().String()) + + // 4. UpdateGroupMember + member2 := s.GenAndChargeAccounts(1, 1000000)[0] + membersToAdd := []sdk.AccAddress{member2.GetAddr()} + membersToDelete := []sdk.AccAddress{member.GetAddr()} + msgUpdateGroupMember := storagetypes.NewMsgUpdateGroupMember(owner.GetAddr(), groupName, membersToAdd, membersToDelete) + s.SendTxBlock(msgUpdateGroupMember, owner) + + // 5. HeadGroupMember (delete) + queryHeadGroupMemberReqDelete := storagetypes.QueryHeadGroupMemberRequest{ + Member: member.GetAddr().String(), + GroupName: groupName, + GroupOwner: owner.GetAddr().String(), + } + _, err = s.Client.HeadGroupMember(ctx, &queryHeadGroupMemberReqDelete) + s.Require().True(strings.Contains(err.Error(), storagetypes.ErrNoSuchGroupMember.Error())) + // 5. HeadGroupMember (add) + queryHeadGroupMemberReqAdd := storagetypes.QueryHeadGroupMemberRequest{ + Member: member2.GetAddr().String(), + GroupName: groupName, + GroupOwner: owner.GetAddr().String(), + } + queryHeadGroupMemberRespAdd, err := s.Client.HeadGroupMember(ctx, &queryHeadGroupMemberReqAdd) + s.Require().NoError(err) + s.Require().Equal(queryHeadGroupMemberRespAdd.GroupInfo.GroupName, groupName) + s.Require().Equal(queryHeadGroupMemberRespAdd.GroupInfo.Owner, owner.GetAddr().String()) +} + func (s *StorageTestSuite) TestDeleteBucket() { var err error user := s.GenAndChargeAccounts(1, 1000000)[0] diff --git a/go.mod b/go.mod index ba763c544..75b692636 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.1 github.com/cosmos/cosmos-sdk v0.46.4 github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/gogoproto v1.4.6 github.com/cosmos/ibc-go/v5 v5.0.0 github.com/ethereum/go-ethereum v1.10.19 github.com/evmos/ethermint v0.6.1-0.20220919141022-34226aa7b1fa //TODO: update to ethermint v0.20.0 after it's released. @@ -34,6 +33,8 @@ require ( sigs.k8s.io/yaml v1.3.0 ) +require github.com/cosmos/gogoproto v1.4.6 + require ( filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect diff --git a/proto/greenfield/storage/query.proto b/proto/greenfield/storage/query.proto index 0d131182a..fd114471a 100644 --- a/proto/greenfield/storage/query.proto +++ b/proto/greenfield/storage/query.proto @@ -44,7 +44,7 @@ service Query { option (google.api.http).get = "/greenfield/storage/head_object/{bucket_name}/{object_name}"; } - // Queries a object by id + // Queries an object by id rpc HeadObjectById(QueryHeadObjectByIdRequest) returns (QueryHeadObjectResponse) { option (google.api.http).get = "/greenfield/storage/head_object_by_id/{object_id}"; } @@ -73,15 +73,36 @@ service Query { rpc HeadGroupNFT(QueryNFTRequest) returns (QueryGroupNFTResponse) { option (google.api.http).get = "/greenfield/storage/head_group_nft/{token_id}"; } - // Queries policy by policyID - rpc GetPolicy(QueryGetPolicyRequest) returns (QueryGetPolicyResponse) { - option (google.api.http).get = "/greenfield/storage/get_policy/{policy_id}"; + + // Queries a policy which grants permission to account + rpc QueryPolicyForAccount(QueryPolicyForAccountRequest) returns (QueryPolicyForAccountResponse) { + option (google.api.http).get = "/greenfield/storage/policy_for_account/{resource}/{principal_address}"; } // Queries a list of VerifyPermission items. rpc VerifyPermission(QueryVerifyPermissionRequest) returns (QueryVerifyPermissionResponse) { option (google.api.http).get = "/greenfield/storage/verify_permission/{operator}/{bucket_name}/{object_name}/{action_type}"; } + + // Queries a group with specify owner and name . + rpc HeadGroup(QueryHeadGroupRequest) returns (QueryHeadGroupResponse) { + option (google.api.http).get = "/greenfield/storage/head_group/{group_owner}/{group_name}"; + } + + // Queries a list of ListGroup items. + rpc ListGroup(QueryListGroupRequest) returns (QueryListGroupResponse) { + option (google.api.http).get = "/bnb-chain/greenfield/storage/list_group"; + } + + // Queries a list of HeadGroupMember items. + rpc HeadGroupMember(QueryHeadGroupMemberRequest) returns (QueryHeadGroupMemberResponse) { + option (google.api.http).get = "/bnb-chain/greenfield/storage/head_group_member"; + } + + // Queries a policy that grants permission to a group + rpc QueryPolicyForGroup(QueryPolicyForGroupRequest) returns (QueryPolicyForGroupResponse) { + option (google.api.http).get = "/bnb-chain/greenfield/storage/policy_for_group/{resource}/{principal_group_id}"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -124,7 +145,7 @@ message QueryListBucketsRequest { } message QueryListBucketsResponse { - repeated BucketInfo bucket_infos = 1 [(gogoproto.nullable) = false]; + repeated BucketInfo bucket_infos = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -139,7 +160,7 @@ message QueryListObjectsByBucketIdRequest { } message QueryListObjectsResponse { - repeated ObjectInfo object_infos = 1 [(gogoproto.nullable) = false]; + repeated ObjectInfo object_infos = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -159,11 +180,12 @@ message QueryGroupNFTResponse { GroupMetaData meta_data = 1; } -message QueryGetPolicyRequest { - string policy_id = 1; +message QueryPolicyForAccountRequest { + string resource = 1; + string principal_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -message QueryGetPolicyResponse { +message QueryPolicyForAccountResponse { permission.Policy policy = 1; } @@ -177,3 +199,41 @@ message QueryVerifyPermissionRequest { message QueryVerifyPermissionResponse { permission.Effect effect = 1; } + +message QueryHeadGroupRequest { + string group_owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string group_name = 2; +} + +message QueryHeadGroupResponse { + GroupInfo group_info = 1; +} + +message QueryListGroupRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; + string group_owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +message QueryListGroupResponse { + cosmos.base.query.v1beta1.PageResponse pagination = 1; + repeated GroupInfo group_infos = 2; +} + +message QueryHeadGroupMemberRequest { + string member = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string group_owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string group_name = 3; +} + +message QueryHeadGroupMemberResponse { + GroupInfo group_info = 1; +} + +message QueryPolicyForGroupRequest { + string resource = 1; + string principal_group_id = 2; +} + +message QueryPolicyForGroupResponse { + permission.Policy policy = 1; +} diff --git a/x/permission/keeper/keeper.go b/x/permission/keeper/keeper.go index 83dfb98b1..166fb3774 100644 --- a/x/permission/keeper/keeper.go +++ b/x/permission/keeper/keeper.go @@ -59,7 +59,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { func (k Keeper) AddGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) error { store := ctx.KVStore(k.storeKey) - policy, found := k.getPolicyToAccount(ctx, groupID, resource.RESOURCE_TYPE_GROUP, member) + policy, found := k.GetPolicyForAccount(ctx, groupID, resource.RESOURCE_TYPE_GROUP, member) if !found { policy = types.NewDefaultPolicyForGroupMember(groupID, member) policy.Id = k.policySeq.NextVal(store) @@ -77,11 +77,11 @@ func (k Keeper) AddGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.Ac func (k Keeper) RemoveGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - policy, found := k.getPolicyToAccount(ctx, groupID, resource.RESOURCE_TYPE_GROUP, member) + policy, found := k.GetPolicyForAccount(ctx, groupID, resource.RESOURCE_TYPE_GROUP, member) if found { if policy.Statements == nil { store.Delete(types.GetPolicyByIDKey(policy.Id)) - store.Delete(types.GetPolicyToAccountKey(groupID, resource.RESOURCE_TYPE_GROUP, member)) + store.Delete(types.GetPolicyForAccountKey(groupID, resource.RESOURCE_TYPE_GROUP, member)) } else { policy.MemberStatement = nil store.Set(types.GetPolicyByIDKey(policy.Id), k.cdc.MustMarshal(policy)) @@ -99,7 +99,7 @@ func (k Keeper) PutPolicy(ctx sdk.Context, policy *types.Policy) (math.Uint, err store := ctx.KVStore(k.storeKey) if policy.Principal.Type == types.TYPE_GNFD_ACCOUNT { - policyKey := types.GetPolicyToAccountKey(policy.ResourceId, policy.ResourceType, + policyKey := types.GetPolicyForAccountKey(policy.ResourceId, policy.ResourceType, policy.Principal.MustGetAccountAddress()) bz := store.Get(policyKey) if bz != nil { @@ -112,7 +112,7 @@ func (k Keeper) PutPolicy(ctx sdk.Context, policy *types.Policy) (math.Uint, err store.Set(types.GetPolicyByIDKey(policy.Id), bz) } } else if policy.Principal.Type == types.TYPE_GNFD_GROUP { - policyGroupKey := types.GetPolicyToGroupKey(policy.ResourceId, policy.ResourceType) + policyGroupKey := types.GetPolicyForGroupKey(policy.ResourceId, policy.ResourceType) bz := store.Get(policyGroupKey) if bz != nil { policyGroup := types.PolicyGroup{} @@ -173,11 +173,11 @@ func (k Keeper) MustGetPolicyByID(ctx sdk.Context, policyID math.Uint) *types.Po return policy } -func (k Keeper) getPolicyToAccount(ctx sdk.Context, resourceID math.Uint, +func (k Keeper) GetPolicyForAccount(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) (policy *types.Policy, isFound bool) { store := ctx.KVStore(k.storeKey) - policyKey := types.GetPolicyToAccountKey(resourceID, resourceType, addr) + policyKey := types.GetPolicyForAccountKey(resourceID, resourceType, addr) bz := store.Get(policyKey) if bz == nil { @@ -187,10 +187,31 @@ func (k Keeper) getPolicyToAccount(ctx sdk.Context, resourceID math.Uint, return k.GetPolicyByID(ctx, sequence.DecodeSequence(bz)) } +func (k Keeper) GetPolicyForGroup(ctx sdk.Context, resourceID math.Uint, + resourceType resource.ResourceType, groupID math.Uint) (policy *types.Policy, + isFound bool) { + store := ctx.KVStore(k.storeKey) + policyGroupKey := types.GetPolicyForGroupKey(resourceID, resourceType) + + bz := store.Get(policyGroupKey) + if bz == nil { + return policy, false + } + + var policyGroup types.PolicyGroup + k.cdc.MustUnmarshal(bz, &policyGroup) + for _, item := range policyGroup.Items { + if item.GroupId == groupID { + return k.GetPolicyByID(ctx, item.PolicyId) + } + } + return nil, false +} + func (k Keeper) setPolicyToAccount(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress, policy *types.Policy) { store := ctx.KVStore(k.storeKey) - policyKey := types.GetPolicyToAccountKey(resourceID, resourceType, addr) + policyKey := types.GetPolicyForAccountKey(resourceID, resourceType, addr) store.Set(policyKey, sequence.EncodeSequence(policy.Id)) store.Set(types.GetPolicyByIDKey(policy.Id), k.cdc.MustMarshal(policy)) @@ -199,7 +220,7 @@ func (k Keeper) setPolicyToAccount(ctx sdk.Context, resourceID math.Uint, func (k Keeper) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, operator sdk.AccAddress, action types.ActionType, resource *string) types.Effect { // verify policy which grant permission to account - policy, found := k.getPolicyToAccount(ctx, resourceID, resourceType, operator) + policy, found := k.GetPolicyForAccount(ctx, resourceID, resourceType, operator) if found { effect := policy.Eval(action, resource) if effect != types.EFFECT_PASS { @@ -209,7 +230,7 @@ func (k Keeper) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType // verify policy which grant permission to group store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetPolicyToGroupKey(resourceID, resourceType)) + bz := store.Get(types.GetPolicyForGroupKey(resourceID, resourceType)) policyGroup := types.PolicyGroup{} k.cdc.MustUnmarshal(bz, &policyGroup) @@ -220,7 +241,7 @@ func (k Keeper) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType effect := p.Eval(action, resource) if effect != types.EFFECT_PASS { // check the operator is the member of this group - groupPolicy, found := k.getPolicyToAccount(ctx, item.GroupId, resourceType, operator) + groupPolicy, found := k.GetPolicyForAccount(ctx, item.GroupId, resourceType, operator) if found { memberEffect := groupPolicy.Eval(types.ACTION_GROUP_MEMBER, nil) if memberEffect != types.EFFECT_PASS { @@ -247,7 +268,7 @@ func (k Keeper) DeletePolicy(ctx sdk.Context, principal *types.Principal, resour var policyID math.Uint if principal.Type == types.TYPE_GNFD_ACCOUNT { accAddr := sdk.MustAccAddressFromHex(principal.Value) - policyKey := types.GetPolicyToAccountKey(resourceID, resourceType, accAddr) + policyKey := types.GetPolicyForAccountKey(resourceID, resourceType, accAddr) bz := store.Get(policyKey) policyID = sequence.DecodeSequence(bz) if bz != nil { @@ -259,7 +280,7 @@ func (k Keeper) DeletePolicy(ctx sdk.Context, principal *types.Principal, resour if err != nil { return math.ZeroUint(), err } - bz := store.Get(types.GetPolicyToGroupKey(resourceID, resourceType)) + bz := store.Get(types.GetPolicyForGroupKey(resourceID, resourceType)) if bz != nil { policyGroup := types.PolicyGroup{} k.cdc.MustUnmarshal(bz, &policyGroup) diff --git a/x/permission/types/common.go b/x/permission/types/common.go index 0e06ed636..4834dcf85 100644 --- a/x/permission/types/common.go +++ b/x/permission/types/common.go @@ -12,6 +12,13 @@ func NewPrincipalWithAccount(addr sdk.AccAddress) *Principal { } } +func NewPrincipalWithGroup(groupID sdkmath.Uint) *Principal { + return &Principal{ + Type: TYPE_GNFD_GROUP, + Value: groupID.String(), + } +} + func (p *Principal) ValidateBasic() error { switch p.Type { case TYPE_GNFD_ACCOUNT: diff --git a/x/permission/types/keys.go b/x/permission/types/keys.go index f9facf9d6..e349ec0bd 100644 --- a/x/permission/types/keys.go +++ b/x/permission/types/keys.go @@ -26,60 +26,60 @@ func KeyPrefix(p string) []byte { } var ( - BucketPolicyToAccountPrefix = []byte{0x11} - ObjectPolicyToAccountPrefix = []byte{0x12} - GroupPolicyToAccountPrefix = []byte{0x13} + BucketPolicyForAccountPrefix = []byte{0x11} + ObjectPolicyForAccountPrefix = []byte{0x12} + GroupPolicyForAccountPrefix = []byte{0x13} - BucketPolicyToGroupPrefix = []byte{0x21} - ObjectPolicyToGroupPrefix = []byte{0x22} + BucketPolicyForGroupPrefix = []byte{0x21} + ObjectPolicyForGroupPrefix = []byte{0x22} PolicyByIDPrefix = []byte{0x31} PolicySequencePrefix = []byte{0x41} ) -func GetPolicyToAccountKey(resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) []byte { +func GetPolicyForAccountKey(resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) []byte { switch resourceType { case resource.RESOURCE_TYPE_BUCKET: - return GetBucketPolicyToAccountKey(resourceID, addr) + return GetBucketPolicyForAccountKey(resourceID, addr) case resource.RESOURCE_TYPE_OBJECT: - return GetObjectPolicyToAccountKey(resourceID, addr) + return GetObjectPolicyForAccountKey(resourceID, addr) case resource.RESOURCE_TYPE_GROUP: - return GetGroupPolicyToAccountKey(resourceID, addr) + return GetGroupPolicyForAccountKey(resourceID, addr) default: return nil } } -func GetBucketPolicyToAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { - return append(BucketPolicyToAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) +func GetBucketPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { + return append(BucketPolicyForAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) } -func GetObjectPolicyToAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { - return append(ObjectPolicyToAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) +func GetObjectPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { + return append(ObjectPolicyForAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) } -func GetGroupPolicyToAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { - return append(GroupPolicyToAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) +func GetGroupPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { + return append(GroupPolicyForAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) } -func GetPolicyToGroupKey(resourceID math.Uint, resourceType resource.ResourceType) []byte { +func GetPolicyForGroupKey(resourceID math.Uint, resourceType resource.ResourceType) []byte { switch resourceType { case resource.RESOURCE_TYPE_BUCKET: - return GetBucketPolicyToGroupKey(resourceID) + return GetBucketPolicyForGroupKey(resourceID) case resource.RESOURCE_TYPE_OBJECT: - return GetObjectPolicyToGroupKey(resourceID) + return GetObjectPolicyForGroupKey(resourceID) default: return nil } } -func GetBucketPolicyToGroupKey(resourceID math.Uint) []byte { - return append(BucketPolicyToGroupPrefix, resourceID.Bytes()...) +func GetBucketPolicyForGroupKey(resourceID math.Uint) []byte { + return append(BucketPolicyForGroupPrefix, resourceID.Bytes()...) } -func GetObjectPolicyToGroupKey(resourceID math.Uint) []byte { - return append(ObjectPolicyToGroupPrefix, resourceID.Bytes()...) +func GetObjectPolicyForGroupKey(resourceID math.Uint) []byte { + return append(ObjectPolicyForGroupPrefix, resourceID.Bytes()...) } func GetPolicyByIDKey(policyID math.Uint) []byte { diff --git a/x/storage/client/cli/flags.go b/x/storage/client/cli/flags.go index 39fb09f91..d653f91b9 100644 --- a/x/storage/client/cli/flags.go +++ b/x/storage/client/cli/flags.go @@ -6,41 +6,15 @@ import ( ) const ( - FlagPublic = "public" - FlagPaymentAccount = "payment-account" - FlagPrimarySP = "primary-sp" - FlagApprover = "approver" + FlagPublic = "public" + FlagPaymentAccount = "payment-account" + FlagPrimarySP = "primary-sp" + FlagExpectChecksums = "expect-checksums" + FlagRedundancyType = "redundancy-type" + FlagApproveSignature = "approve-signature" + FlagApproveTimeoutHeight = "approve-timeout-height" ) -// GetApproverField returns a from account address, account name and keyring type, given either an address or key name. -func GetApproverField(kr keyring.Keyring, approver string) (sdk.AccAddress, string, keyring.KeyType, error) { - if approver == "" { - return nil, "", 0, nil - } - - addr, err := sdk.AccAddressFromHexUnsafe(approver) - - var k *keyring.Record - if err == nil { - k, err = kr.KeyByAddress(addr) - if err != nil { - return nil, "", 0, err - } - } else { - k, err = kr.Key(approver) - if err != nil { - return nil, "", 0, err - } - } - - addr, err = k.GetAddress() - if err != nil { - return nil, "", 0, err - } - - return addr, k.Name, k.GetType(), nil -} - // GetPrimarySPField returns a from account address, account name and keyring type, given either an address or key name. func GetPrimarySPField(kr keyring.Keyring, primarySP string) (sdk.AccAddress, string, keyring.KeyType, error) { if primarySP == "" { diff --git a/x/storage/client/cli/query.go b/x/storage/client/cli/query.go index 0d3856466..25a1e2397 100644 --- a/x/storage/client/cli/query.go +++ b/x/storage/client/cli/query.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" @@ -12,9 +11,6 @@ import ( "github.com/bnb-chain/greenfield/x/storage/types" ) -// TODO: Support List bucket/object/group with pagination. -// TODO: Support HeadGroup - // GetQueryCmd returns the cli query commands for this module func GetQueryCmd(queryRoute string) *cobra.Command { // Group storage queries under a subcommand @@ -31,10 +27,10 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdHeadObject()) cmd.AddCommand(CmdListBuckets()) cmd.AddCommand(CmdListObjects()) - - cmd.AddCommand(CmdGetPolicy()) - cmd.AddCommand(CmdVerifyPermission()) + cmd.AddCommand(CmdHeadGroup()) + cmd.AddCommand(CmdListGroup()) + cmd.AddCommand(CmdHeadGroupMember()) // this line is used by starport scaffolding # 1 @@ -156,7 +152,6 @@ func CmdListObjects() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) params := &types.QueryListObjectsRequest{ - BucketName: reqBucketName, } @@ -174,18 +169,43 @@ func CmdListObjects() *cobra.Command { return cmd } -func CmdGetPolicy() *cobra.Command { +func CmdVerifyPermission() *cobra.Command { cmd := &cobra.Command{ - Use: "bucket-policy [policy-id]", - Short: "Query bucket-policy", - Args: cobra.ExactArgs(1), + Use: "verify-permission", + Short: "Query verify-permission", + Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { - reqPolicyId := args[0] - ID, err := math.ParseUint(reqPolicyId) + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryVerifyPermissionRequest{} + + res, err := queryClient.VerifyPermission(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdHeadGroup() *cobra.Command { + cmd := &cobra.Command{ + Use: "head-group", + Short: "Query head-group", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -193,11 +213,39 @@ func CmdGetPolicy() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryGetPolicyRequest{ - PolicyId: ID.String(), + params := &types.QueryHeadGroupRequest{} + + res, err := queryClient.HeadGroup(cmd.Context(), params) + if err != nil { + return err } - res, err := queryClient.GetPolicy(cmd.Context(), params) + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdListGroup() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-group", + Short: "Query list-group", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryListGroupRequest{} + + res, err := queryClient.ListGroup(cmd.Context(), params) if err != nil { return err } @@ -211,10 +259,10 @@ func CmdGetPolicy() *cobra.Command { return cmd } -func CmdVerifyPermission() *cobra.Command { +func CmdHeadGroupMember() *cobra.Command { cmd := &cobra.Command{ - Use: "verify-permission", - Short: "Query verify-permission", + Use: "head-group-member", + Short: "Query head-group-member", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -225,9 +273,9 @@ func CmdVerifyPermission() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryVerifyPermissionRequest{} + params := &types.QueryHeadGroupMemberRequest{} - res, err := queryClient.VerifyPermission(cmd.Context(), params) + res, err := queryClient.HeadGroupMember(cmd.Context(), params) if err != nil { return err } diff --git a/x/storage/client/cli/tx.go b/x/storage/client/cli/tx.go index b605d8623..06cc96fb1 100644 --- a/x/storage/client/cli/tx.go +++ b/x/storage/client/cli/tx.go @@ -1,16 +1,14 @@ package cli import ( - "crypto/sha256" + "encoding/hex" "fmt" - "io" "math" - "net/http" - "os" - "path/filepath" "strconv" + "strings" "time" + gnfderrors "github.com/bnb-chain/greenfield/types/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -41,8 +39,6 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdDeleteBucket()) cmd.AddCommand(CmdUpdateBucketInfo()) cmd.AddCommand(CmdCreateObject()) - cmd.AddCommand(CmdSealObject()) - cmd.AddCommand(CmdRejectSealObject()) cmd.AddCommand(CmdDeleteObject()) cmd.AddCommand(CmdCancelCreateObject()) cmd.AddCommand(CmdCreateGroup()) @@ -90,27 +86,22 @@ func CmdCreateBucket() *cobra.Command { return err } - approver, _ := cmd.Flags().GetString(FlagApprover) - _, approverName, _, err := GetApproverField(clientCtx.Keyring, approver) + approveSignature, _ := cmd.Flags().GetString(FlagApproveSignature) + approveTimeoutHeight, _ := cmd.Flags().GetUint64(FlagApproveTimeoutHeight) + + approveSignatureBytes, err := hex.DecodeString(approveSignature) if err != nil { return err } - msg := types.NewMsgCreateBucket( clientCtx.GetFromAddress(), argBucketName, isPublic, primarySPAcc, paymentAcc, - math.MaxUint, - nil, + approveTimeoutHeight, + approveSignatureBytes, ) - sig, _, err := clientCtx.Keyring.Sign(approverName, msg.GetApprovalBytes()) - if err != nil { - return err - } - - msg.PrimarySpApproval.Sig = sig if err := msg.ValidateBasic(); err != nil { return err } @@ -122,7 +113,8 @@ func CmdCreateBucket() *cobra.Command { cmd.Flags().Bool(FlagPublic, false, "If true(by default), only owner and grantee can access it. Otherwise, every one have permission to access it.") cmd.Flags().String(FlagPaymentAccount, "", "The address of the account used to pay for the read fee. The default is the sender account.") cmd.Flags().String(FlagPrimarySP, "", "The operator account address of primarySp") - cmd.Flags().String(FlagApprover, "", "The approval account address of primarySp") + cmd.Flags().String(FlagApproveSignature, "", "The approval signature of primarySp") + cmd.Flags().Uint64(FlagApproveTimeoutHeight, math.MaxUint, "The approval timeout height of primarySp") flags.AddTxFlagsToCmd(cmd) return cmd @@ -225,58 +217,70 @@ func CmdCancelCreateObject() *cobra.Command { func CmdCreateObject() *cobra.Command { cmd := &cobra.Command{ - Use: "create-object [bucket-name] [object-name]", - Short: "create a new object in the bucket", + Use: "create-object [bucket-name] [object-name] [payload-size] [content-type] [redundancy-type]", + Short: "create a new object in the bucket, checksums split by ','", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { argBucketName := args[0] argObjectName := args[1] - argObjectPath := args[2] + argPayloadSize := args[2] + argContentType := args[3] + + payloadSize, err := strconv.ParseUint(argPayloadSize, 10, 64) if err != nil { return err } - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - // read file - f, err := os.OpenFile(filepath.Clean(argObjectPath), os.O_RDONLY, 0600) + isPublic, _ := cmd.Flags().GetBool(FlagPublic) + + checksums, _ := cmd.Flags().GetString(FlagExpectChecksums) + redundancyTypeFlag, _ := cmd.Flags().GetString(FlagRedundancyType) + approveSignature, _ := cmd.Flags().GetString(FlagApproveSignature) + approveTimeoutHeight, _ := cmd.Flags().GetUint64(FlagApproveTimeoutHeight) + + approveSignatureBytes, err := hex.DecodeString(approveSignature) if err != nil { return err } - // TODO(fynn): calc redundancy hashes. hard code here. - expectChecksum := make([][]byte, 7) - buf, _ := io.ReadAll(f) - h := sha256.New() - h.Write(buf) - sum := h.Sum(nil) - expectChecksum[0] = sum - expectChecksum[1] = sum - expectChecksum[2] = sum - expectChecksum[3] = sum - expectChecksum[4] = sum - expectChecksum[5] = sum - expectChecksum[6] = sum - - contentType := http.DetectContentType(buf) + checksumsStr := strings.Split(checksums, ",") + if checksumsStr == nil { + return gnfderrors.ErrInvalidChecksum + } + var expectChecksums [][]byte + for _, checksum := range checksumsStr { + tmp, err := hex.DecodeString(checksum) + if err != nil { + return err + } + expectChecksums = append(expectChecksums, tmp) + } - isPublic, _ := cmd.Flags().GetBool(FlagPublic) + var redundancyType types.RedundancyType + if redundancyTypeFlag == "EC" { + redundancyType = types.REDUNDANCY_EC_TYPE + } else if redundancyTypeFlag == "Replica" { + redundancyType = types.REDUNDANCY_REPLICA_TYPE + } else { + return types.ErrInvalidRedundancyType + } msg := types.NewMsgCreateObject( clientCtx.GetFromAddress(), argBucketName, argObjectName, - uint64(len(buf)), + payloadSize, isPublic, - expectChecksum, - contentType, - types.REDUNDANCY_EC_TYPE, - math.MaxUint, + expectChecksums, + argContentType, + redundancyType, + approveTimeoutHeight, + approveSignatureBytes, nil, - nil, // NOTE(fynn): Not specified here. ) primarySP, err := cmd.Flags().GetString(FlagPrimarySP) if err != nil { @@ -302,6 +306,10 @@ func CmdCreateObject() *cobra.Command { flags.AddTxFlagsToCmd(cmd) cmd.Flags().Bool(FlagPublic, true, "If true(by default), only owner and grantee can access it. Otherwise, every one have permission to access it.") cmd.Flags().String(FlagPrimarySP, "", "The operator account address of primarySp") + cmd.Flags().String(FlagExpectChecksums, "", "The checksums that calculate by redundancy algorithm") + cmd.Flags().String(FlagRedundancyType, "", "The redundancy type, EC or Replica ") + cmd.Flags().String(FlagApproveSignature, "", "The approval signature of primarySp") + cmd.Flags().Uint64(FlagApproveTimeoutHeight, math.MaxUint, "The approval timeout height of primarySp") return cmd } @@ -321,83 +329,21 @@ func CmdCopyObject() *cobra.Command { return err } + approveSignature, _ := cmd.Flags().GetString(FlagApproveSignature) + approveTimeoutHeight, _ := cmd.Flags().GetUint64(FlagApproveTimeoutHeight) + + approveSignatureBytes, err := hex.DecodeString(approveSignature) + if err != nil { + return err + } msg := types.NewMsgCopyObject( clientCtx.GetFromAddress(), argSrcBucketName, argDstBucketName, argSrcObjectName, argDstObjectName, - math.MaxUint, - nil, // TODO: Refine the cli parameters - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdSealObject() *cobra.Command { - cmd := &cobra.Command{ - Use: "seal-object [bucket-name] [object-name]", - Short: "Seal the object", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - argBucketName := args[0] - argObjectName := args[1] - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - // TODO(fynn): hardcode here, impl after signature ready - spSignatures := make([][]byte, 7) - for i := 0; i < len(spSignatures); i++ { - spSignatures[i] = []byte("for-test") - } - msg := types.NewMsgSealObject( - clientCtx.GetFromAddress(), - argBucketName, - argObjectName, - nil, - spSignatures, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdRejectSealObject() *cobra.Command { - cmd := &cobra.Command{ - Use: "reject-seal-object [bucket-name] [object-name]", - Short: "Reject to seal the object", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - argBucketName := args[0] - argObjectName := args[1] - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgRejectUnsealedObject( - clientCtx.GetFromAddress(), - argBucketName, - argObjectName, + approveTimeoutHeight, + approveSignatureBytes, ) if err := msg.ValidateBasic(); err != nil { return err @@ -407,6 +353,8 @@ func CmdRejectSealObject() *cobra.Command { } flags.AddTxFlagsToCmd(cmd) + cmd.Flags().String(FlagApproveSignature, "", "The approval signature of primarySp") + cmd.Flags().Uint64(FlagApproveTimeoutHeight, math.MaxUint, "The approval timeout height of primarySp") return cmd } @@ -444,21 +392,31 @@ func CmdDeleteObject() *cobra.Command { func CmdCreateGroup() *cobra.Command { cmd := &cobra.Command{ - Use: "create-group [group-name]", - Short: "Create a new group", - Args: cobra.ExactArgs(1), + Use: "create-group [group-name] [member-list]", + Short: "Create a new group with several initial members, split member addresses by ','", + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { argGroupName := args[0] + argMemberList := args[1] clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } + var memberAddrs []sdk.AccAddress + members := strings.Split(argMemberList, ",") + for _, member := range members { + memberAddr, err := sdk.AccAddressFromHexUnsafe(member) + if err != nil { + return err + } + memberAddrs = append(memberAddrs, memberAddr) + } msg := types.NewMsgCreateGroup( clientCtx.GetFromAddress(), argGroupName, - nil, // TODO: Refine the cli parameters + memberAddrs, ) if err := msg.ValidateBasic(); err != nil { return err @@ -503,20 +461,26 @@ func CmdDeleteGroup() *cobra.Command { func CmdLeaveGroup() *cobra.Command { cmd := &cobra.Command{ - Use: "leave-group [group-name]", + Use: "leave-group [group-owner] [group-name]", Short: "Leave the group you're a member of", - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { - argGroupName := args[0] + argGroupOwner := args[0] + argGroupName := args[1] clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } + groupOwner, err := sdk.AccAddressFromHexUnsafe(argGroupOwner) + if err != nil { + return err + } + msg := types.NewMsgLeaveGroup( clientCtx.GetFromAddress(), - sdk.AccAddress{}, // TODO: add group owner acc + groupOwner, argGroupName, ) if err := msg.ValidateBasic(); err != nil { @@ -533,22 +497,41 @@ func CmdLeaveGroup() *cobra.Command { func CmdUpdateGroupMember() *cobra.Command { cmd := &cobra.Command{ - Use: "update-group-member [group-name]", - Short: "Update the member of the group you own", + Use: "update-group-member [group-name] [member-to-add] [member-to-delete]", + Short: "Update the member of the group you own, split member addresses by ,", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { argGroupName := args[0] + argMemberToAdd := args[1] + argMemberToDelete := args[2] clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - + var memberAddrsToAdd []sdk.AccAddress + membersToAdd := strings.Split(argMemberToAdd, ",") + for _, member := range membersToAdd { + memberAddr, err := sdk.AccAddressFromHexUnsafe(member) + if err != nil { + return err + } + memberAddrsToAdd = append(memberAddrsToAdd, memberAddr) + } + var memberAddrsToDelete []sdk.AccAddress + membersToDelete := strings.Split(argMemberToDelete, ",") + for _, member := range membersToDelete { + memberAddr, err := sdk.AccAddressFromHexUnsafe(member) + if err != nil { + return err + } + memberAddrsToDelete = append(memberAddrsToDelete, memberAddr) + } msg := types.NewMsgUpdateGroupMember( clientCtx.GetFromAddress(), argGroupName, - nil, // TODO: Refine the cli parameters - nil, // TODO: Refine the cli parameters + memberAddrsToAdd, + memberAddrsToDelete, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/x/storage/keeper/msg_server.go b/x/storage/keeper/msg_server.go index efc4aa3b4..b809b9b19 100644 --- a/x/storage/keeper/msg_server.go +++ b/x/storage/keeper/msg_server.go @@ -4,10 +4,10 @@ import ( "context" "cosmossdk.io/errors" - gnfderrors "github.com/bnb-chain/greenfield/types/errors" sdk "github.com/cosmos/cosmos-sdk/types" types2 "github.com/bnb-chain/greenfield/types" + gnfderrors "github.com/bnb-chain/greenfield/types/errors" permtypes "github.com/bnb-chain/greenfield/x/permission/types" "github.com/bnb-chain/greenfield/x/storage/types" ) diff --git a/x/storage/keeper/permission.go b/x/storage/keeper/permission.go index d333a4d37..f8bca8775 100644 --- a/x/storage/keeper/permission.go +++ b/x/storage/keeper/permission.go @@ -92,6 +92,61 @@ func (k Keeper) VerifyGroupPermission(ctx sdk.Context, groupInfo *types.GroupInf return permtypes.EFFECT_DENY } +func (k Keeper) GetPolicy(ctx sdk.Context, grn *types2.GRN, principal *permtypes.Principal) (*permtypes.Policy, error) { + var resID math.Uint + switch grn.ResourceType() { + case gnfdresource.RESOURCE_TYPE_BUCKET: + bucketName, grnErr := grn.GetBucketName() + if grnErr != nil { + return nil, grnErr + } + bucketInfo, found := k.GetBucketInfo(ctx, bucketName) + if !found { + return nil, types.ErrNoSuchBucket.Wrapf("bucketName: %s", bucketName) + } + resID = bucketInfo.Id + case gnfdresource.RESOURCE_TYPE_OBJECT: + bucketName, objectName, grnErr := grn.GetBucketAndObjectName() + if grnErr != nil { + return nil, grnErr + } + objectInfo, found := k.GetObjectInfo(ctx, bucketName, objectName) + if !found { + return nil, types.ErrNoSuchObject.Wrapf("BucketName: %s, objectName: %s", bucketName, objectName) + } + + resID = objectInfo.Id + case gnfdresource.RESOURCE_TYPE_GROUP: + groupOwner, groupName, grnErr := grn.GetGroupOwnerAndAccount() + if grnErr != nil { + return nil, grnErr + } + groupInfo, found := k.GetGroupInfo(ctx, groupOwner, groupName) + if !found { + return nil, types.ErrNoSuchBucket.Wrapf("groupOwner: %s, groupName: %s", groupOwner.String(), groupName) + } + resID = groupInfo.Id + default: + return nil, gnfderrors.ErrInvalidGRN.Wrap("Unknown resource type in greenfield resource name") + } + + var policy *permtypes.Policy + var found bool + if principal.Type == permtypes.TYPE_GNFD_ACCOUNT { + policy, found = k.permKeeper.GetPolicyForAccount(ctx, resID, grn.ResourceType(), + principal.MustGetAccountAddress()) + } else if principal.Type == permtypes.TYPE_GNFD_GROUP { + policy, found = k.permKeeper.GetPolicyForGroup(ctx, resID, grn.ResourceType(), principal.MustGetGroupID()) + } else { + return nil, permtypes.ErrInvalidPrincipal + } + + if found { + return nil, types.ErrNoSuchPolicy + } + return policy, nil +} + func (k Keeper) PutPolicy(ctx sdk.Context, operator sdk.AccAddress, grn types2.GRN, policy *permtypes.Policy) (math.Uint, error) { diff --git a/x/storage/keeper/query.go b/x/storage/keeper/query.go index 70af57983..657794590 100644 --- a/x/storage/keeper/query.go +++ b/x/storage/keeper/query.go @@ -5,7 +5,7 @@ import ( "cosmossdk.io/errors" "cosmossdk.io/math" - sdkmath "cosmossdk.io/math" + gnfd "github.com/bnb-chain/greenfield/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -14,6 +14,7 @@ import ( "google.golang.org/grpc/status" "github.com/bnb-chain/greenfield/internal/sequence" + "github.com/bnb-chain/greenfield/types/resource" permtypes "github.com/bnb-chain/greenfield/x/permission/types" "github.com/bnb-chain/greenfield/x/storage/types" ) @@ -101,14 +102,14 @@ func (k Keeper) ListBuckets(goCtx context.Context, req *types.QueryListBucketsRe ctx := sdk.UnwrapSDKContext(goCtx) - var bucketInfos []types.BucketInfo + var bucketInfos []*types.BucketInfo store := ctx.KVStore(k.storeKey) bucketStore := prefix.NewStore(store, types.BucketByIDPrefix) pageRes, err := query.Paginate(bucketStore, req.Pagination, func(key []byte, value []byte) error { var bucketInfo types.BucketInfo k.cdc.MustUnmarshal(value, &bucketInfo) - bucketInfos = append(bucketInfos, bucketInfo) + bucketInfos = append(bucketInfos, &bucketInfo) return nil }) @@ -128,14 +129,14 @@ func (k Keeper) ListObjects(goCtx context.Context, req *types.QueryListObjectsRe } ctx := sdk.UnwrapSDKContext(goCtx) - var objectInfos []types.ObjectInfo + var objectInfos []*types.ObjectInfo store := ctx.KVStore(k.storeKey) objectPrefixStore := prefix.NewStore(store, types.GetObjectKeyOnlyBucketPrefix(req.BucketName)) pageRes, err := query.Paginate(objectPrefixStore, req.Pagination, func(key []byte, value []byte) error { objectInfo, found := k.GetObjectInfoById(ctx, sequence.DecodeSequence(value)) if found { - objectInfos = append(objectInfos, *objectInfo) + objectInfos = append(objectInfos, objectInfo) } return nil }) @@ -156,7 +157,7 @@ func (k Keeper) ListObjectsByBucketId(goCtx context.Context, req *types.QueryLis ctx := sdk.UnwrapSDKContext(goCtx) - var objectInfos []types.ObjectInfo + var objectInfos []*types.ObjectInfo store := ctx.KVStore(k.storeKey) id, err := math.ParseUint(req.BucketId) if err != nil { @@ -171,7 +172,7 @@ func (k Keeper) ListObjectsByBucketId(goCtx context.Context, req *types.QueryLis pageRes, err := query.Paginate(objectPrefixStore, req.Pagination, func(key []byte, value []byte) error { objectInfo, found := k.GetObjectInfoById(ctx, types.DecodeSequence(value)) if found { - objectInfos = append(objectInfos, *objectInfo) + objectInfos = append(objectInfos, objectInfo) } return nil }) @@ -238,7 +239,8 @@ func validateAndGetId(req *types.QueryNFTRequest) (math.Uint, error) { return id, nil } -func (k Keeper) GetPolicy(goCtx context.Context, req *types.QueryGetPolicyRequest) (*types.QueryGetPolicyResponse, +func (k Keeper) QueryPolicyForAccount(goCtx context.Context, req *types.QueryPolicyForAccountRequest) (*types. + QueryPolicyForAccountResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -246,17 +248,48 @@ func (k Keeper) GetPolicy(goCtx context.Context, req *types.QueryGetPolicyReques ctx := sdk.UnwrapSDKContext(goCtx) - id, err := sdkmath.ParseUint(req.PolicyId) + principalAcc, err := sdk.AccAddressFromHexUnsafe(req.PrincipalAddress) if err != nil { + return nil, err + } + var grn gnfd.GRN + err = grn.ParseFromString(req.Resource, false) + if err != nil { + return nil, err + } + + policy, err := k.GetPolicy(ctx, &grn, permtypes.NewPrincipalWithAccount(principalAcc)) + if err != nil { + return nil, types.ErrNoSuchPolicy + } + + return &types.QueryPolicyForAccountResponse{Policy: policy}, nil +} + +func (k Keeper) QueryPolicyForGroup(goCtx context.Context, req *types.QueryPolicyForGroupRequest) (*types. + QueryPolicyForGroupResponse, error) { + if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - policy, found := k.permKeeper.GetPolicyByID(ctx, id) - if !found { - return nil, types.ErrNoSuchPolicy.Wrapf("PolicyID: %s", id.String()) + ctx := sdk.UnwrapSDKContext(goCtx) + + id, err := math.ParseUint(req.PrincipalGroupId) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid group id") + } + + var grn gnfd.GRN + err = grn.ParseFromString(req.Resource, false) + if err != nil { + return nil, err } - return &types.QueryGetPolicyResponse{Policy: policy}, nil + policy, err := k.GetPolicy(ctx, &grn, permtypes.NewPrincipalWithGroup(id)) + if err != nil { + return nil, types.ErrNoSuchPolicy + } + return &types.QueryPolicyForGroupResponse{Policy: policy}, nil } func (k Keeper) VerifyPermission(goCtx context.Context, req *types.QueryVerifyPermissionRequest) (*types.QueryVerifyPermissionResponse, error) { @@ -295,3 +328,81 @@ func (k Keeper) VerifyPermission(goCtx context.Context, req *types.QueryVerifyPe Effect: effect, }, nil } + +func (k Keeper) HeadGroup(goCtx context.Context, req *types.QueryHeadGroupRequest) (*types.QueryHeadGroupResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + owner, err := sdk.AccAddressFromHexUnsafe(req.GroupOwner) + if err != nil { + return nil, err + } + groupInfo, found := k.GetGroupInfo(ctx, owner, req.GroupName) + if !found { + return nil, types.ErrNoSuchGroup + } + return &types.QueryHeadGroupResponse{GroupInfo: groupInfo}, nil +} + +func (k Keeper) ListGroup(goCtx context.Context, req *types.QueryListGroupRequest) (*types.QueryListGroupResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Pagination != nil && req.Pagination.Limit > types.MaxPaginationLimit { + return nil, status.Errorf(codes.InvalidArgument, "exceed pagination limit %d", types.MaxPaginationLimit) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + owner, err := sdk.AccAddressFromHexUnsafe(req.GroupOwner) + if err != nil { + return nil, err + } + + var groupInfos []*types.GroupInfo + store := ctx.KVStore(k.storeKey) + groupStore := prefix.NewStore(store, types.GetGroupKeyOnlyOwnerPrefix(owner)) + + pageRes, err := query.Paginate(groupStore, req.Pagination, func(key []byte, value []byte) error { + var groupInfo types.GroupInfo + k.cdc.MustUnmarshal(value, &groupInfo) + groupInfos = append(groupInfos, &groupInfo) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryListGroupResponse{GroupInfos: groupInfos, Pagination: pageRes}, nil +} + +func (k Keeper) HeadGroupMember(goCtx context.Context, req *types.QueryHeadGroupMemberRequest) (*types.QueryHeadGroupMemberResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + member, err := sdk.AccAddressFromHexUnsafe(req.Member) + if err != nil { + return nil, err + } + owner, err := sdk.AccAddressFromHexUnsafe(req.GroupOwner) + if err != nil { + return nil, err + } + groupInfo, found := k.GetGroupInfo(ctx, owner, req.GroupName) + if !found { + return nil, types.ErrNoSuchGroup + } + policy, found := k.permKeeper.GetPolicyForAccount(ctx, groupInfo.Id, resource.RESOURCE_TYPE_GROUP, member) + if !found || policy.MemberStatement == nil { + return nil, types.ErrNoSuchGroupMember + } + return &types.QueryHeadGroupMemberResponse{GroupInfo: groupInfo}, nil +} diff --git a/x/storage/types/errors.go b/x/storage/types/errors.go index 774f22d7f..4e6bdcc78 100644 --- a/x/storage/types/errors.go +++ b/x/storage/types/errors.go @@ -9,21 +9,23 @@ var ( ErrNoSuchBucket = errors.Register(ModuleName, 1100, "No such bucket") ErrNoSuchObject = errors.Register(ModuleName, 1101, "No such object") ErrNoSuchGroup = errors.Register(ModuleName, 1102, "No such group") - ErrBucketAlreadyExists = errors.Register(ModuleName, 1103, "Bucket already exists") - ErrObjectAlreadyExists = errors.Register(ModuleName, 1104, "Object already exists") - ErrGroupAlreadyExists = errors.Register(ModuleName, 1105, "Group already exists") - ErrAccessDenied = errors.Register(ModuleName, 1106, "Access denied") - ErrObjectAlreadySealed = errors.Register(ModuleName, 1107, "Object already sealed") - ErrBucketNotEmpty = errors.Register(ModuleName, 1108, "Bucket is not empty") + ErrNoSuchGroupMember = errors.Register(ModuleName, 1103, "No such group member") + ErrBucketAlreadyExists = errors.Register(ModuleName, 1104, "Bucket already exists") + ErrObjectAlreadyExists = errors.Register(ModuleName, 1105, "Object already exists") + ErrGroupAlreadyExists = errors.Register(ModuleName, 1106, "Group already exists") + ErrAccessDenied = errors.Register(ModuleName, 1107, "Access denied") + ErrObjectAlreadySealed = errors.Register(ModuleName, 1108, "Object already sealed") + ErrBucketNotEmpty = errors.Register(ModuleName, 1109, "Bucket is not empty") ErrGroupMemberAlreadyExists = errors.Register(ModuleName, 1110, "Group member already exists") - ErrNoSuchStorageProvider = errors.Register(ModuleName, 1112, "No such storage provider") - ErrObjectNotInit = errors.Register(ModuleName, 1114, "Not a INIT object") - ErrObjectNotInService = errors.Register(ModuleName, 1115, "Object not in service") - ErrSourceTypeMismatch = errors.Register(ModuleName, 1116, "Object source type mismatch") - ErrTooLargeObject = errors.Register(ModuleName, 1117, "Object payload size is too large") - ErrInvalidApproval = errors.Register(ModuleName, 1118, "Invalid approval of sp") - ErrBucketBillNotEmpty = errors.Register(ModuleName, 1119, "bucket bill is not empty") + ErrNoSuchStorageProvider = errors.Register(ModuleName, 1111, "No such storage provider") + ErrObjectNotInit = errors.Register(ModuleName, 1112, "Not a INIT object") + ErrObjectNotInService = errors.Register(ModuleName, 1113, "Object not in service") + ErrSourceTypeMismatch = errors.Register(ModuleName, 1114, "Object source type mismatch") + ErrTooLargeObject = errors.Register(ModuleName, 1115, "Object payload size is too large") + ErrInvalidApproval = errors.Register(ModuleName, 1116, "Invalid approval of sp") + ErrBucketBillNotEmpty = errors.Register(ModuleName, 1117, "bucket bill is not empty") - ErrNoSuchPolicy = errors.Register(ModuleName, 1120, "No such Policy") - ErrInvalidParameter = errors.Register(ModuleName, 1121, "Invalid parameter") + ErrNoSuchPolicy = errors.Register(ModuleName, 1120, "No such Policy") + ErrInvalidParameter = errors.Register(ModuleName, 1121, "Invalid parameter") + ErrInvalidRedundancyType = errors.Register(ModuleName, 1122, "Invalid redundancy type") ) diff --git a/x/storage/types/expected_keepers.go b/x/storage/types/expected_keepers.go index 2a148ec0d..ff767a15d 100644 --- a/x/storage/types/expected_keepers.go +++ b/x/storage/types/expected_keepers.go @@ -42,9 +42,11 @@ type PermissionKeeper interface { DeletePolicy(ctx sdk.Context, principal *permtypes.Principal, resourceType resource.ResourceType, resourceID math.Uint) (math.Uint, error) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, operator sdk.AccAddress, - action permtypes.ActionType, - resource *string) permtypes.Effect + action permtypes.ActionType, resource *string) permtypes.Effect AddGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) error RemoveGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) GetPolicyByID(ctx sdk.Context, policyID math.Uint) (*permtypes.Policy, bool) + GetPolicyForAccount(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) (policy *permtypes.Policy, isFound bool) + GetPolicyForGroup(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, + groupID math.Uint) (policy *permtypes.Policy, isFound bool) } diff --git a/x/storage/types/keys.go b/x/storage/types/keys.go index 142ed85c3..6af67c2fe 100644 --- a/x/storage/types/keys.go +++ b/x/storage/types/keys.go @@ -60,6 +60,11 @@ func GetGroupKey(owner sdk.AccAddress, groupName string) []byte { return append(GroupPrefix, append(owner.Bytes(), groupNameHash...)...) } +// GetGroupKeyOnlyOwnerPrefix return the group name store key +func GetGroupKeyOnlyOwnerPrefix(owner sdk.AccAddress) []byte { + return append(GroupPrefix, owner.Bytes()...) +} + // GetBucketByIDKey return the bucketID store key func GetBucketByIDKey(bucketId math.Uint) []byte { return append(BucketByIDPrefix, sequence.EncodeSequence(bucketId)...) diff --git a/x/storage/types/query.pb.go b/x/storage/types/query.pb.go index 84ef16f7c..8e0e3710e 100644 --- a/x/storage/types/query.pb.go +++ b/x/storage/types/query.pb.go @@ -433,7 +433,7 @@ func (m *QueryListBucketsRequest) GetPagination() *query.PageRequest { } type QueryListBucketsResponse struct { - BucketInfos []BucketInfo `protobuf:"bytes,1,rep,name=bucket_infos,json=bucketInfos,proto3" json:"bucket_infos"` + BucketInfos []*BucketInfo `protobuf:"bytes,1,rep,name=bucket_infos,json=bucketInfos,proto3" json:"bucket_infos,omitempty"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -470,7 +470,7 @@ func (m *QueryListBucketsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryListBucketsResponse proto.InternalMessageInfo -func (m *QueryListBucketsResponse) GetBucketInfos() []BucketInfo { +func (m *QueryListBucketsResponse) GetBucketInfos() []*BucketInfo { if m != nil { return m.BucketInfos } @@ -589,7 +589,7 @@ func (m *QueryListObjectsByBucketIdRequest) GetBucketId() string { } type QueryListObjectsResponse struct { - ObjectInfos []ObjectInfo `protobuf:"bytes,1,rep,name=object_infos,json=objectInfos,proto3" json:"object_infos"` + ObjectInfos []*ObjectInfo `protobuf:"bytes,1,rep,name=object_infos,json=objectInfos,proto3" json:"object_infos,omitempty"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -626,7 +626,7 @@ func (m *QueryListObjectsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryListObjectsResponse proto.InternalMessageInfo -func (m *QueryListObjectsResponse) GetObjectInfos() []ObjectInfo { +func (m *QueryListObjectsResponse) GetObjectInfos() []*ObjectInfo { if m != nil { return m.ObjectInfos } @@ -816,22 +816,23 @@ func (m *QueryGroupNFTResponse) GetMetaData() *GroupMetaData { return nil } -type QueryGetPolicyRequest struct { - PolicyId string `protobuf:"bytes,1,opt,name=policy_id,json=policyId,proto3" json:"policy_id,omitempty"` +type QueryPolicyForAccountRequest struct { + Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + PrincipalAddress string `protobuf:"bytes,2,opt,name=principal_address,json=principalAddress,proto3" json:"principal_address,omitempty"` } -func (m *QueryGetPolicyRequest) Reset() { *m = QueryGetPolicyRequest{} } -func (m *QueryGetPolicyRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetPolicyRequest) ProtoMessage() {} -func (*QueryGetPolicyRequest) Descriptor() ([]byte, []int) { +func (m *QueryPolicyForAccountRequest) Reset() { *m = QueryPolicyForAccountRequest{} } +func (m *QueryPolicyForAccountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPolicyForAccountRequest) ProtoMessage() {} +func (*QueryPolicyForAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_b1b80b580af04cb0, []int{17} } -func (m *QueryGetPolicyRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryPolicyForAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPolicyForAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetPolicyRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPolicyForAccountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -841,41 +842,48 @@ func (m *QueryGetPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryGetPolicyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetPolicyRequest.Merge(m, src) +func (m *QueryPolicyForAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPolicyForAccountRequest.Merge(m, src) } -func (m *QueryGetPolicyRequest) XXX_Size() int { +func (m *QueryPolicyForAccountRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetPolicyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetPolicyRequest.DiscardUnknown(m) +func (m *QueryPolicyForAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPolicyForAccountRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetPolicyRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryPolicyForAccountRequest proto.InternalMessageInfo -func (m *QueryGetPolicyRequest) GetPolicyId() string { +func (m *QueryPolicyForAccountRequest) GetResource() string { if m != nil { - return m.PolicyId + return m.Resource } return "" } -type QueryGetPolicyResponse struct { +func (m *QueryPolicyForAccountRequest) GetPrincipalAddress() string { + if m != nil { + return m.PrincipalAddress + } + return "" +} + +type QueryPolicyForAccountResponse struct { Policy *types.Policy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` } -func (m *QueryGetPolicyResponse) Reset() { *m = QueryGetPolicyResponse{} } -func (m *QueryGetPolicyResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetPolicyResponse) ProtoMessage() {} -func (*QueryGetPolicyResponse) Descriptor() ([]byte, []int) { +func (m *QueryPolicyForAccountResponse) Reset() { *m = QueryPolicyForAccountResponse{} } +func (m *QueryPolicyForAccountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPolicyForAccountResponse) ProtoMessage() {} +func (*QueryPolicyForAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_b1b80b580af04cb0, []int{18} } -func (m *QueryGetPolicyResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryPolicyForAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetPolicyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPolicyForAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetPolicyResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPolicyForAccountResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -885,19 +893,19 @@ func (m *QueryGetPolicyResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryGetPolicyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetPolicyResponse.Merge(m, src) +func (m *QueryPolicyForAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPolicyForAccountResponse.Merge(m, src) } -func (m *QueryGetPolicyResponse) XXX_Size() int { +func (m *QueryPolicyForAccountResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetPolicyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetPolicyResponse.DiscardUnknown(m) +func (m *QueryPolicyForAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPolicyForAccountResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetPolicyResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryPolicyForAccountResponse proto.InternalMessageInfo -func (m *QueryGetPolicyResponse) GetPolicy() *types.Policy { +func (m *QueryPolicyForAccountResponse) GetPolicy() *types.Policy { if m != nil { return m.Policy } @@ -1016,6 +1024,406 @@ func (m *QueryVerifyPermissionResponse) GetEffect() types.Effect { return types.EFFECT_ALLOW } +type QueryHeadGroupRequest struct { + GroupOwner string `protobuf:"bytes,1,opt,name=group_owner,json=groupOwner,proto3" json:"group_owner,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (m *QueryHeadGroupRequest) Reset() { *m = QueryHeadGroupRequest{} } +func (m *QueryHeadGroupRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHeadGroupRequest) ProtoMessage() {} +func (*QueryHeadGroupRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{21} +} +func (m *QueryHeadGroupRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHeadGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHeadGroupRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryHeadGroupRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHeadGroupRequest.Merge(m, src) +} +func (m *QueryHeadGroupRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryHeadGroupRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHeadGroupRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHeadGroupRequest proto.InternalMessageInfo + +func (m *QueryHeadGroupRequest) GetGroupOwner() string { + if m != nil { + return m.GroupOwner + } + return "" +} + +func (m *QueryHeadGroupRequest) GetGroupName() string { + if m != nil { + return m.GroupName + } + return "" +} + +type QueryHeadGroupResponse struct { + GroupInfo *GroupInfo `protobuf:"bytes,1,opt,name=group_info,json=groupInfo,proto3" json:"group_info,omitempty"` +} + +func (m *QueryHeadGroupResponse) Reset() { *m = QueryHeadGroupResponse{} } +func (m *QueryHeadGroupResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHeadGroupResponse) ProtoMessage() {} +func (*QueryHeadGroupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{22} +} +func (m *QueryHeadGroupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHeadGroupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHeadGroupResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryHeadGroupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHeadGroupResponse.Merge(m, src) +} +func (m *QueryHeadGroupResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryHeadGroupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHeadGroupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHeadGroupResponse proto.InternalMessageInfo + +func (m *QueryHeadGroupResponse) GetGroupInfo() *GroupInfo { + if m != nil { + return m.GroupInfo + } + return nil +} + +type QueryListGroupRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + GroupOwner string `protobuf:"bytes,2,opt,name=group_owner,json=groupOwner,proto3" json:"group_owner,omitempty"` +} + +func (m *QueryListGroupRequest) Reset() { *m = QueryListGroupRequest{} } +func (m *QueryListGroupRequest) String() string { return proto.CompactTextString(m) } +func (*QueryListGroupRequest) ProtoMessage() {} +func (*QueryListGroupRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{23} +} +func (m *QueryListGroupRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListGroupRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryListGroupRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListGroupRequest.Merge(m, src) +} +func (m *QueryListGroupRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryListGroupRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListGroupRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListGroupRequest proto.InternalMessageInfo + +func (m *QueryListGroupRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryListGroupRequest) GetGroupOwner() string { + if m != nil { + return m.GroupOwner + } + return "" +} + +type QueryListGroupResponse struct { + Pagination *query.PageResponse `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + GroupInfos []*GroupInfo `protobuf:"bytes,2,rep,name=group_infos,json=groupInfos,proto3" json:"group_infos,omitempty"` +} + +func (m *QueryListGroupResponse) Reset() { *m = QueryListGroupResponse{} } +func (m *QueryListGroupResponse) String() string { return proto.CompactTextString(m) } +func (*QueryListGroupResponse) ProtoMessage() {} +func (*QueryListGroupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{24} +} +func (m *QueryListGroupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListGroupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListGroupResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryListGroupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListGroupResponse.Merge(m, src) +} +func (m *QueryListGroupResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryListGroupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListGroupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListGroupResponse proto.InternalMessageInfo + +func (m *QueryListGroupResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryListGroupResponse) GetGroupInfos() []*GroupInfo { + if m != nil { + return m.GroupInfos + } + return nil +} + +type QueryHeadGroupMemberRequest struct { + Member string `protobuf:"bytes,1,opt,name=member,proto3" json:"member,omitempty"` + GroupOwner string `protobuf:"bytes,2,opt,name=group_owner,json=groupOwner,proto3" json:"group_owner,omitempty"` + GroupName string `protobuf:"bytes,3,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (m *QueryHeadGroupMemberRequest) Reset() { *m = QueryHeadGroupMemberRequest{} } +func (m *QueryHeadGroupMemberRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHeadGroupMemberRequest) ProtoMessage() {} +func (*QueryHeadGroupMemberRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{25} +} +func (m *QueryHeadGroupMemberRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHeadGroupMemberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHeadGroupMemberRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryHeadGroupMemberRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHeadGroupMemberRequest.Merge(m, src) +} +func (m *QueryHeadGroupMemberRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryHeadGroupMemberRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHeadGroupMemberRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHeadGroupMemberRequest proto.InternalMessageInfo + +func (m *QueryHeadGroupMemberRequest) GetMember() string { + if m != nil { + return m.Member + } + return "" +} + +func (m *QueryHeadGroupMemberRequest) GetGroupOwner() string { + if m != nil { + return m.GroupOwner + } + return "" +} + +func (m *QueryHeadGroupMemberRequest) GetGroupName() string { + if m != nil { + return m.GroupName + } + return "" +} + +type QueryHeadGroupMemberResponse struct { + GroupInfo *GroupInfo `protobuf:"bytes,1,opt,name=group_info,json=groupInfo,proto3" json:"group_info,omitempty"` +} + +func (m *QueryHeadGroupMemberResponse) Reset() { *m = QueryHeadGroupMemberResponse{} } +func (m *QueryHeadGroupMemberResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHeadGroupMemberResponse) ProtoMessage() {} +func (*QueryHeadGroupMemberResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{26} +} +func (m *QueryHeadGroupMemberResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHeadGroupMemberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHeadGroupMemberResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryHeadGroupMemberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHeadGroupMemberResponse.Merge(m, src) +} +func (m *QueryHeadGroupMemberResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryHeadGroupMemberResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHeadGroupMemberResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHeadGroupMemberResponse proto.InternalMessageInfo + +func (m *QueryHeadGroupMemberResponse) GetGroupInfo() *GroupInfo { + if m != nil { + return m.GroupInfo + } + return nil +} + +type QueryPolicyForGroupRequest struct { + Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + PrincipalGroupId string `protobuf:"bytes,2,opt,name=principal_group_id,json=principalGroupId,proto3" json:"principal_group_id,omitempty"` +} + +func (m *QueryPolicyForGroupRequest) Reset() { *m = QueryPolicyForGroupRequest{} } +func (m *QueryPolicyForGroupRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPolicyForGroupRequest) ProtoMessage() {} +func (*QueryPolicyForGroupRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{27} +} +func (m *QueryPolicyForGroupRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPolicyForGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPolicyForGroupRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPolicyForGroupRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPolicyForGroupRequest.Merge(m, src) +} +func (m *QueryPolicyForGroupRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPolicyForGroupRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPolicyForGroupRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPolicyForGroupRequest proto.InternalMessageInfo + +func (m *QueryPolicyForGroupRequest) GetResource() string { + if m != nil { + return m.Resource + } + return "" +} + +func (m *QueryPolicyForGroupRequest) GetPrincipalGroupId() string { + if m != nil { + return m.PrincipalGroupId + } + return "" +} + +type QueryPolicyForGroupResponse struct { + Policy *types.Policy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` +} + +func (m *QueryPolicyForGroupResponse) Reset() { *m = QueryPolicyForGroupResponse{} } +func (m *QueryPolicyForGroupResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPolicyForGroupResponse) ProtoMessage() {} +func (*QueryPolicyForGroupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b1b80b580af04cb0, []int{28} +} +func (m *QueryPolicyForGroupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPolicyForGroupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPolicyForGroupResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPolicyForGroupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPolicyForGroupResponse.Merge(m, src) +} +func (m *QueryPolicyForGroupResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPolicyForGroupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPolicyForGroupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPolicyForGroupResponse proto.InternalMessageInfo + +func (m *QueryPolicyForGroupResponse) GetPolicy() *types.Policy { + if m != nil { + return m.Policy + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "bnbchain.greenfield.storage.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "bnbchain.greenfield.storage.QueryParamsResponse") @@ -1034,96 +1442,126 @@ func init() { proto.RegisterType((*QueryBucketNFTResponse)(nil), "bnbchain.greenfield.storage.QueryBucketNFTResponse") proto.RegisterType((*QueryObjectNFTResponse)(nil), "bnbchain.greenfield.storage.QueryObjectNFTResponse") proto.RegisterType((*QueryGroupNFTResponse)(nil), "bnbchain.greenfield.storage.QueryGroupNFTResponse") - proto.RegisterType((*QueryGetPolicyRequest)(nil), "bnbchain.greenfield.storage.QueryGetPolicyRequest") - proto.RegisterType((*QueryGetPolicyResponse)(nil), "bnbchain.greenfield.storage.QueryGetPolicyResponse") + proto.RegisterType((*QueryPolicyForAccountRequest)(nil), "bnbchain.greenfield.storage.QueryPolicyForAccountRequest") + proto.RegisterType((*QueryPolicyForAccountResponse)(nil), "bnbchain.greenfield.storage.QueryPolicyForAccountResponse") proto.RegisterType((*QueryVerifyPermissionRequest)(nil), "bnbchain.greenfield.storage.QueryVerifyPermissionRequest") proto.RegisterType((*QueryVerifyPermissionResponse)(nil), "bnbchain.greenfield.storage.QueryVerifyPermissionResponse") + proto.RegisterType((*QueryHeadGroupRequest)(nil), "bnbchain.greenfield.storage.QueryHeadGroupRequest") + proto.RegisterType((*QueryHeadGroupResponse)(nil), "bnbchain.greenfield.storage.QueryHeadGroupResponse") + proto.RegisterType((*QueryListGroupRequest)(nil), "bnbchain.greenfield.storage.QueryListGroupRequest") + proto.RegisterType((*QueryListGroupResponse)(nil), "bnbchain.greenfield.storage.QueryListGroupResponse") + proto.RegisterType((*QueryHeadGroupMemberRequest)(nil), "bnbchain.greenfield.storage.QueryHeadGroupMemberRequest") + proto.RegisterType((*QueryHeadGroupMemberResponse)(nil), "bnbchain.greenfield.storage.QueryHeadGroupMemberResponse") + proto.RegisterType((*QueryPolicyForGroupRequest)(nil), "bnbchain.greenfield.storage.QueryPolicyForGroupRequest") + proto.RegisterType((*QueryPolicyForGroupResponse)(nil), "bnbchain.greenfield.storage.QueryPolicyForGroupResponse") } func init() { proto.RegisterFile("greenfield/storage/query.proto", fileDescriptor_b1b80b580af04cb0) } var fileDescriptor_b1b80b580af04cb0 = []byte{ - // 1265 bytes of a gzipped FileDescriptorProto - 0x1f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9c, - 0x42, 0x3c, 0x65, 0x6b, 0x15, 0xae, 0x27, 0x37, 0x65, 0xe5, 0xd7, 0x19, 0xdf, 0x1b, 0x50, 0x29, - 0xe3, 0xeb, 0x74, 0xa8, 0xda, 0x0b, 0xa7, 0x78, 0x1f, 0xfe, 0x26, 0xa4, 0xc1, 0x07, 0x62, 0x55, - 0x69, 0xa4, 0xec, 0x5e, 0xd5, 0x0a, 0xa7, 0xcd, 0x98, 0xfc, 0x36, 0x63, 0xfc, 0x16, 0xbc, 0x35, - 0x90, 0x31, 0x9f, 0x05, 0x69, 0x69, 0xa8, 0xbd, 0xc4, 0xd0, 0x88, 0x85, 0x12, 0x7b, 0xc4, 0xaa, - 0x42, 0xc9, 0xb9, 0xca, 0x33, 0xa6, 0x51, 0x2e, 0x14, 0x41, 0x58, 0x08, 0x25, 0x32, 0xae, 0xb1, - 0x50, 0xa2, 0xf7, 0xec, 0xfc, 0x85, 0x92, 0x7b, 0x2a, 0x2b, 0x08, 0x25, 0x2c, 0x70, 0x5a, 0x28, - 0xdf, 0x4a, 0x60, 0x3a, 0xe1, 0x44, 0x61, 0x85, 0x6a, 0xe5, 0xcd, 0x71, 0xed, 0xe6, 0x88, 0x28, - 0x41, 0x7a, 0x91, 0x91, 0x96, 0xe1, 0x42, 0x11, 0xe9, 0x23, 0xcb, 0xa7, 0x42, 0xdd, 0x3e, 0xfc, - 0x49, 0xd0, 0x14, 0x46, 0xab, 0x2a, 0xcd, 0xb4, 0x4f, 0xad, 0x4a, 0x33, 0xe3, 0xe6, 0x86, 0xd7, - 0x96, 0xd1, 0xe4, 0xb5, 0xf5, 0x33, 0xe3, 0xee, 0x77, 0x09, 0x5c, 0x29, 0x34, 0xaa, 0xf0, 0xf6, - 0x48, 0x44, 0x72, 0x0e, 0xf7, 0xac, 0x89, 0x6c, 0xb1, 0x44, 0x6e, 0xc1, 0xcd, 0xb2, 0x44, 0x02, - 0x55, 0x47, 0xa3, 0x2f, 0x35, 0x05, 0xbf, 0x93, 0xc0, 0xa5, 0x40, 0xdc, 0xa1, 0x91, 0x1a, 0x51, - 0xdb, 0x6b, 0xe5, 0xbb, 0xb3, 0x16, 0xad, 0xc2, 0x63, 0x63, 0x06, 0x90, 0xac, 0xb2, 0xbf, 0x97, - 0xc0, 0x54, 0x64, 0xab, 0x60, 0x95, 0xc0, 0x19, 0xe7, 0x56, 0xa5, 0x11, 0x73, 0xbe, 0x4d, 0x5e, - 0x63, 0x6c, 0x97, 0xe1, 0x52, 0x11, 0x5b, 0x13, 0xd3, 0x36, 0xf7, 0x67, 0x6a, 0x2f, 0x32, 0x85, - 0x7d, 0xf8, 0xaf, 0x04, 0x9e, 0xcb, 0x3a, 0x18, 0xb8, 0x59, 0x1e, 0x7d, 0x80, 0xb5, 0xab, 0xbd, - 0x79, 0x16, 0xa8, 0xe0, 0xaf, 0x31, 0xfe, 0x9f, 0xc2, 0x83, 0x22, 0xfe, 0x0f, 0x18, 0xaa, 0x9d, - 0xf8, 0x15, 0xa7, 0x17, 0x3a, 0xc3, 0xfe, 0xb0, 0x81, 0xae, 0xf6, 0x12, 0x96, 0xaf, 0xdf, 0x68, - 0x3e, 0x3a, 0xa9, 0x4b, 0x8f, 0x4f, 0xea, 0xd2, 0xdf, 0x27, 0x75, 0xe9, 0xeb, 0xd3, 0xfa, 0xd8, - 0xe3, 0xd3, 0xfa, 0xd8, 0x9f, 0xa7, 0xf5, 0xb1, 0x03, 0xd5, 0xb4, 0xe8, 0xe1, 0xb1, 0xa6, 0xe8, - 0xc4, 0x56, 0x35, 0x47, 0x5b, 0x61, 0x49, 0x24, 0x99, 0x7c, 0x91, 0xfe, 0xf9, 0x47, 0x9b, 0x60, - 0xbf, 0xff, 0xac, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xf0, 0xb3, 0x8b, 0x41, 0x13, 0x00, - 0x00, + // 1622 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcf, 0x8f, 0x14, 0xc5, + 0x17, 0xdf, 0x1e, 0xf8, 0xee, 0x77, 0xb7, 0x06, 0x01, 0x4b, 0xd0, 0x65, 0x80, 0x01, 0xda, 0x04, + 0x37, 0x08, 0xd3, 0xfb, 0x03, 0x84, 0x91, 0x48, 0xb2, 0xab, 0xbb, 0xcb, 0xaa, 0x2c, 0xeb, 0x48, + 0x88, 0x21, 0x9a, 0xb6, 0xba, 0xbb, 0x66, 0x68, 0xd9, 0xe9, 0x1a, 0xba, 0x7b, 0xd0, 0xc9, 0x64, + 0x0e, 0x72, 0xf2, 0x86, 0x89, 0x37, 0xcf, 0x46, 0x23, 0x07, 0x4d, 0x8c, 0x89, 0x89, 0x31, 0xf1, + 0xca, 0x11, 0xf5, 0xe2, 0x45, 0x43, 0x76, 0xbd, 0xfa, 0x3f, 0x98, 0xa9, 0x7a, 0xfd, 0xbb, 0x67, + 0xba, 0x67, 0x99, 0x5b, 0x57, 0x6d, 0xbd, 0x7a, 0x9f, 0xcf, 0xab, 0xf7, 0x5e, 0xd5, 0x67, 0x07, + 0x95, 0x1b, 0x36, 0xa5, 0x56, 0xdd, 0xa4, 0x5b, 0x86, 0xe2, 0xb8, 0xcc, 0x26, 0x0d, 0xaa, 0xdc, + 0x6d, 0x53, 0xbb, 0x53, 0x69, 0xd9, 0xcc, 0x65, 0xf8, 0xa8, 0x66, 0x69, 0xfa, 0x6d, 0x62, 0x5a, + 0x95, 0x60, 0x61, 0x05, 0x16, 0x96, 0xce, 0xe8, 0xcc, 0x69, 0x32, 0x47, 0xd1, 0x88, 0x03, 0x56, + 0xca, 0xbd, 0x79, 0x8d, 0xba, 0x64, 0x5e, 0x69, 0x91, 0x86, 0x69, 0x11, 0xd7, 0x64, 0x96, 0xd8, + 0xa8, 0x74, 0x44, 0xac, 0x55, 0xf9, 0x48, 0x11, 0x03, 0xf8, 0xd3, 0xa1, 0x06, 0x6b, 0x30, 0x31, + 0xdf, 0xff, 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, 0x2c, 0x0f, + 0xf2, 0x84, 0x4c, 0x92, 0xe7, 0x38, 0xf2, 0x33, 0x78, 0x56, 0xd1, 0x2c, 0xed, 0x1c, 0xb7, 0x1e, + 0x58, 0xf7, 0x1c, 0x2e, 0xfe, 0x55, 0x42, 0x07, 0x62, 0xb2, 0x00, 0x5f, 0x1a, 0x21, 0x68, 0x11, + 0xd1, 0x53, 0xaa, 0xee, 0xc2, 0x12, 0xa0, 0x5f, 0xe4, 0xd0, 0xe7, 0xb1, 0x32, 0x1c, 0x7a, 0xa8, + 0xf8, 0x41, 0x36, 0x3d, 0x91, 0xbc, 0xdf, 0x0c, 0x22, 0x72, 0x20, 0xcf, 0xeb, 0x21, 0x55, 0xa8, + 0x94, 0x2e, 0x8d, 0x6e, 0x08, 0x1c, 0x6e, 0x72, 0x0e, 0x9b, 0x78, 0x63, 0x38, 0x87, 0x50, 0xe1, + 0x43, 0x22, 0xa5, 0x96, 0xbd, 0xa7, 0x83, 0x7a, 0xcb, 0xeb, 0x8f, 0xb6, 0xcb, 0xd2, 0xe3, 0xed, + 0xb2, 0xf4, 0x64, 0xbb, 0x2c, 0x7d, 0xbe, 0x53, 0x9e, 0x78, 0xbc, 0x53, 0x9e, 0xf8, 0x73, 0xa7, + 0x3c, 0x71, 0x4b, 0x69, 0x98, 0xee, 0xed, 0xb6, 0x56, 0xd1, 0x59, 0x33, 0xdd, 0xe7, 0x27, 0xd1, + 0x1f, 0x5f, 0xb4, 0x49, 0xfe, 0xeb, 0xcb, 0xe2, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x27, 0x62, + 0x05, 0x3e, 0xbf, 0x1a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1148,7 +1586,7 @@ type QueryClient interface { HeadBucketNFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryBucketNFTResponse, error) // Queries a object with specify name. HeadObject(ctx context.Context, in *QueryHeadObjectRequest, opts ...grpc.CallOption) (*QueryHeadObjectResponse, error) - // Queries a object by id + // Queries an object by id HeadObjectById(ctx context.Context, in *QueryHeadObjectByIdRequest, opts ...grpc.CallOption) (*QueryHeadObjectResponse, error) // Queries a object with EIP712 standard metadata info HeadObjectNFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryObjectNFTResponse, error) @@ -1160,10 +1598,18 @@ type QueryClient interface { ListObjectsByBucketId(ctx context.Context, in *QueryListObjectsByBucketIdRequest, opts ...grpc.CallOption) (*QueryListObjectsResponse, error) // Queries a group with EIP712 standard metadata info HeadGroupNFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryGroupNFTResponse, error) - // Queries policy by policyID - GetPolicy(ctx context.Context, in *QueryGetPolicyRequest, opts ...grpc.CallOption) (*QueryGetPolicyResponse, error) + // Queries a policy which grants permission to account + QueryPolicyForAccount(ctx context.Context, in *QueryPolicyForAccountRequest, opts ...grpc.CallOption) (*QueryPolicyForAccountResponse, error) // Queries a list of VerifyPermission items. VerifyPermission(ctx context.Context, in *QueryVerifyPermissionRequest, opts ...grpc.CallOption) (*QueryVerifyPermissionResponse, error) + // Queries a group with specify owner and name . + HeadGroup(ctx context.Context, in *QueryHeadGroupRequest, opts ...grpc.CallOption) (*QueryHeadGroupResponse, error) + // Queries a list of ListGroup items. + ListGroup(ctx context.Context, in *QueryListGroupRequest, opts ...grpc.CallOption) (*QueryListGroupResponse, error) + // Queries a list of HeadGroupMember items. + HeadGroupMember(ctx context.Context, in *QueryHeadGroupMemberRequest, opts ...grpc.CallOption) (*QueryHeadGroupMemberResponse, error) + // Queries a policy that grants permission to a group + QueryPolicyForGroup(ctx context.Context, in *QueryPolicyForGroupRequest, opts ...grpc.CallOption) (*QueryPolicyForGroupResponse, error) } type queryClient struct { @@ -1273,9 +1719,9 @@ func (c *queryClient) HeadGroupNFT(ctx context.Context, in *QueryNFTRequest, opt return out, nil } -func (c *queryClient) GetPolicy(ctx context.Context, in *QueryGetPolicyRequest, opts ...grpc.CallOption) (*QueryGetPolicyResponse, error) { - out := new(QueryGetPolicyResponse) - err := c.cc.Invoke(ctx, "/bnbchain.greenfield.storage.Query/GetPolicy", in, out, opts...) +func (c *queryClient) QueryPolicyForAccount(ctx context.Context, in *QueryPolicyForAccountRequest, opts ...grpc.CallOption) (*QueryPolicyForAccountResponse, error) { + out := new(QueryPolicyForAccountResponse) + err := c.cc.Invoke(ctx, "/bnbchain.greenfield.storage.Query/QueryPolicyForAccount", in, out, opts...) if err != nil { return nil, err } @@ -1291,19 +1737,55 @@ func (c *queryClient) VerifyPermission(ctx context.Context, in *QueryVerifyPermi return out, nil } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a bucket with specify name. - HeadBucket(context.Context, *QueryHeadBucketRequest) (*QueryHeadBucketResponse, error) - // Queries a bucket by id - HeadBucketById(context.Context, *QueryHeadBucketByIdRequest) (*QueryHeadBucketResponse, error) +func (c *queryClient) HeadGroup(ctx context.Context, in *QueryHeadGroupRequest, opts ...grpc.CallOption) (*QueryHeadGroupResponse, error) { + out := new(QueryHeadGroupResponse) + err := c.cc.Invoke(ctx, "/bnbchain.greenfield.storage.Query/HeadGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ListGroup(ctx context.Context, in *QueryListGroupRequest, opts ...grpc.CallOption) (*QueryListGroupResponse, error) { + out := new(QueryListGroupResponse) + err := c.cc.Invoke(ctx, "/bnbchain.greenfield.storage.Query/ListGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) HeadGroupMember(ctx context.Context, in *QueryHeadGroupMemberRequest, opts ...grpc.CallOption) (*QueryHeadGroupMemberResponse, error) { + out := new(QueryHeadGroupMemberResponse) + err := c.cc.Invoke(ctx, "/bnbchain.greenfield.storage.Query/HeadGroupMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryPolicyForGroup(ctx context.Context, in *QueryPolicyForGroupRequest, opts ...grpc.CallOption) (*QueryPolicyForGroupResponse, error) { + out := new(QueryPolicyForGroupResponse) + err := c.cc.Invoke(ctx, "/bnbchain.greenfield.storage.Query/QueryPolicyForGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a bucket with specify name. + HeadBucket(context.Context, *QueryHeadBucketRequest) (*QueryHeadBucketResponse, error) + // Queries a bucket by id + HeadBucketById(context.Context, *QueryHeadBucketByIdRequest) (*QueryHeadBucketResponse, error) // Queries a bucket with EIP712 standard metadata info HeadBucketNFT(context.Context, *QueryNFTRequest) (*QueryBucketNFTResponse, error) // Queries a object with specify name. HeadObject(context.Context, *QueryHeadObjectRequest) (*QueryHeadObjectResponse, error) - // Queries a object by id + // Queries an object by id HeadObjectById(context.Context, *QueryHeadObjectByIdRequest) (*QueryHeadObjectResponse, error) // Queries a object with EIP712 standard metadata info HeadObjectNFT(context.Context, *QueryNFTRequest) (*QueryObjectNFTResponse, error) @@ -1315,10 +1797,18 @@ type QueryServer interface { ListObjectsByBucketId(context.Context, *QueryListObjectsByBucketIdRequest) (*QueryListObjectsResponse, error) // Queries a group with EIP712 standard metadata info HeadGroupNFT(context.Context, *QueryNFTRequest) (*QueryGroupNFTResponse, error) - // Queries policy by policyID - GetPolicy(context.Context, *QueryGetPolicyRequest) (*QueryGetPolicyResponse, error) + // Queries a policy which grants permission to account + QueryPolicyForAccount(context.Context, *QueryPolicyForAccountRequest) (*QueryPolicyForAccountResponse, error) // Queries a list of VerifyPermission items. VerifyPermission(context.Context, *QueryVerifyPermissionRequest) (*QueryVerifyPermissionResponse, error) + // Queries a group with specify owner and name . + HeadGroup(context.Context, *QueryHeadGroupRequest) (*QueryHeadGroupResponse, error) + // Queries a list of ListGroup items. + ListGroup(context.Context, *QueryListGroupRequest) (*QueryListGroupResponse, error) + // Queries a list of HeadGroupMember items. + HeadGroupMember(context.Context, *QueryHeadGroupMemberRequest) (*QueryHeadGroupMemberResponse, error) + // Queries a policy that grants permission to a group + QueryPolicyForGroup(context.Context, *QueryPolicyForGroupRequest) (*QueryPolicyForGroupResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1358,12 +1848,24 @@ func (*UnimplementedQueryServer) ListObjectsByBucketId(ctx context.Context, req func (*UnimplementedQueryServer) HeadGroupNFT(ctx context.Context, req *QueryNFTRequest) (*QueryGroupNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HeadGroupNFT not implemented") } -func (*UnimplementedQueryServer) GetPolicy(ctx context.Context, req *QueryGetPolicyRequest) (*QueryGetPolicyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPolicy not implemented") +func (*UnimplementedQueryServer) QueryPolicyForAccount(ctx context.Context, req *QueryPolicyForAccountRequest) (*QueryPolicyForAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryPolicyForAccount not implemented") } func (*UnimplementedQueryServer) VerifyPermission(ctx context.Context, req *QueryVerifyPermissionRequest) (*QueryVerifyPermissionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VerifyPermission not implemented") } +func (*UnimplementedQueryServer) HeadGroup(ctx context.Context, req *QueryHeadGroupRequest) (*QueryHeadGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HeadGroup not implemented") +} +func (*UnimplementedQueryServer) ListGroup(ctx context.Context, req *QueryListGroupRequest) (*QueryListGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListGroup not implemented") +} +func (*UnimplementedQueryServer) HeadGroupMember(ctx context.Context, req *QueryHeadGroupMemberRequest) (*QueryHeadGroupMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HeadGroupMember not implemented") +} +func (*UnimplementedQueryServer) QueryPolicyForGroup(ctx context.Context, req *QueryPolicyForGroupRequest) (*QueryPolicyForGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryPolicyForGroup not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1567,20 +2069,20 @@ func _Query_HeadGroupNFT_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Query_GetPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetPolicyRequest) +func _Query_QueryPolicyForAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPolicyForAccountRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetPolicy(ctx, in) + return srv.(QueryServer).QueryPolicyForAccount(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/bnbchain.greenfield.storage.Query/GetPolicy", + FullMethod: "/bnbchain.greenfield.storage.Query/QueryPolicyForAccount", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetPolicy(ctx, req.(*QueryGetPolicyRequest)) + return srv.(QueryServer).QueryPolicyForAccount(ctx, req.(*QueryPolicyForAccountRequest)) } return interceptor(ctx, in, info, handler) } @@ -1603,6 +2105,78 @@ func _Query_VerifyPermission_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Query_HeadGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHeadGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HeadGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bnbchain.greenfield.storage.Query/HeadGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HeadGroup(ctx, req.(*QueryHeadGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ListGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryListGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ListGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bnbchain.greenfield.storage.Query/ListGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ListGroup(ctx, req.(*QueryListGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_HeadGroupMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHeadGroupMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HeadGroupMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bnbchain.greenfield.storage.Query/HeadGroupMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HeadGroupMember(ctx, req.(*QueryHeadGroupMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryPolicyForGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPolicyForGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryPolicyForGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bnbchain.greenfield.storage.Query/QueryPolicyForGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryPolicyForGroup(ctx, req.(*QueryPolicyForGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "bnbchain.greenfield.storage.Query", HandlerType: (*QueryServer)(nil), @@ -1652,13 +2226,29 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_HeadGroupNFT_Handler, }, { - MethodName: "GetPolicy", - Handler: _Query_GetPolicy_Handler, + MethodName: "QueryPolicyForAccount", + Handler: _Query_QueryPolicyForAccount_Handler, }, { MethodName: "VerifyPermission", Handler: _Query_VerifyPermission_Handler, }, + { + MethodName: "HeadGroup", + Handler: _Query_HeadGroup_Handler, + }, + { + MethodName: "ListGroup", + Handler: _Query_ListGroup_Handler, + }, + { + MethodName: "HeadGroupMember", + Handler: _Query_HeadGroupMember_Handler, + }, + { + MethodName: "QueryPolicyForGroup", + Handler: _Query_QueryPolicyForGroup_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "greenfield/storage/query.proto", @@ -2269,7 +2859,7 @@ func (m *QueryGroupNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryGetPolicyRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPolicyForAccountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2279,27 +2869,34 @@ func (m *QueryGetPolicyRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetPolicyRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPolicyForAccountRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetPolicyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPolicyForAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.PolicyId) > 0 { - i -= len(m.PolicyId) - copy(dAtA[i:], m.PolicyId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.PolicyId))) + if len(m.PrincipalAddress) > 0 { + i -= len(m.PrincipalAddress) + copy(dAtA[i:], m.PrincipalAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.PrincipalAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Resource) > 0 { + i -= len(m.Resource) + copy(dAtA[i:], m.Resource) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Resource))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryGetPolicyResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPolicyForAccountResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2309,12 +2906,12 @@ func (m *QueryGetPolicyResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetPolicyResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPolicyForAccountResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetPolicyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPolicyForAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2411,161 +3008,357 @@ func (m *QueryVerifyPermissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryHeadGroupRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryHeadGroupRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryHeadBucketRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryHeadGroupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.BucketName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.GroupName) > 0 { + i -= len(m.GroupName) + copy(dAtA[i:], m.GroupName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GroupName))) + i-- + dAtA[i] = 0x12 } - return n + if len(m.GroupOwner) > 0 { + i -= len(m.GroupOwner) + copy(dAtA[i:], m.GroupOwner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GroupOwner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryHeadBucketByIdRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BucketId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryHeadGroupResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryHeadBucketResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BucketInfo != nil { - l = m.BucketInfo.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryHeadGroupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryHeadObjectRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryHeadGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.BucketName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ObjectName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.GroupInfo != nil { + { + size, err := m.GroupInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryHeadObjectByIdRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ObjectId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryListGroupRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryHeadObjectResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObjectInfo != nil { - l = m.ObjectInfo.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryListGroupRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryListBucketsRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryListGroupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l + if len(m.GroupOwner) > 0 { + i -= len(m.GroupOwner) + copy(dAtA[i:], m.GroupOwner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GroupOwner))) + i-- + dAtA[i] = 0x12 + } if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryListBucketsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryListGroupResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryListGroupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.BucketInfos) > 0 { - for _, e := range m.BucketInfos { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.GroupInfos) > 0 { + for iNdEx := len(m.GroupInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GroupInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } } if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryHeadGroupMemberRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryHeadGroupMemberRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHeadGroupMemberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GroupName) > 0 { + i -= len(m.GroupName) + copy(dAtA[i:], m.GroupName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GroupName))) + i-- + dAtA[i] = 0x1a + } + if len(m.GroupOwner) > 0 { + i -= len(m.GroupOwner) + copy(dAtA[i:], m.GroupOwner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GroupOwner))) + i-- + dAtA[i] = 0x12 + } + if len(m.Member) > 0 { + i -= len(m.Member) + copy(dAtA[i:], m.Member) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Member))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryHeadGroupMemberResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryHeadGroupMemberResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHeadGroupMemberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GroupInfo != nil { + { + size, err := m.GroupInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPolicyForGroupRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPolicyForGroupRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPolicyForGroupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PrincipalGroupId) > 0 { + i -= len(m.PrincipalGroupId) + copy(dAtA[i:], m.PrincipalGroupId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.PrincipalGroupId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Resource) > 0 { + i -= len(m.Resource) + copy(dAtA[i:], m.Resource) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Resource))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPolicyForGroupResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPolicyForGroupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPolicyForGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Policy != nil { + { + size, err := m.Policy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 } + var l int + _ = l return n } -func (m *QueryListObjectsRequest) Size() (n int) { +func (m *QueryParamsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryHeadBucketRequest) Size() (n int) { + if m == nil { + return 0 } + var l int + _ = l l = len(m.BucketName) if l > 0 { n += 1 + l + sovQuery(uint64(l)) @@ -2573,16 +3366,12 @@ func (m *QueryListObjectsRequest) Size() (n int) { return n } -func (m *QueryListObjectsByBucketIdRequest) Size() (n int) { +func (m *QueryHeadBucketByIdRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } l = len(m.BucketId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) @@ -2590,104 +3379,230 @@ func (m *QueryListObjectsByBucketIdRequest) Size() (n int) { return n } -func (m *QueryListObjectsResponse) Size() (n int) { +func (m *QueryHeadBucketResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.ObjectInfos) > 0 { - for _, e := range m.ObjectInfos { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() + if m.BucketInfo != nil { + l = m.BucketInfo.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryNFTRequest) Size() (n int) { +func (m *QueryHeadObjectRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.TokenId) + l = len(m.BucketName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ObjectName) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryBucketNFTResponse) Size() (n int) { +func (m *QueryHeadObjectByIdRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MetaData != nil { - l = m.MetaData.Size() + l = len(m.ObjectId) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryObjectNFTResponse) Size() (n int) { +func (m *QueryHeadObjectResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MetaData != nil { - l = m.MetaData.Size() + if m.ObjectInfo != nil { + l = m.ObjectInfo.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGroupNFTResponse) Size() (n int) { +func (m *QueryListBucketsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MetaData != nil { - l = m.MetaData.Size() + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetPolicyRequest) Size() (n int) { +func (m *QueryListBucketsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.PolicyId) - if l > 0 { + if len(m.BucketInfos) > 0 { + for _, e := range m.BucketInfos { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryGetPolicyResponse) Size() (n int) { +func (m *QueryListObjectsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Policy != nil { - l = m.Policy.Size() + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.BucketName) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryVerifyPermissionRequest) Size() (n int) { +func (m *QueryListObjectsByBucketIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.BucketId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListObjectsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ObjectInfos) > 0 { + for _, e := range m.ObjectInfos { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryNFTRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBucketNFTResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MetaData != nil { + l = m.MetaData.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryObjectNFTResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MetaData != nil { + l = m.MetaData.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGroupNFTResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MetaData != nil { + l = m.MetaData.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPolicyForAccountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Resource) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.PrincipalAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPolicyForAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Policy != nil { + l = m.Policy.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVerifyPermissionRequest) Size() (n int) { if m == nil { return 0 } @@ -2723,6 +3638,136 @@ func (m *QueryVerifyPermissionResponse) Size() (n int) { return n } +func (m *QueryHeadGroupRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GroupOwner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.GroupName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryHeadGroupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GroupInfo != nil { + l = m.GroupInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListGroupRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.GroupOwner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListGroupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.GroupInfos) > 0 { + for _, e := range m.GroupInfos { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryHeadGroupMemberRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Member) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.GroupOwner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.GroupName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryHeadGroupMemberResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GroupInfo != nil { + l = m.GroupInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPolicyForGroupRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Resource) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.PrincipalGroupId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPolicyForGroupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Policy != nil { + l = m.Policy.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2789,28 +3834,763 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if shift >= 64 { return ErrIntOverflowQuery } - if iNdEx >= l { + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHeadBucketRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHeadBucketRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHeadBucketRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BucketName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BucketName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHeadBucketByIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHeadBucketByIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHeadBucketByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BucketId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BucketId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHeadBucketResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHeadBucketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHeadBucketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BucketInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BucketInfo == nil { + m.BucketInfo = &BucketInfo{} + } + if err := m.BucketInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHeadObjectRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHeadObjectRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHeadObjectRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BucketName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BucketName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ObjectName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHeadObjectByIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHeadObjectByIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHeadObjectByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ObjectId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHeadObjectResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHeadObjectResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHeadObjectResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ObjectInfo == nil { + m.ObjectInfo = &ObjectInfo{} + } + if err := m.ObjectInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryListBucketsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryListBucketsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListBucketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryListBucketsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryListBucketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListBucketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BucketInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.BucketInfos = append(m.BucketInfos, &BucketInfo{}) + if err := m.BucketInfos[len(m.BucketInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2837,7 +4617,10 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2862,7 +4645,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHeadBucketRequest) Unmarshal(dAtA []byte) error { +func (m *QueryListObjectsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2885,13 +4668,49 @@ func (m *QueryHeadBucketRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHeadBucketRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryListObjectsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHeadBucketRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryListObjectsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BucketName", wireType) } @@ -2944,7 +4763,7 @@ func (m *QueryHeadBucketRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHeadBucketByIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryListObjectsByBucketIdRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2967,13 +4786,49 @@ func (m *QueryHeadBucketByIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHeadBucketByIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryListObjectsByBucketIdRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHeadBucketByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryListObjectsByBucketIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BucketId", wireType) } @@ -3026,7 +4881,7 @@ func (m *QueryHeadBucketByIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHeadBucketResponse) Unmarshal(dAtA []byte) error { +func (m *QueryListObjectsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3049,15 +4904,15 @@ func (m *QueryHeadBucketResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHeadBucketResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryListObjectsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHeadBucketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryListObjectsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BucketInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectInfos", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3084,10 +4939,44 @@ func (m *QueryHeadBucketResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.BucketInfo == nil { - m.BucketInfo = &BucketInfo{} + m.ObjectInfos = append(m.ObjectInfos, &ObjectInfo{}) + if err := m.ObjectInfos[len(m.ObjectInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.BucketInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3112,7 +5001,7 @@ func (m *QueryHeadBucketResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHeadObjectRequest) Unmarshal(dAtA []byte) error { +func (m *QueryNFTRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3135,47 +5024,15 @@ func (m *QueryHeadObjectRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHeadObjectRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNFTRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHeadObjectRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNFTRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BucketName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BucketName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3203,7 +5060,7 @@ func (m *QueryHeadObjectRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ObjectName = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3226,7 +5083,7 @@ func (m *QueryHeadObjectRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHeadObjectByIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBucketNFTResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3249,17 +5106,17 @@ func (m *QueryHeadObjectByIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHeadObjectByIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBucketNFTResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHeadObjectByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBucketNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaData", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3269,23 +5126,27 @@ func (m *QueryHeadObjectByIdRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ObjectId = string(dAtA[iNdEx:postIndex]) + if m.MetaData == nil { + m.MetaData = &BucketMetaData{} + } + if err := m.MetaData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3308,7 +5169,7 @@ func (m *QueryHeadObjectByIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHeadObjectResponse) Unmarshal(dAtA []byte) error { +func (m *QueryObjectNFTResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3331,15 +5192,15 @@ func (m *QueryHeadObjectResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHeadObjectResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryObjectNFTResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHeadObjectResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryObjectNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaData", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3366,10 +5227,10 @@ func (m *QueryHeadObjectResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ObjectInfo == nil { - m.ObjectInfo = &ObjectInfo{} + if m.MetaData == nil { + m.MetaData = &ObjectMetaData{} } - if err := m.ObjectInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MetaData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3394,7 +5255,7 @@ func (m *QueryHeadObjectResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryListBucketsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGroupNFTResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3417,15 +5278,15 @@ func (m *QueryListBucketsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryListBucketsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGroupNFTResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListBucketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGroupNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaData", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3452,10 +5313,10 @@ func (m *QueryListBucketsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} + if m.MetaData == nil { + m.MetaData = &GroupMetaData{} } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MetaData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3480,7 +5341,7 @@ func (m *QueryListBucketsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryListBucketsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryPolicyForAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3503,17 +5364,17 @@ func (m *QueryListBucketsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryListBucketsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPolicyForAccountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListBucketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPolicyForAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BucketInfos", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3523,31 +5384,29 @@ func (m *QueryListBucketsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BucketInfos = append(m.BucketInfos, BucketInfo{}) - if err := m.BucketInfos[len(m.BucketInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Resource = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PrincipalAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3557,27 +5416,23 @@ func (m *QueryListBucketsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.PrincipalAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3600,7 +5455,7 @@ func (m *QueryListBucketsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryListObjectsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryPolicyForAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3623,15 +5478,15 @@ func (m *QueryListObjectsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryListObjectsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPolicyForAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListObjectsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPolicyForAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Policy", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3658,45 +5513,13 @@ func (m *QueryListObjectsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} + if m.Policy == nil { + m.Policy = &types.Policy{} } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Policy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BucketName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BucketName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3718,7 +5541,7 @@ func (m *QueryListObjectsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryListObjectsByBucketIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryVerifyPermissionRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3741,17 +5564,17 @@ func (m *QueryListObjectsByBucketIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryListObjectsByBucketIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVerifyPermissionRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListObjectsByBucketIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVerifyPermissionRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3761,31 +5584,59 @@ func (m *QueryListObjectsByBucketIdRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BucketName", wireType) } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.BucketName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BucketId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3813,8 +5664,27 @@ func (m *QueryListObjectsByBucketIdRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BucketId = string(dAtA[iNdEx:postIndex]) + m.ObjectName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActionType", wireType) + } + m.ActionType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ActionType |= types.ActionType(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3836,7 +5706,7 @@ func (m *QueryListObjectsByBucketIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryListObjectsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryVerifyPermissionResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3859,51 +5729,17 @@ func (m *QueryListObjectsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryListObjectsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVerifyPermissionResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListObjectsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVerifyPermissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectInfos", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ObjectInfos = append(m.ObjectInfos, ObjectInfo{}) - if err := m.ObjectInfos[len(m.ObjectInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) } - var msglen int + m.Effect = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3913,28 +5749,11 @@ func (m *QueryListObjectsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Effect |= types.Effect(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3956,7 +5775,7 @@ func (m *QueryListObjectsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryNFTRequest) Unmarshal(dAtA []byte) error { +func (m *QueryHeadGroupRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3975,19 +5794,51 @@ func (m *QueryNFTRequest) Unmarshal(dAtA []byte) error { if b < 0x80 { break } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNFTRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHeadGroupRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHeadGroupRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GroupOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GroupName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4015,7 +5866,7 @@ func (m *QueryNFTRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TokenId = string(dAtA[iNdEx:postIndex]) + m.GroupName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4038,7 +5889,7 @@ func (m *QueryNFTRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBucketNFTResponse) Unmarshal(dAtA []byte) error { +func (m *QueryHeadGroupResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4061,15 +5912,15 @@ func (m *QueryBucketNFTResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBucketNFTResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryHeadGroupResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBucketNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryHeadGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GroupInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4096,10 +5947,10 @@ func (m *QueryBucketNFTResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MetaData == nil { - m.MetaData = &BucketMetaData{} + if m.GroupInfo == nil { + m.GroupInfo = &GroupInfo{} } - if err := m.MetaData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.GroupInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4124,7 +5975,7 @@ func (m *QueryBucketNFTResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryObjectNFTResponse) Unmarshal(dAtA []byte) error { +func (m *QueryListGroupRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4147,15 +5998,15 @@ func (m *QueryObjectNFTResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryObjectNFTResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryListGroupRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryObjectNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryListGroupRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4182,13 +6033,45 @@ func (m *QueryObjectNFTResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MetaData == nil { - m.MetaData = &ObjectMetaData{} + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - if err := m.MetaData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GroupOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4210,7 +6093,7 @@ func (m *QueryObjectNFTResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGroupNFTResponse) Unmarshal(dAtA []byte) error { +func (m *QueryListGroupResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4233,15 +6116,15 @@ func (m *QueryGroupNFTResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGroupNFTResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryListGroupResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGroupNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryListGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4268,10 +6151,44 @@ func (m *QueryGroupNFTResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MetaData == nil { - m.MetaData = &GroupMetaData{} + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} } - if err := m.MetaData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GroupInfos = append(m.GroupInfos, &GroupInfo{}) + if err := m.GroupInfos[len(m.GroupInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4296,7 +6213,7 @@ func (m *QueryGroupNFTResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetPolicyRequest) Unmarshal(dAtA []byte) error { +func (m *QueryHeadGroupMemberRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4319,15 +6236,79 @@ func (m *QueryGetPolicyRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPolicyRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryHeadGroupMemberRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPolicyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryHeadGroupMemberRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PolicyId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Member", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Member = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupOwner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GroupOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4355,7 +6336,7 @@ func (m *QueryGetPolicyRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PolicyId = string(dAtA[iNdEx:postIndex]) + m.GroupName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4378,7 +6359,7 @@ func (m *QueryGetPolicyRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetPolicyResponse) Unmarshal(dAtA []byte) error { +func (m *QueryHeadGroupMemberResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4401,15 +6382,15 @@ func (m *QueryGetPolicyResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPolicyResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryHeadGroupMemberResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPolicyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryHeadGroupMemberResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Policy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GroupInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4436,10 +6417,10 @@ func (m *QueryGetPolicyResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Policy == nil { - m.Policy = &types.Policy{} + if m.GroupInfo == nil { + m.GroupInfo = &GroupInfo{} } - if err := m.Policy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.GroupInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4464,7 +6445,7 @@ func (m *QueryGetPolicyResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVerifyPermissionRequest) Unmarshal(dAtA []byte) error { +func (m *QueryPolicyForGroupRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4487,15 +6468,15 @@ func (m *QueryVerifyPermissionRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVerifyPermissionRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPolicyForGroupRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVerifyPermissionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPolicyForGroupRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4523,43 +6504,11 @@ func (m *QueryVerifyPermissionRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Operator = string(dAtA[iNdEx:postIndex]) + m.Resource = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BucketName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BucketName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PrincipalGroupId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4587,27 +6536,8 @@ func (m *QueryVerifyPermissionRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ObjectName = string(dAtA[iNdEx:postIndex]) + m.PrincipalGroupId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ActionType", wireType) - } - m.ActionType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ActionType |= types.ActionType(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4629,7 +6559,7 @@ func (m *QueryVerifyPermissionRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVerifyPermissionResponse) Unmarshal(dAtA []byte) error { +func (m *QueryPolicyForGroupResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4652,17 +6582,17 @@ func (m *QueryVerifyPermissionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVerifyPermissionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPolicyForGroupResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVerifyPermissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPolicyForGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Policy", wireType) } - m.Effect = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4672,11 +6602,28 @@ func (m *QueryVerifyPermissionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Effect |= types.Effect(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Policy == nil { + m.Policy = &types.Policy{} + } + if err := m.Policy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/storage/types/query.pb.gw.go b/x/storage/types/query.pb.gw.go index 370de3d04..9da0c82ef 100644 --- a/x/storage/types/query.pb.gw.go +++ b/x/storage/types/query.pb.gw.go @@ -632,8 +632,8 @@ func local_request_Query_HeadGroupNFT_0(ctx context.Context, marshaler runtime.M } -func request_Query_GetPolicy_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetPolicyRequest +func request_Query_QueryPolicyForAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPolicyForAccountRequest var metadata runtime.ServerMetadata var ( @@ -643,24 +643,35 @@ func request_Query_GetPolicy_0(ctx context.Context, marshaler runtime.Marshaler, _ = err ) - val, ok = pathParams["policy_id"] + val, ok = pathParams["resource"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "policy_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "resource") } - protoReq.PolicyId, err = runtime.String(val) + protoReq.Resource, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "policy_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "resource", err) } - msg, err := client.GetPolicy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + val, ok = pathParams["principal_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "principal_address") + } + + protoReq.PrincipalAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "principal_address", err) + } + + msg, err := client.QueryPolicyForAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetPolicy_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetPolicyRequest +func local_request_Query_QueryPolicyForAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPolicyForAccountRequest var metadata runtime.ServerMetadata var ( @@ -670,18 +681,29 @@ func local_request_Query_GetPolicy_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["policy_id"] + val, ok = pathParams["resource"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "policy_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "resource") } - protoReq.PolicyId, err = runtime.String(val) + protoReq.Resource, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "policy_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "resource", err) } - msg, err := server.GetPolicy(ctx, &protoReq) + val, ok = pathParams["principal_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "principal_address") + } + + protoReq.PrincipalAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "principal_address", err) + } + + msg, err := server.QueryPolicyForAccount(ctx, &protoReq) return msg, metadata, err } @@ -812,6 +834,230 @@ func local_request_Query_VerifyPermission_0(ctx context.Context, marshaler runti } +func request_Query_HeadGroup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHeadGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["group_owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "group_owner") + } + + protoReq.GroupOwner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "group_owner", err) + } + + val, ok = pathParams["group_name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "group_name") + } + + protoReq.GroupName, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "group_name", err) + } + + msg, err := client.HeadGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_HeadGroup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHeadGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["group_owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "group_owner") + } + + protoReq.GroupOwner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "group_owner", err) + } + + val, ok = pathParams["group_name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "group_name") + } + + protoReq.GroupName, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "group_name", err) + } + + msg, err := server.HeadGroup(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ListGroup_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ListGroup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListGroupRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListGroup_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ListGroup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListGroupRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListGroup_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListGroup(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_HeadGroupMember_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_HeadGroupMember_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHeadGroupMemberRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_HeadGroupMember_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HeadGroupMember(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_HeadGroupMember_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHeadGroupMemberRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_HeadGroupMember_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HeadGroupMember(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryPolicyForGroup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPolicyForGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["resource"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "resource") + } + + protoReq.Resource, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "resource", err) + } + + val, ok = pathParams["principal_group_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "principal_group_id") + } + + protoReq.PrincipalGroupId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "principal_group_id", err) + } + + msg, err := client.QueryPolicyForGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryPolicyForGroup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPolicyForGroupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["resource"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "resource") + } + + protoReq.Resource, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "resource", err) + } + + val, ok = pathParams["principal_group_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "principal_group_id") + } + + protoReq.PrincipalGroupId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "principal_group_id", err) + } + + msg, err := server.QueryPolicyForGroup(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1071,7 +1317,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_GetPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryPolicyForAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1082,7 +1328,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetPolicy_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryPolicyForAccount_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1090,7 +1336,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryPolicyForAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1117,6 +1363,98 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_HeadGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_HeadGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_HeadGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ListGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ListGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ListGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HeadGroupMember_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_HeadGroupMember_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_HeadGroupMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryPolicyForGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryPolicyForGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryPolicyForGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1378,7 +1716,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_GetPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryPolicyForAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1387,14 +1725,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetPolicy_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryPolicyForAccount_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_GetPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryPolicyForAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1418,6 +1756,86 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_HeadGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_HeadGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_HeadGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ListGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ListGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ListGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HeadGroupMember_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_HeadGroupMember_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_HeadGroupMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryPolicyForGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryPolicyForGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryPolicyForGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1444,9 +1862,17 @@ var ( pattern_Query_HeadGroupNFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"greenfield", "storage", "head_group_nft", "token_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GetPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"greenfield", "storage", "get_policy", "policy_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryPolicyForAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"greenfield", "storage", "policy_for_account", "resource", "principal_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_VerifyPermission_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6}, []string{"greenfield", "storage", "verify_permission", "operator", "bucket_name", "object_name", "action_type"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_HeadGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"greenfield", "storage", "head_group", "group_owner", "group_name"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ListGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"bnb-chain", "greenfield", "storage", "list_group"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_HeadGroupMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"bnb-chain", "greenfield", "storage", "head_group_member"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryPolicyForGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"bnb-chain", "greenfield", "storage", "policy_for_group", "resource", "principal_group_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1472,7 +1898,15 @@ var ( forward_Query_HeadGroupNFT_0 = runtime.ForwardResponseMessage - forward_Query_GetPolicy_0 = runtime.ForwardResponseMessage + forward_Query_QueryPolicyForAccount_0 = runtime.ForwardResponseMessage forward_Query_VerifyPermission_0 = runtime.ForwardResponseMessage + + forward_Query_HeadGroup_0 = runtime.ForwardResponseMessage + + forward_Query_ListGroup_0 = runtime.ForwardResponseMessage + + forward_Query_HeadGroupMember_0 = runtime.ForwardResponseMessage + + forward_Query_QueryPolicyForGroup_0 = runtime.ForwardResponseMessage )