2020-07-24 13:54:03 +00:00
|
|
|
package container
|
|
|
|
|
2021-05-18 08:12:51 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
|
|
|
// SetEACLArgs groups the arguments
|
|
|
|
// of set eACL invocation call.
|
|
|
|
type SetEACLArgs struct {
|
|
|
|
eacl []byte // extended ACL table
|
|
|
|
|
|
|
|
sig []byte // eACL table signature
|
2021-05-19 11:55:37 +00:00
|
|
|
|
|
|
|
pubkey []byte // binary public key
|
2021-05-25 14:15:27 +00:00
|
|
|
|
|
|
|
token []byte // binary session token
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2021-05-19 11:55:37 +00:00
|
|
|
// SetPublicKey sets public key related to
|
|
|
|
// table signature.
|
|
|
|
func (p *SetEACLArgs) SetPublicKey(v []byte) {
|
|
|
|
p.pubkey = v
|
|
|
|
}
|
|
|
|
|
2020-07-24 13:54:03 +00:00
|
|
|
// SetEACL invokes the call of set eACL method
|
|
|
|
// of NeoFS Container contract.
|
|
|
|
func (c *Client) SetEACL(args SetEACLArgs) error {
|
2021-05-18 08:12:51 +00:00
|
|
|
err := c.client.Invoke(
|
2020-07-24 13:54:03 +00:00
|
|
|
c.setEACLMethod,
|
|
|
|
args.eacl,
|
|
|
|
args.sig,
|
2021-05-19 11:55:37 +00:00
|
|
|
args.pubkey,
|
2021-05-25 14:15:27 +00:00
|
|
|
args.token,
|
2021-05-18 08:12:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.setEACLMethod, err)
|
|
|
|
}
|
|
|
|
return nil
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|