代码拉取完成,页面将自动刷新
package ipmi
import "fmt"
// 28.8 Set Power Restore Policy Command
type SetPowerRestorePolicyRequest struct {
PowerRestorePolicy
}
type SetPowerRestorePolicyResponse struct {
SupportPolicyAlwaysOn bool // chassis supports always powering up after AC/mains returns
SupportPolicyPrevious bool // chassis supports restoring power to state that was in effect when AC/mains was lost
SupportPolicyAlwaysOff bool // chassis supports staying powered off after AC/mains returns
}
func (req *SetPowerRestorePolicyRequest) Pack() []byte {
out := make([]byte, 1)
packUint8(uint8(req.PowerRestorePolicy), out, 0)
return out
}
func (req *SetPowerRestorePolicyRequest) Command() Command {
return CommandSetPowerRestorePolicy
}
func (res *SetPowerRestorePolicyResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *SetPowerRestorePolicyResponse) Unpack(msg []byte) error {
if len(msg) < 1 {
return ErrUnpackedDataTooShortWith(len(msg), 1)
}
b, _, _ := unpackUint8(msg, 0)
res.SupportPolicyAlwaysOff = isBit0Set(b)
res.SupportPolicyPrevious = isBit1Set(b)
res.SupportPolicyAlwaysOn = isBit2Set((b))
return nil
}
func (res *SetPowerRestorePolicyResponse) Format() string {
return fmt.Sprintf(`Policy always-off : %s"
Policy always-on : %s
Policy previous :"%s`,
formatBool(res.SupportPolicyAlwaysOff, "supported", "unsupported"),
formatBool(res.SupportPolicyAlwaysOff, "supported", "unsupported"),
formatBool(res.SupportPolicyAlwaysOff, "supported", "unsupported"),
)
}
func (c *Client) SetPowerRestorePolicy(policy PowerRestorePolicy) (response *SetPowerRestorePolicyResponse, err error) {
request := &SetPowerRestorePolicyRequest{
PowerRestorePolicy: policy,
}
response = &SetPowerRestorePolicyResponse{}
err = c.Exchange(request, response)
return
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。