power

package
v2.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package power facilitates communication with Intel® AMT devices where a class derived from Service describes power management functionality, hosted on a System.

Whether this service might be used to affect the power state of a particular element is defined by the CIM_ServiceAvailable ToElement association.

Index

Constants

View Source
const (
	CIM_PowerManagementService string = "CIM_PowerManagementService"
	RequestPowerStateChange    string = "RequestPowerStateChange"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	XMLName                         xml.Name            `xml:"Body"`
	RequestPowerStateChangeResponse PowerActionResponse `xml:"RequestPowerStateChange_OUTPUT"`
	GetResponse                     PowerManagementService
	EnumerateResponse               common.EnumerateResponse
	PullResponse                    PullResponse
}

Response Types

type EnabledState added in v2.2.4

type EnabledState int

EnabledState is an integer enumeration that indicates the enabled and disabled states of an element.

const (
	EnabledStateUnknown EnabledState = iota
	EnabledStateOther
	EnabledStateEnabled
	EnabledStateDisabled
	EnabledStateShuttingDown
	EnabledStateNotApplicable
	EnabledStateEnabledButOffline
	EnabledStateInTest
	EnabledStateDeferred
	EnabledStateQuiesce
	EnabledStateStarting
)

func (EnabledState) String added in v2.2.4

func (e EnabledState) String() string

String returns a human-readable string representation of the EnabledState enumeration

type ManagementService

type ManagementService struct {
	// contains filtered or unexported fields
}

func NewPowerManagementServiceWithClient

func NewPowerManagementServiceWithClient(wsmanMessageCreator *message.WSManMessageCreator, client client.WSMan) ManagementService

NewPowerManagementService returns a new instance of the PowerManagementService struct.

func (ManagementService) Enumerate

func (managementService ManagementService) Enumerate() (response Response, err error)

// Enumerate returns an enumeration context which is used in a subsequent Pull call

func (ManagementService) Get

func (managementService ManagementService) Get() (response Response, err error)

Get retrieves the representation of the instance

func (ManagementService) Pull

func (managementService ManagementService) Pull(enumerationContext string) (response Response, err error)

Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input.

func (ManagementService) RequestPowerStateChange

func (managementService ManagementService) RequestPowerStateChange(powerState PowerState) (response Response, err error)

RequestPowerStateChange defines the desired power state of the managed element, and when the element should be put into that state.

type PowerActionResponse

type PowerActionResponse struct {
	ReturnValue ReturnValue `xml:"ReturnValue"`
}

Response Types

type PowerManagementService

type PowerManagementService struct {
	XMLName                 xml.Name       `xml:"CIM_PowerManagementService"`
	CreationClassName       string         `xml:"CreationClassName,omitempty"`       // CreationClassName indicates the name of the class or the subclass that is used in the creation of an instance.
	ElementName             string         `xml:"ElementName,omitempty"`             // A user-friendly name for the object.
	EnabledState            EnabledState   `xml:"EnabledState,omitempty"`            // EnabledState is an integer enumeration that indicates the enabled and disabled states of an element.
	Name                    string         `xml:"Name,omitempty"`                    // The Name property uniquely identifies the Service and provides an indication of the functionality that is managed.
	RequestedState          RequestedState `xml:"RequestedState,omitempty"`          // RequestedState is an integer enumeration that indicates the last requested or desired state for the element, irrespective of the mechanism through which it was requested.
	SystemCreationClassName string         `xml:"SystemCreationClassName,omitempty"` // The CreationClassName of the scoping System.
	SystemName              string         `xml:"SystemName,omitempty"`              // The Name of the scoping System.
}

Response Types

type PowerState

