File: cmd_get_supermicro_bios_version.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 (44 lines) | stat: -rw-r--r-- 1,106 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
package ipmi

import (
	"context"
	"fmt"
	"strings"
)

type CommandGetSupermicroBiosVersionRequest struct {
}

type CommandGetSupermicroBiosVersionResponse struct {
	Version string
}

func (req *CommandGetSupermicroBiosVersionRequest) Command() Command {
	return CommandGetSupermicroBiosVersion
}

func (req *CommandGetSupermicroBiosVersionRequest) Pack() []byte {
	return []byte{0x00, 0x00}
}

func (res *CommandGetSupermicroBiosVersionResponse) Unpack(msg []byte) error {
	res.Version = string(msg)
	res.Version = strings.TrimSpace(res.Version)
	return nil
}

func (res *CommandGetSupermicroBiosVersionResponse) CompletionCodes() map[uint8]string {
	return map[uint8]string{}
}

func (res *CommandGetSupermicroBiosVersionResponse) Format() string {
	return "" +
		fmt.Sprintf("bios.version = %s\n", res.Version)
}

func (c *Client) GetSupermicroBiosVersion(ctx context.Context) (response *CommandGetSupermicroBiosVersionResponse, err error) {
	request := &CommandGetSupermicroBiosVersionRequest{}
	response = &CommandGetSupermicroBiosVersionResponse{}
	err = c.Exchange(ctx, request, response)
	return
}