types

package
v0.2.3-alpha.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2023 License: AGPL-3.0 Imports: 38 Imported by: 17

Documentation

Overview

Package types is a generated GoMock package.

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName defines the module name
	ModuleName = "permission"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName

	// RouterKey defines the module's message routing key
	RouterKey = ModuleName

	// MemStoreKey defines the in-memory store key
	MemStoreKey = "mem_permission"
)
View Source
const (
	DefaultMaxStatementsNum  uint64 = 10
	DefaultMaxPolicyGroupNum uint64 = 10
)
View Source
const DefaultIndex uint64 = 1

DefaultIndex is the default global index

Variables

View Source
var (
	ErrInvalidLengthCommon        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCommon          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidPrincipal  = errors.Register(ModuleName, 1100, "Invalid principal")
	ErrInvalidStatement  = errors.Register(ModuleName, 1101, "Invalid statement")
	ErrLimitExceeded     = errors.Register(ModuleName, 1102, "Num limit exceeded")
	ErrPermissionExpired = errors.Register(ModuleName, 1103, "Permission expired")
)

x/permission module sentinel errors

View Source
var (
	ErrInvalidLengthEvents        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvents          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ParamsKey = []byte{0x01}

	BucketPolicyForAccountPrefix = []byte{0x11}
	ObjectPolicyForAccountPrefix = []byte{0x12}
	GroupPolicyForAccountPrefix  = []byte{0x13}
	GroupMemberPrefix            = []byte{0x14}

	BucketPolicyForGroupPrefix = []byte{0x21}
	ObjectPolicyForGroupPrefix = []byte{0x22}

	PolicyByIDPrefix      = []byte{0x31}
	GroupMemberByIDPrefix = []byte{0x32}

	PolicySequencePrefix      = []byte{0x41}
	GroupMemberSequencePrefix = []byte{0x42}
)
View Source
var (
	KeyMaxStatementsNum   = []byte("MaxStatementsNum")
	KeyMaxPolicyGroupSIze = []byte("MaxPolicyGroupSize")
)
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	BucketAllowedActions = map[ActionType]bool{
		ACTION_UPDATE_BUCKET_INFO: true,
		ACTION_DELETE_BUCKET:      true,

		ACTION_CREATE_OBJECT:  true,
		ACTION_DELETE_OBJECT:  true,
		ACTION_GET_OBJECT:     true,
		ACTION_COPY_OBJECT:    true,
		ACTION_EXECUTE_OBJECT: true,
		ACTION_LIST_OBJECT:    true,

		ACTION_TYPE_ALL: true,
	}
	ObjectAllowedActions = map[ActionType]bool{
		ACTION_UPDATE_OBJECT_INFO: true,
		ACTION_CREATE_OBJECT:      true,
		ACTION_DELETE_OBJECT:      true,
		ACTION_GET_OBJECT:         true,
		ACTION_COPY_OBJECT:        true,
		ACTION_EXECUTE_OBJECT:     true,
		ACTION_LIST_OBJECT:        true,

		ACTION_TYPE_ALL: true,
	}
	GroupAllowedActions = map[ActionType]bool{
		ACTION_UPDATE_GROUP_MEMBER: true,
		ACTION_UPDATE_GROUP_EXTRA:  true,
		ACTION_DELETE_GROUP:        true,

		ACTION_TYPE_ALL: true,
	}
)
View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ActionType_name = map[int32]string{
	0:  "ACTION_UNSPECIFIED",
	1:  "ACTION_UPDATE_BUCKET_INFO",
	2:  "ACTION_DELETE_BUCKET",
	3:  "ACTION_CREATE_OBJECT",
	4:  "ACTION_DELETE_OBJECT",
	5:  "ACTION_COPY_OBJECT",
	6:  "ACTION_GET_OBJECT",
	7:  "ACTION_EXECUTE_OBJECT",
	8:  "ACTION_LIST_OBJECT",
	9:  "ACTION_UPDATE_GROUP_MEMBER",
	10: "ACTION_DELETE_GROUP",
	11: "ACTION_UPDATE_OBJECT_INFO",
	12: "ACTION_UPDATE_GROUP_EXTRA",
	99: "ACTION_TYPE_ALL",
}
View Source
var ActionType_value = map[string]int32{
	"ACTION_UNSPECIFIED":         0,
	"ACTION_UPDATE_BUCKET_INFO":  1,
	"ACTION_DELETE_BUCKET":       2,
	"ACTION_CREATE_OBJECT":       3,
	"ACTION_DELETE_OBJECT":       4,
	"ACTION_COPY_OBJECT":         5,
	"ACTION_GET_OBJECT":          6,
	"ACTION_EXECUTE_OBJECT":      7,
	"ACTION_LIST_OBJECT":         8,
	"ACTION_UPDATE_GROUP_MEMBER": 9,
	"ACTION_DELETE_GROUP":        10,
	"ACTION_UPDATE_OBJECT_INFO":  11,
	"ACTION_UPDATE_GROUP_EXTRA":  12,
	"ACTION_TYPE_ALL":            99,
}
View Source
var Effect_name = map[int32]string{
	0: "EFFECT_UNSPECIFIED",
	1: "EFFECT_ALLOW",
	2: "EFFECT_DENY",
}
View Source
var Effect_value = map[string]int32{
	"EFFECT_UNSPECIFIED": 0,
	"EFFECT_ALLOW":       1,
	"EFFECT_DENY":        2,
}
View Source
var PrincipalType_name = map[int32]string{
	0: "PRINCIPAL_TYPE_UNSPECIFIED",
	1: "PRINCIPAL_TYPE_GNFD_ACCOUNT",
	2: "PRINCIPAL_TYPE_GNFD_GROUP",
}
View Source
var PrincipalType_value = map[string]int32{
	"PRINCIPAL_TYPE_UNSPECIFIED":  0,
	"PRINCIPAL_TYPE_GNFD_ACCOUNT": 1,
	"PRINCIPAL_TYPE_GNFD_GROUP":   2,
}