type PowerState int
const (
	// Power On
	PowerOn PowerState = 2 // Verified Hardware Power On

	// Sleep - Light
	SleepLight PowerState = 3 // ?

	// Sleep - Deep
	SleepDeep PowerState = 4 // ?

	// Power Cycle (Off Soft)
	PowerCycleOffSoft PowerState = 6 // ?

	// Power Off - Hard
	PowerOffHard PowerState = 8 // Verfied Hardware Power Off

	// Hibernate
	Hibernate PowerState = 7 // ?

	// Power Off - Soft
	PowerOffSoft PowerState = 9 // ?

	// Power Cycle (Off Hard)
	PowerCycleOffHard PowerState = 5 // Verified Hardware Power Cycle (off then on)

	// Master Bus Reset
	MasterBusReset PowerState = 10 // Verified Hardware Reboot

	// Diagnostic Interrupt (NMI)
	DiagnosticInterruptNMI PowerState = 11 // ?

	// Power Off - Soft Graceful
	PowerOffSoftGraceful PowerState = 12 // ?

	// Power Off - Hard Graceful
	PowerOffHardGraceful PowerState = 13 // ?

	// Master Bus Reset Graceful
	MasterBusResetGraceful PowerState = 14 // ?

	// Power Cycle (Off - Soft Graceful)
	PowerCycleOffSoftGraceful PowerState = 15 // ?

	// Power Cycle (Off - Hard Graceful)
	PowerCycleOffHardGraceful PowerState = 16 // ?
)

TODO: This list of contants needs to be scrubbed

type PullResponse

type PullResponse struct {
	XMLName                     xml.Name                 `xml:"PullResponse"`
	PowerManagementServiceItems []PowerManagementService `xml:"Items>CIM_PowerManagementService"`
}

Response Types

type RequestedState added in v2.2.4

type RequestedState int

RequestedState is an integer enumeration that indicates the last requested or desired state for the element, irrespective of the mechanism through which it was requested.

const (
	RequestedStateUnknown       RequestedState = 0
	RequestedStateEnabled       RequestedState = 2
	RequestedStateDisabled      RequestedState = 3
	RequestedStateShutDown      RequestedState = 4
	RequestedStateNoChange      RequestedState = 5
	RequestedStateOffline       RequestedState = 6
	RequestedStateTest          RequestedState = 7
	RequestedStateDeferred      RequestedState = 8
	RequestedStateQuiesce       RequestedState = 9
	RequestedStateReboot        RequestedState = 10
	RequestedStateReset         RequestedState = 11
	RequestedStateNotApplicable RequestedState = 12
)

func (RequestedState) String added in v2.2.4

func (e RequestedState) String() string

String returns a human-readable string representation of the RequestedState enumeration

type Response

type Response struct {
	*client.Message
	XMLName xml.Name       `xml:"Envelope"`
	Header  message.Header `xml:"Header"`
	Body    Body           `xml:"Body"`
}

Response Types

func (*Response) JSON

func (r *Response) JSON() string

JSON marshals the type into JSON format

func (*Response) YAML

func (r *Response) YAML() string

YAML marshals the type into YAML format

type ReturnValue added in v2.2.4

type ReturnValue int

ReturnValue is an integer enumeration that indicates the success or failure of an operation.

const (
	ReturnValueCompletedWithNoError              ReturnValue = 0
	ReturnValueMethodNotSupported                ReturnValue = 1
	ReturnValueUnknownError                      ReturnValue = 2
	ReturnValueCannotCompleteWithinTimeoutPeriod ReturnValue = 3
	ReturnValueFailed                            ReturnValue = 4
	ReturnValueInvalidParameter                  ReturnValue = 5
	ReturnValueInUse                             ReturnValue = 6
	ReturnValueMethodParametersCheckedJobStarted ReturnValue = 4096
	ReturnValueInvalidStateTransition            ReturnValue = 4097
	ReturnValueUseOfTimeoutParameterNotSupported ReturnValue = 4098
	ReturnValueBusy                              ReturnValue = 4099
)

func (ReturnValue) String added in v2.2.4

func (e ReturnValue) String() string

String returns a human-readable string representation of the ReturnValue enumeration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL