2020-12-21 13:47:02 +00:00
|
|
|
package audit
|
|
|
|
|
|
|
|
import (
|
2021-05-18 08:12:51 +00:00
|
|
|
"fmt"
|
2021-11-09 20:52:29 +00:00
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
2020-12-21 13:47:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// PutAuditResultArgs groups the arguments
|
|
|
|
// of "put audit result" invocation call.
|
|
|
|
type PutAuditResultArgs struct {
|
|
|
|
rawResult []byte // audit result in NeoFS API-compatible binary representation
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetRawResult sets audit result structure
|
|
|
|
// in NeoFS API-compatible binary representation.
|
|
|
|
func (g *PutAuditResultArgs) SetRawResult(v []byte) {
|
|
|
|
g.rawResult = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// PutAuditResult invokes the call of "put audit result" method
|
|
|
|
// of NeoFS Audit contract.
|
|
|
|
func (c *Client) PutAuditResult(args PutAuditResultArgs) error {
|
2021-11-09 20:52:29 +00:00
|
|
|
prm := client.InvokePrm{}
|
|
|
|
|
|
|
|
prm.SetMethod(c.putResultMethod)
|
|
|
|
prm.SetArgs(args.rawResult)
|
|
|
|
|
|
|
|
err := c.client.Invoke(prm)
|
2021-05-18 08:12:51 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.putResultMethod, err)
|
|
|
|
}
|
|
|
|
return nil
|
2020-12-21 13:47:02 +00:00
|
|
|
}
|