Functions

func GetGroupMemberByIDKey added in v0.0.10

func GetGroupMemberByIDKey(memberID math.Uint) []byte

func GetGroupMemberKey added in v0.0.10

func GetGroupMemberKey(groupID math.Uint, member sdk.AccAddress) []byte

func GetPolicyByIDKey

func GetPolicyByIDKey(policyID math.Uint) []byte

func GetPolicyForAccountKey added in v0.0.8

func GetPolicyForAccountKey(resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) []byte

func GetPolicyForGroupKey added in v0.0.8

func GetPolicyForGroupKey(resourceID math.Uint, resourceType resource.ResourceType) []byte

func GroupMembersPrefix added in v0.2.0

func GroupMembersPrefix(groupID math.Uint) []byte

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable the param key table for launch module

func PolicyForAccountPrefix added in v0.2.0

func PolicyForAccountPrefix(resourceID math.Uint, resourceType resource.ResourceType) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

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. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
}

AccountKeeper defines the expected account keeper used for simulations (noalias)

type ActionType

type ActionType int32

ActionType defines the operations you can execute in greenfield storage network

const (
	ACTION_UNSPECIFIED         ActionType = 0
	ACTION_UPDATE_BUCKET_INFO  ActionType = 1
	ACTION_DELETE_BUCKET       ActionType = 2
	ACTION_CREATE_OBJECT       ActionType = 3
	ACTION_DELETE_OBJECT       ActionType = 4
	ACTION_COPY_OBJECT         ActionType = 5
	ACTION_GET_OBJECT          ActionType = 6
	ACTION_EXECUTE_OBJECT      ActionType = 7
	ACTION_LIST_OBJECT         ActionType = 8
	ACTION_UPDATE_GROUP_MEMBER ActionType = 9
	ACTION_DELETE_GROUP        ActionType = 10
	ACTION_UPDATE_OBJECT_INFO  ActionType = 11
	ACTION_UPDATE_GROUP_EXTRA  ActionType = 12
	ACTION_TYPE_ALL            ActionType = 99
)

func (ActionType) EnumDescriptor

func (ActionType) EnumDescriptor() ([]byte, []int)

func (ActionType) String

func (x ActionType) String() string

type BankKeeper

type BankKeeper interface {
	SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}

BankKeeper defines the expected interface needed to retrieve account balances.

type Effect

type Effect int32

Effect define the effect of the operation permission, include Allow or deny

const (
	EFFECT_UNSPECIFIED Effect = 0
	EFFECT_ALLOW       Effect = 1
	EFFECT_DENY        Effect = 2
)

func (Effect) EnumDescriptor

func (Effect) EnumDescriptor() ([]byte, []int)

func (Effect) String

func (x Effect) String() string

type EventDeletePolicy added in v0.0.9

type EventDeletePolicy struct {
	// policy_id is an unique u256 sequence for each policy. It also be used as NFT tokenID
	PolicyId Uint `protobuf:"bytes,1,opt,name=policy_id,json=policyId,proto3,customtype=Uint" json:"policy_id"`
}

func (*EventDeletePolicy) Descriptor added in v0.0.9

func (*EventDeletePolicy) Descriptor() ([]byte, []int)

func (*EventDeletePolicy) Marshal added in v0.0.9

func (m *EventDeletePolicy) Marshal() (dAtA []byte, err error)

func (*EventDeletePolicy) MarshalTo added in v0.0.9

func (m *EventDeletePolicy) MarshalTo(dAtA []byte) (int, error)

func (*EventDeletePolicy) MarshalToSizedBuffer added in v0.0.9

func (m *EventDeletePolicy) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventDeletePolicy) ProtoMessage added in v0.0.9

func (*EventDeletePolicy) ProtoMessage()

func (*EventDeletePolicy) Reset added in v0.0.9

func (m *EventDeletePolicy) Reset()

func (*EventDeletePolicy) Size added in v0.0.9

