frostfs-node/pkg/morph/client/container/eacl_set.go
Leonard Lyubich 02079a4f89 [#505] morph/container: Add public key argument to set eACL operation
Add `SetEACLArgs.SetPublicKey` method which sets binary public key argument
of the "set eACL" contract call. Attach key to the `Invoke` call.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-25 16:35:52 +03:00

49 lines
949 B
Go

package container
import (
"fmt"
)
// SetEACLArgs groups the arguments
// of set eACL invocation call.
type SetEACLArgs struct {
eacl []byte // extended ACL table
sig []byte // eACL table signature
pubkey []byte // binary public key
}
// SetEACL sets the extended ACL table
// in a binary format.
func (p *SetEACLArgs) SetEACL(v []byte) {
p.eacl = v
}
// SetSignature sets the eACL table structure
// owner's signature.
func (p *SetEACLArgs) SetSignature(v []byte) {
p.sig = v
}
// SetPublicKey sets public key related to
// table signature.
func (p *SetEACLArgs) SetPublicKey(v []byte) {
p.pubkey = v
}
// SetEACL invokes the call of set eACL method
// of NeoFS Container contract.
func (c *Client) SetEACL(args SetEACLArgs) error {
err := c.client.Invoke(
c.setEACLMethod,
args.eacl,
args.sig,
args.pubkey,
)
if err != nil {
return fmt.Errorf("could not invoke method (%s): %w", c.setEACLMethod, err)
}
return nil
}