File: cmd_deactivate_payload.go

package info (click to toggle)
golang-github-bougou-go-ipmi 0.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,880 kB
  • sloc: makefile: 38
file content (51 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package ipmi

import "context"

// 24.2 Deactivate Payload Command
type DeactivatePayloadRequest struct {
	PayloadType     PayloadType
	PayloadInstance uint8
}

type DeactivatePayloadResponse struct {
}

func (req DeactivatePayloadRequest) Command() Command {
	return CommandDeactivatePayload
}

func (req *DeactivatePayloadRequest) Pack() []byte {
	out := make([]byte, 6)

	out[0] = byte(req.PayloadType)
	out[1] = req.PayloadInstance

	out[2] = 0
	out[3] = 0
	out[4] = 0
	out[5] = 0

	return out
}

func (res *DeactivatePayloadResponse) Unpack(msg []byte) error {
	return nil
}

func (*DeactivatePayloadResponse) CompletionCodes() map[uint8]string {
	return map[uint8]string{
		0x80: "Payload already deactivated",
		0x81: "Payload type is disabled",
	}
}

func (res *DeactivatePayloadResponse) Format() string {
	return ""
}

func (c *Client) DeactivatePayload(ctx context.Context, request *DeactivatePayloadRequest) (response *DeactivatePayloadResponse, err error) {
	response = &DeactivatePayloadResponse{}
	err = c.Exchange(ctx, request, response)
	return
}