func (m *EventDeletePolicy) Size() (n int)

func (*EventDeletePolicy) String added in v0.0.9

func (m *EventDeletePolicy) String() string

func (*EventDeletePolicy) Unmarshal added in v0.0.9

func (m *EventDeletePolicy) Unmarshal(dAtA []byte) error

func (*EventDeletePolicy) XXX_DiscardUnknown added in v0.0.9

func (m *EventDeletePolicy) XXX_DiscardUnknown()

func (*EventDeletePolicy) XXX_Marshal added in v0.0.9

func (m *EventDeletePolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventDeletePolicy) XXX_Merge added in v0.0.9

func (m *EventDeletePolicy) XXX_Merge(src proto.Message)

func (*EventDeletePolicy) XXX_Size added in v0.0.9

func (m *EventDeletePolicy) XXX_Size() int

func (*EventDeletePolicy) XXX_Unmarshal added in v0.0.9

func (m *EventDeletePolicy) XXX_Unmarshal(b []byte) error

type EventPutPolicy added in v0.0.9

type EventPutPolicy struct {
	// policy_id is an unique u256 sequence for each policy. It also be used as NFT tokenID
	PolicyId Uint `protobuf:"bytes,1,opt,name=policy_id,json=policyId,proto3,customtype=Uint" json:"policy_id"`
	// principal defines the accounts/group which the permission grants to
	Principal *Principal `protobuf:"bytes,2,opt,name=principal,proto3" json:"principal,omitempty"`
	// resource_type defines the type of resource that grants permission for
	ResourceType resource.ResourceType `` /* 136-byte string literal not displayed */
	// resource_id defines the bucket/object/group id of the resource that grants permission for
	ResourceId Uint `protobuf:"bytes,4,opt,name=resource_id,json=resourceId,proto3,customtype=Uint" json:"resource_id"`
	// statements defines the details content of the permission, include effect/actions/sub-resources
	Statements []*Statement `protobuf:"bytes,5,rep,name=statements,proto3" json:"statements,omitempty"`
	// expiration_time defines the whole expiration time of all the statements.
	// Notices: Its priority is higher than the expiration time inside the Statement
	ExpirationTime *time.Time `protobuf:"bytes,6,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"`
}

func (*EventPutPolicy) Descriptor added in v0.0.9

func (*EventPutPolicy) Descriptor() ([]byte, []int)

func (*EventPutPolicy) GetExpirationTime added in v0.1.0

func (m *EventPutPolicy) GetExpirationTime() *time.Time

func (*EventPutPolicy) GetPrincipal added in v0.0.9

func (m *EventPutPolicy) GetPrincipal() *Principal

func (*EventPutPolicy) GetResourceType added in v0.0.9

func (m *EventPutPolicy) GetResourceType() resource.ResourceType

func (*EventPutPolicy) GetStatements added in v0.0.9

func (m *EventPutPolicy) GetStatements() []*Statement

func (*EventPutPolicy) Marshal added in v0.0.9

func (m *EventPutPolicy) Marshal() (dAtA []byte, err error)

func (*EventPutPolicy) MarshalTo added in v0.0.9

func (m *EventPutPolicy) MarshalTo(dAtA []byte) (int, error)

func (*EventPutPolicy) MarshalToSizedBuffer added in v0.0.9

func (m *EventPutPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventPutPolicy) ProtoMessage added in v0.0.9

func (*EventPutPolicy) ProtoMessage()

func (*EventPutPolicy) Reset added in v0.0.9

func (m *EventPutPolicy) Reset()

func (*EventPutPolicy) Size added in v0.0.9

func (m *EventPutPolicy) Size() (n int)

func (*EventPutPolicy) String added in v0.0.9

func (m *EventPutPolicy) String() string

func (*EventPutPolicy) Unmarshal added in v0.0.9

func (m *EventPutPolicy) Unmarshal(dAtA []byte) error

func (*EventPutPolicy) XXX_DiscardUnknown added in v0.0.9

func (m *EventPutPolicy) XXX_DiscardUnknown()

func (*EventPutPolicy) XXX_Marshal added in v0.0.9

func (m *EventPutPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventPutPolicy) XXX_Merge added in v0.0.9

func (m *EventPutPolicy) XXX_Merge(src proto.Message)

func (*EventPutPolicy) XXX_Size added in v0.0.9

func (m *EventPutPolicy) XXX_Size() int

func (*EventPutPolicy) XXX_Unmarshal added in v0.0.9

func (m *EventPutPolicy) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

GenesisState defines the permission module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default genesis state

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type GroupMember added in v0.0.10

type GroupMember struct {
	// id is an unique u256 sequence for each group member. It also be used as NFT tokenID
	Id Uint `protobuf:"bytes,1,opt,name=id,proto3,customtype=Uint" json:"id"`
	// group_id is the unique id of the group
	GroupId Uint `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3,customtype=Uint" json:"group_id"`
	// member is the account address of the member
	Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"`
}

