github.com/cyverse/go-irodsclient@v0.13.2/irods/message/user_admin_response.go (about)

     1  package message
     2  
     3  import (
     4  	"github.com/cyverse/go-irodsclient/irods/common"
     5  	"github.com/cyverse/go-irodsclient/irods/types"
     6  	"golang.org/x/xerrors"
     7  )
     8  
     9  // IRODSMessageUserAdminResponse stores alter metadata response
    10  type IRODSMessageUserAdminResponse struct {
    11  	// empty structure
    12  	Result int
    13  }
    14  
    15  // CheckError returns error if server returned an error
    16  func (msg *IRODSMessageUserAdminResponse) CheckError() error {
    17  	if msg.Result < 0 {
    18  		return types.NewIRODSError(common.ErrorCode(msg.Result))
    19  	}
    20  	return nil
    21  }
    22  
    23  // FromMessage returns struct from IRODSMessage
    24  func (msg *IRODSMessageUserAdminResponse) FromMessage(msgIn *IRODSMessage) error {
    25  	if msgIn.Body == nil {
    26  		return xerrors.Errorf("empty message body")
    27  	}
    28  
    29  	msg.Result = int(msgIn.Body.IntInfo)
    30  	return nil
    31  }