func (*GroupMember) Descriptor added in v0.0.10

func (*GroupMember) Descriptor() ([]byte, []int)

func (*GroupMember) GetMember added in v0.0.10

func (m *GroupMember) GetMember() string

func (*GroupMember) Marshal added in v0.0.10

func (m *GroupMember) Marshal() (dAtA []byte, err error)

func (*GroupMember) MarshalTo added in v0.0.10

func (m *GroupMember) MarshalTo(dAtA []byte) (int, error)

func (*GroupMember) MarshalToSizedBuffer added in v0.0.10

func (m *GroupMember) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GroupMember) ProtoMessage added in v0.0.10

func (*GroupMember) ProtoMessage()

func (*GroupMember) Reset added in v0.0.10

func (m *GroupMember) Reset()

func (*GroupMember) Size added in v0.0.10

func (m *GroupMember) Size() (n int)

func (*GroupMember) String added in v0.0.10

func (m *GroupMember) String() string

func (*GroupMember) Unmarshal added in v0.0.10

func (m *GroupMember) Unmarshal(dAtA []byte) error

func (*GroupMember) XXX_DiscardUnknown added in v0.0.10

func (m *GroupMember) XXX_DiscardUnknown()

func (*GroupMember) XXX_Marshal added in v0.0.10

func (m *GroupMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GroupMember) XXX_Merge added in v0.0.10

func (m *GroupMember) XXX_Merge(src proto.Message)

func (*GroupMember) XXX_Size added in v0.0.10

func (m *GroupMember) XXX_Size() int

func (*GroupMember) XXX_Unmarshal added in v0.0.10

func (m *GroupMember) XXX_Unmarshal(b []byte) error

type Int

type Int = math.Int

type MockAccountKeeper added in v0.2.0

type MockAccountKeeper struct {
	// contains filtered or unexported fields
}

MockAccountKeeper is a mock of AccountKeeper interface.

func NewMockAccountKeeper added in v0.2.0

func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper

NewMockAccountKeeper creates a new mock instance.

func (*MockAccountKeeper) EXPECT added in v0.2.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAccountKeeper) GetAccount added in v0.2.0

func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI

GetAccount mocks base method.

type MockAccountKeeperMockRecorder added in v0.2.0

type MockAccountKeeperMockRecorder struct {
	// contains filtered or unexported fields
}

MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper.

func (*MockAccountKeeperMockRecorder) GetAccount added in v0.2.0

func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call

GetAccount indicates an expected call of GetAccount.

type MockBankKeeper added in v0.2.0

type MockBankKeeper struct {
	// contains filtered or unexported fields
}

MockBankKeeper is a mock of BankKeeper interface.

func NewMockBankKeeper added in v0.2.0

func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper

NewMockBankKeeper creates a new mock instance.

func (*MockBankKeeper) EXPECT added in v0.2.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBankKeeper) SpendableCoins added in v0.2.0

func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins

SpendableCoins mocks base method.

type MockBankKeeperMockRecorder added in v0.2.0

type MockBankKeeperMockRecorder struct {
	// contains filtered or unexported fields
}

MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper.

func (*MockBankKeeperMockRecorder) SpendableCoins added in v0.2.0

func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call

SpendableCoins indicates an expected call of SpendableCoins.

type MsgClient

type MsgClient interface {
	// UpdateParams defines a governance operation for updating the x/permission module parameters.
	// The authority is defined in the keeper.
	//
	// Since: cosmos-sdk 0.47
	UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgServer

type MsgServer interface {
	// UpdateParams defines a governance operation for updating the x/permission module parameters.
	// The authority is defined in the keeper.
	//
	// Since: cosmos-sdk 0.47
	UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}

MsgServer is the server API for Msg service.

type MsgUpdateParams added in v0.2.0

type MsgUpdateParams struct {
	// authority is the address that controls the module (defaults to x/gov unless overwritten).
	Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
	// params defines the x/permission parameters to update.
	//
	// NOTE: All parameters must be supplied.
	Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}

MsgUpdateParams is the Msg/UpdateParams request type.

func (*MsgUpdateParams) Descriptor added in v0.2.0

func (*MsgUpdateParams) Descriptor() ([]byte, []int)

func (*MsgUpdateParams) GetAuthority added in v0.2.0

func (m *MsgUpdateParams) GetAuthority() string

func (*MsgUpdateParams) GetParams added in v0.2.0

func (m *MsgUpdateParams) GetParams() Params

func (MsgUpdateParams) GetSignBytes added in v0.2.0

func (m MsgUpdateParams) GetSignBytes() []byte

GetSignBytes implements the LegacyMsg interface.

func (*MsgUpdateParams) GetSigners added in v0.2.0

func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress

GetSigners returns the expected signers for a MsgUpdateParams message.

func (*MsgUpdateParams) Marshal added in v0.2.0

func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error)

func (*MsgUpdateParams) MarshalTo added in v0.2.0

func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error)

func (*MsgUpdateParams) MarshalToSizedBuffer added in v0.2.0

func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgUpdateParams) ProtoMessage added in v0.2.0

func (*MsgUpdateParams) ProtoMessage()

func (*MsgUpdateParams) Reset added in v0.2.0

func (m *MsgUpdateParams) Reset()

func (*MsgUpdateParams) Size added in v0.2.0

func (m *MsgUpdateParams) Size() (n int)

func (*MsgUpdateParams) String added in v0.2.0

func (m *MsgUpdateParams) String() string

func (*MsgUpdateParams) Unmarshal added in v0.2.0

func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error

func (*MsgUpdateParams) ValidateBasic added in v0.2.0

func (m *MsgUpdateParams) ValidateBasic() error

ValidateBasic does a sanity check on the provided data.

func (*MsgUpdateParams) XXX_DiscardUnknown added in v0.2.0

func (m *MsgUpdateParams) XXX_DiscardUnknown()

func (*MsgUpdateParams) XXX_Marshal added in v0.2.0

func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgUpdateParams) XXX_Merge added in v0.2.0

func (m *MsgUpdateParams) XXX_Merge(src proto.Message)

func (*MsgUpdateParams) XXX_Size added in v0.2.0

func (m *MsgUpdateParams) XXX_Size() int

func (*MsgUpdateParams) XXX_Unmarshal added in v0.2.0

func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error

type MsgUpdateParamsResponse added in v0.2.0

type MsgUpdateParamsResponse struct {
}

MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message.

func (*MsgUpdateParamsResponse) Descriptor added in v0.2.0

func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int)

func (*MsgUpdateParamsResponse) Marshal added in v0.2.0

func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error)

func (*MsgUpdateParamsResponse) MarshalTo added in v0.2.0

func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgUpdateParamsResponse) MarshalToSizedBuffer added in v0.2.0

func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgUpdateParamsResponse) ProtoMessage added in v0.2.0

func (*MsgUpdateParamsResponse) ProtoMessage()

func (*MsgUpdateParamsResponse) Reset added in v0.2.0

func (m *MsgUpdateParamsResponse) Reset()

func (*MsgUpdateParamsResponse) Size added in v0.2.0

func (m *MsgUpdateParamsResponse) Size() (n int)

func (*MsgUpdateParamsResponse) String added in v0.2.0

func (m *MsgUpdateParamsResponse) String() string

func (*MsgUpdateParamsResponse) Unmarshal added in v0.2.0

func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error

func (*MsgUpdateParamsResponse) XXX_DiscardUnknown added in v0.2.0

func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown()

func (*MsgUpdateParamsResponse) XXX_Marshal added in v0.2.0

func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgUpdateParamsResponse) XXX_Merge added in v0.2.0

func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message)

func (*MsgUpdateParamsResponse) XXX_Size added in v0.2.0

func (m *MsgUpdateParamsResponse) XXX_Size() int

func (*MsgUpdateParamsResponse) XXX_Unmarshal added in v0.2.0

func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error

type Params

type Params struct {
	// maximum_statements_num defines the maximum number of statements allowed in a policy
	MaximumStatementsNum uint64 `protobuf:"varint,1,opt,name=maximum_statements_num,json=maximumStatementsNum,proto3" json:"maximum_statements_num,omitempty"`
	// maximum_group_num used to set the upper limit on the number of groups to which a resource can grant access permissions.
	// By placing a cap on the number of group permissions, permission control policies can be made more robust and better
	// enforced, thereby reducing the chances of DDos and other security incidents.
	MaximumGroupNum uint64 `protobuf:"varint,2,opt,name=maximum_group_num,json=maximumGroupNum,proto3" json:"maximum_group_num,omitempty"`
}

Params defines the parameters for the module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters

func NewParams

func NewParams(maximumStatementsNum, maximumGroupNum uint64) Params

NewParams creates a new Params instance

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetMaximumGroupNum

func (m *Params) GetMaximumGroupNum() uint64

func (*Params) GetMaximumStatementsNum

func (m *Params) GetMaximumStatementsNum() uint64

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs get the params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate validates the set of params

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type Policy

type Policy struct {
	// id is an unique u256 sequence for each policy. It also be used as NFT tokenID
	Id Uint `protobuf:"bytes,1,opt,name=id,proto3,customtype=Uint" json:"id"`
	// principal defines the accounts/group which the permission grants to
	Principal *Principal `protobuf:"bytes,2,opt,name=principal,proto3" json:"principal,omitempty"`
	// resource_type defines the type of resource that grants permission for
	ResourceType resource.ResourceType `` /* 136-byte string literal not displayed */
	// resource_id defines the bucket/object/group id of the resource that grants permission for
	ResourceId Uint `protobuf:"bytes,4,opt,name=resource_id,json=resourceId,proto3,customtype=Uint" json:"resource_id"`
	// statements defines the details content of the permission, including effect/actions/sub-resources
	Statements []*Statement `protobuf:"bytes,5,rep,name=statements,proto3" json:"statements,omitempty"`
	// expiration_time defines the whole expiration time of all the statements.
	// Notices: Its priority is higher than the expiration time inside the Statement
	ExpirationTime *time.Time `protobuf:"bytes,6,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"`
}

func (*Policy) Descriptor

func (*Policy) Descriptor() ([]byte, []int)

func (*Policy) Eval

func (p *Policy) Eval(action ActionType, blockTime time.Time, opts *VerifyOptions) (Effect, *Policy)

Eval is used to evaluate the execution results of permission policies. First, each policy has an expiration time. If it has expired, EFFECT_UNSPECIFIED will be returned, indicating that it cannot be evaluated and further verification is required. Next, each statement in the policy needs to be checked, which includes verifying: 1. Whether the statement has expired, 2. Whether the limit size has been exceeded, 3. Whether the resource in the statement matches the input resource name, 4. Whether the action in the statement matches the input action. Finally, in the verification process, based on the effect check 1. if there is an explicit Deny, return EFFECT_DENY; 2. if there is an explicit Allowed, record the flag and continue execution; 3. after all statements have been checked, if the flag is true, return EFFECT_ALLOW; otherwise return EFFECT_UNSPECIFIED.

func (*Policy) GetExpirationTime added in v0.0.10

func (m *Policy) GetExpirationTime() *time.Time

func (*Policy) GetPrincipal

func (m *Policy) GetPrincipal() *Principal

func (*Policy) GetResourceType

func (m *Policy) GetResourceType() resource.ResourceType

func (*Policy) GetStatements

func (m *Policy) GetStatements() []*Statement

func (*Policy) Marshal

func (m *Policy) Marshal() (dAtA []byte, err error)

func (*Policy) MarshalTo

func (m *Policy) MarshalTo(dAtA []byte) (int, error)

func (*Policy) MarshalToSizedBuffer

func (m *Policy) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Policy) ProtoMessage

func (*Policy) ProtoMessage()

func (*Policy) Reset

func (m *Policy) Reset()

func (*Policy) Size

func (m *Policy) Size() (n int)

func (*Policy) String

func (m *Policy) String() string

func (*Policy) Unmarshal

func (m *Policy) Unmarshal(dAtA []byte) error

func (*Policy) XXX_DiscardUnknown

func (m *Policy) XXX_DiscardUnknown()

func (*Policy) XXX_Marshal

func (m *Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Policy) XXX_Merge

func (m *Policy) XXX_Merge(src proto.Message)

func (*Policy) XXX_Size

func (m *Policy) XXX_Size() int

func (*Policy) XXX_Unmarshal

func (m *Policy) XXX_Unmarshal(b []byte) error

type PolicyGroup

type PolicyGroup struct {
	// items define a pair of policy_id and group_id. Each resource can only grant its own permissions to a limited number of groups
	Items []*PolicyGroup_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
}

PolicyGroup refers to a group of policies which grant permission to Group, which is limited to MaxGroupNum (default 10). This means that a single resource can only grant permission to 10 groups. The reason for this is to enable on-chain determination of whether an operator has permission within a limited time.

func (*PolicyGroup) Descriptor

func (*PolicyGroup) Descriptor() ([]byte, []int)

func (*PolicyGroup) GetItems

func (m *PolicyGroup) GetItems() []*PolicyGroup_Item

func (*PolicyGroup) Marshal

func (m *PolicyGroup) Marshal() (dAtA []byte, err error)

func (*PolicyGroup) MarshalTo

func (m *PolicyGroup) MarshalTo(dAtA []byte) (int, error)

func (*PolicyGroup) MarshalToSizedBuffer

func (m *PolicyGroup) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PolicyGroup) ProtoMessage

func (*PolicyGroup) ProtoMessage()

func (*PolicyGroup) Reset

func (m *PolicyGroup) Reset()

func (*PolicyGroup) Size

func (m *PolicyGroup) Size() (n int)

func (*PolicyGroup) String

func (m *PolicyGroup) String() string

func (*PolicyGroup) Unmarshal

func (m *PolicyGroup) Unmarshal(dAtA []byte) error

func (*PolicyGroup) XXX_DiscardUnknown

func (m *PolicyGroup) XXX_DiscardUnknown()

func (*PolicyGroup) XXX_Marshal

func (m *PolicyGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PolicyGroup) XXX_Merge

func (m *PolicyGroup) XXX_Merge(src proto.Message)

func (*PolicyGroup) XXX_Size

func (m *PolicyGroup) XXX_Size() int

func (*PolicyGroup) XXX_Unmarshal

func (m *PolicyGroup) XXX_Unmarshal(b []byte) error

type PolicyGroup_Item

type PolicyGroup_Item struct {
	PolicyId Uint `protobuf:"bytes,1,opt,name=policy_id,json=policyId,proto3,customtype=Uint" json:"policy_id"`
	GroupId  Uint `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3,customtype=Uint" json:"group_id"`
}

func (*PolicyGroup_Item) Descriptor

func (*PolicyGroup_Item) Descriptor() ([]byte, []int)

func (*PolicyGroup_Item) Marshal

func (m *PolicyGroup_Item) Marshal() (dAtA []byte, err error)

func (*PolicyGroup_Item) MarshalTo

func (m *PolicyGroup_Item) MarshalTo(dAtA []byte) (int, error)

func (*PolicyGroup_Item) MarshalToSizedBuffer

func (m *PolicyGroup_Item) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PolicyGroup_Item) ProtoMessage

func (*PolicyGroup_Item) ProtoMessage()

func (*PolicyGroup_Item) Reset

func (m *PolicyGroup_Item) Reset()

func (*PolicyGroup_Item) Size

func (m *PolicyGroup_Item) Size() (n int)

func (*PolicyGroup_Item) String

func (m *PolicyGroup_Item) String() string

func (*PolicyGroup_Item) Unmarshal

func (m *PolicyGroup_Item) Unmarshal(dAtA []byte) error

func (*PolicyGroup_Item) XXX_DiscardUnknown

func (m *PolicyGroup_Item) XXX_DiscardUnknown()

func (*PolicyGroup_Item) XXX_Marshal

func (m *PolicyGroup_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PolicyGroup_Item) XXX_Merge

func (m *PolicyGroup_Item) XXX_Merge(src proto.Message)

func (*PolicyGroup_Item) XXX_Size

func (m *PolicyGroup_Item) XXX_Size() int

func (*PolicyGroup_Item) XXX_Unmarshal

func (m *PolicyGroup_Item) XXX_Unmarshal(b []byte) error

type Principal

type Principal struct {
	Type PrincipalType `protobuf:"varint,1,opt,name=type,proto3,enum=greenfield.permission.PrincipalType" json:"type,omitempty"`
	// When the type is an account, its value is sdk.AccAddress().String();
	// when the type is a group, its value is math.Uint().String()
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

Principal define the roles that can grant permissions. Currently, it can be account or group.

func NewPrincipalWithAccount

func NewPrincipalWithAccount(addr sdk.AccAddress) *Principal

func NewPrincipalWithGroupId added in v0.2.3

func NewPrincipalWithGroupId(groupID sdkmath.Uint) *Principal

func NewPrincipalWithGroupInfo added in v0.2.3

func NewPrincipalWithGroupInfo(groupOwner sdk.AccAddress, groupName string) *Principal

func (*Principal) Descriptor

func (*Principal) Descriptor() ([]byte, []int)

func (*Principal) GetAccountAddress

func (p *Principal) GetAccountAddress() (sdk.AccAddress, error)

func (*Principal) GetGroupID

func (p *Principal) GetGroupID() (sdkmath.Uint, error)

func (*Principal) GetType

func (m *Principal) GetType() PrincipalType

func (*Principal) GetValue

func (m *Principal) GetValue() string

func (*Principal) Marshal

func (m *Principal) Marshal() (dAtA []byte, err error)

func (*Principal) MarshalTo

func (m *Principal) MarshalTo(dAtA []byte) (int, error)

func (*Principal) MarshalToSizedBuffer

func (m *Principal) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Principal) MustGetAccountAddress

func (p *Principal) MustGetAccountAddress() sdk.AccAddress

func (*Principal) MustGetGroupID

func (p *Principal) MustGetGroupID() sdkmath.Uint

func (*Principal) ProtoMessage

func (*Principal) ProtoMessage()

func (*Principal) Reset

func (m *Principal) Reset()

func (*Principal) Size

func (m *Principal) Size() (n int)

func (*Principal) String

func (m *Principal) String() string

func (*Principal) Unmarshal

func (m *Principal) Unmarshal(dAtA []byte) error

func (*Principal) ValidateBasic

func (p *Principal) ValidateBasic() error

func (*Principal) XXX_DiscardUnknown

func (m *Principal) XXX_DiscardUnknown()

func (*Principal) XXX_Marshal

func (m *Principal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Principal) XXX_Merge

func (m *Principal) XXX_Merge(src proto.Message)

func (*Principal) XXX_Size

func (m *Principal) XXX_Size() int

func (*Principal) XXX_Unmarshal

func (m *Principal) XXX_Unmarshal(b []byte) error

type PrincipalType

type PrincipalType int32

PrincipalType refers to the identity type of system users or entities. In Greenfield, it usually refers to accounts or groups.

const (
	PRINCIPAL_TYPE_UNSPECIFIED  PrincipalType = 0
	PRINCIPAL_TYPE_GNFD_ACCOUNT PrincipalType = 1
	PRINCIPAL_TYPE_GNFD_GROUP   PrincipalType = 2
)

func (PrincipalType) EnumDescriptor

func (PrincipalType) EnumDescriptor() ([]byte, []int)

func (PrincipalType) String

func (x PrincipalType) String() string

type QueryClient

type QueryClient interface {
	// Parameters queries the parameters of the module.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest is request type for the Query/Params RPC method.

func (*QueryParamsRequest) Descriptor

func (*QueryParamsRequest) Descriptor() ([]byte, []int)

func (*QueryParamsRequest) Marshal

func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error)

func (*QueryParamsRequest) MarshalTo

func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsRequest) MarshalToSizedBuffer

func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

func (m *QueryParamsRequest) Size() (n int)

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsRequest) XXX_Merge

func (m *QueryParamsRequest) XXX_Merge(src proto.Message)

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error

type QueryParamsResponse

type QueryParamsResponse struct {
	// params holds all the parameters of this module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsResponse is response type for the Query/Params RPC method.

func (*QueryParamsResponse) Descriptor

func (*QueryParamsResponse) Descriptor() ([]byte, []int)

func (*QueryParamsResponse) GetParams

func (m *QueryParamsResponse) GetParams() Params

func (*QueryParamsResponse) Marshal

func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)

func (*QueryParamsResponse) MarshalTo

func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsResponse) MarshalToSizedBuffer

func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

func (m *QueryParamsResponse) Size() (n int)

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsResponse) XXX_Merge

func (m *QueryParamsResponse) XXX_Merge(src proto.Message)

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	// Parameters queries the parameters of the module.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
}

QueryServer is the server API for Query service.

type Statement

type Statement struct {
	// effect define the impact of permissions, which can be Allow/Deny
	Effect Effect `protobuf:"varint,1,opt,name=effect,proto3,enum=greenfield.permission.Effect" json:"effect,omitempty"`
	// action_type define the operation type you can act. greenfield defines a set of permission
	// that you can specify in a permissionInfo. see ActionType enum for detail.
	Actions []ActionType `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=greenfield.permission.ActionType" json:"actions,omitempty"`
	// CAN ONLY USED IN bucket level. Support fuzzy match and limit to 5.
	// The sub-resource name must comply with the standard specified in the greenfield/types/grn.go file for Greenfield resource names.
	// If the sub-resources include 'grn:o:{bucket_name}/*' in the statement, it indicates that specific permissions is granted to all objects within the specified bucket.
	// If the sub-resources include 'grn:o:{bucket_name}/test_*' in the statement, it indicates that specific permissions is granted to all objects with the `test_` prefix within the specified bucket.
	// If the sub-resources is empty, when you need to operate(excluding CreateObject) a specified subresource, it will be denied because it cannot match any subresource.
	Resources []string `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"`
	// expiration_time defines how long the permission is valid. If not explicitly specified, it means it will not expire.
	ExpirationTime *time.Time `protobuf:"bytes,4,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"`
	// limit_size defines the total data size that is allowed to operate. If not explicitly specified, it means it will not limit.
	LimitSize *common.UInt64Value `protobuf:"bytes,5,opt,name=limit_size,json=limitSize,proto3" json:"limit_size,omitempty"`
}

func NewMemberStatement

func NewMemberStatement() *Statement

func (*Statement) Descriptor

func (*Statement) Descriptor() ([]byte, []int)

func (*Statement) Eval

func (s *Statement) Eval(action ActionType, opts *VerifyOptions) (Effect, *Statement)

func (*Statement) GetActions

func (m *Statement) GetActions() []ActionType

func (*Statement) GetEffect

func (m *Statement) GetEffect() Effect

func (*Statement) GetExpirationTime added in v0.0.10

func (m *Statement) GetExpirationTime() *time.Time

func (*Statement) GetLimitSize added in v0.0.10

func (m *Statement) GetLimitSize() *common.UInt64Value

func (*Statement) GetResources

func (m *Statement) GetResources() []string

func (*Statement) Marshal

func (m *Statement) Marshal() (dAtA []byte, err error)

func (*Statement) MarshalTo

func (m *Statement) MarshalTo(dAtA []byte) (int, error)

func (*Statement) MarshalToSizedBuffer

func (m *Statement) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Statement) ProtoMessage

func (*Statement) ProtoMessage()

func (*Statement) Reset

func (m *Statement) Reset()

func (*Statement) Size

func (m *Statement) Size() (n int)

func (*Statement) String

func (m *Statement) String() string

func (*Statement) Unmarshal

func (m *Statement) Unmarshal(dAtA []byte) error

func (*Statement) ValidateBasic

func (s *Statement) ValidateBasic(resType resource.ResourceType) error

func (*Statement) XXX_DiscardUnknown

func (m *Statement) XXX_DiscardUnknown()

func (*Statement) XXX_Marshal

func (m *Statement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Statement) XXX_Merge

func (m *Statement) XXX_Merge(src proto.Message)

func (*Statement) XXX_Size

func (m *Statement) XXX_Size() int

func (*Statement) XXX_Unmarshal

func (m *Statement) XXX_Unmarshal(b []byte) error

type Uint

type Uint = math.Uint

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) UpdateParams added in v0.2.0

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

type VerifyOptions added in v0.0.10

type VerifyOptions struct {
	Resource   string
	WantedSize *uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL