wmi

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class interface {
	ClassName() string
	SuperClassName() string
	ServerName() string
	Namespace() string
	SuperClass() *Class
	Properties() []string
	Qualifiers() []string
	Methods() []string
	MethodParameters(string) []string
	InvokeMethod(string, []string, string) (error, string)
	Dispose()
}

Class

type Credentials

type Credentials struct {
	UserName string
	Password string
	Domain   string
}

Credentials

func (Credentials) GetSecureString

func (cred Credentials) GetSecureString() (string, error)

GetSecureString

type Instance

type Instance interface {
	GetInstance() (*Instance, error)
	GetProperty(name string) (string, error)
	SetProperty(name, value string) (string, error)
	ResetProperty(name string) (string, error)
	Class() *Class
	EmbeddedInstance() (string, error)
	InstanceManager() *InstanceManager
	Equals(*Instance) bool
	Refresh() error
	Commit() error
	Modify() error
	Delete() error
	InstancePath() (string, error)
	InvokeMethod(namespaceName string, methodName string, methodParameters *[]MethodParameter) (MethodResult, error)
	GetRelated(resultClassName string) (*[]Instance, error)
	GetRelatedEx(resultClassName, associatedClassName, resultRole, sourceRole string) (*[]Instance, error)
	GetAssociated(resultClassName, associatedClassName, resultRole, sourceRole string) (*[]Instance, error)
	EnumerateReferencingInstances(associatedClassName, sourceRole string) (*[]Instance, error)
	Dispose()
}

Instance represents an interface for the wmi instance

type InstanceManager

type InstanceManager interface {
	ServerName() string
	Namespace() string
	Credentials() *Credentials
	EnumerateInstances(className string) (*[]Instance, error)
	QueryInstances(query string) (*[]Instance, error)
	QueryInstancesEx(query Query) (*[]Instance, error)

	CreateInstance(className string, propertyValues map[string]string) (*Instance, error)
	GetInstance(className string, propertyValues map[string]string) (*Instance, error)
	GetClass(className string) (*Class, error)
	EnumerateClasses() (*[]Class, error)
	GetInstancesFromPaths(pathArray []string) (*[]Instance, error)
}

InstanceManager interface

type MethodDeclaration

type MethodDeclaration struct {
	Name       string
	Parameters *[]MethodParameter
	Qualifiers *[]Qualifier
}

type MethodParameter

type MethodParameter struct {
	Name  string
	Value interface{}
	Type  WmiType
}

MethodParameter

type MethodParameterCollection

type MethodParameterCollection []MethodParameter

MethodParameterCollection

func (MethodParameterCollection) Contains

func (c MethodParameterCollection) Contains(paramName string) bool

Contains

func (MethodParameterCollection) Get

func (c MethodParameterCollection) Get(paramName string) (val *MethodParameter, err error)

Contains

func (MethodParameterCollection) GetValue

func (c MethodParameterCollection) GetValue(paramName string, value interface{}) error

GetValue

func (MethodParameterCollection) GetValueArray

func (c MethodParameterCollection) GetValueArray(paramName string, value interface{}) error

GetValueArray

type MethodResult

type MethodResult struct {
	ReturnValue   *MethodParameter
	OutParameters *MethodParameterCollection
}

MethodResult

type Property

type Property interface {
	Name() string
	Value() string
	Type() WmiType
	Flags() PropertyFlags
}

Property

type PropertyFlags

type PropertyFlags int
const (
	// None
	None PropertyFlags = 0
	// Class
	WClass PropertyFlags = 1
	// Method
	Method PropertyFlags = 2
	// Property
	WProperty PropertyFlags = 4
	// Parameter
	Parameter PropertyFlags = 8
	// Association
	Association PropertyFlags = 16
	// Indication
	Indication PropertyFlags = 32
	// Reference
	Reference PropertyFlags = 64
	// Any
	Any PropertyFlags = 127
	// EnableOverride
	EnableOverride PropertyFlags = 128
	// DisableOverride
	DisableOverride PropertyFlags = 256
	// Restricted
	Restricted PropertyFlags = 512
	// ToSubClass
	ToSubclass PropertyFlags = 1024
	// Translatable
	Translatable PropertyFlags = 2048
	// Key
	Key PropertyFlags = 4096
	// In
	In PropertyFlags = 8192
	// Out
	Out PropertyFlags = 16384
	// Required
	Required PropertyFlags = 32768
	// Static
	Static PropertyFlags = 65536
	// Abstract
	Abstract PropertyFlags = 131072
	// Terminal
	Terminal PropertyFlags = 262144
	// Expensive
	Expensive PropertyFlags = 524288
	// Stream
	Stream PropertyFlags = 1048576
	// ReadOnly
	ReadOnly PropertyFlags = 2097152
	// NotModified
	NotModified PropertyFlags = 33554432
	// NullValue
	NullValue PropertyFlags = 536870912
	// Borrow
	Borrow PropertyFlags = 1073741824
)

type Qualifier

type Qualifier interface {
	Name() string
	Value() string
}

type Query

type Query interface {
	ClassName() string
	QueryString() string
}

Query

type QueryFilter

type QueryFilter struct {
	Name      string
	Value     string
	Operation WhereOperation
}

func (QueryFilter) GetFilter

func (q QueryFilter) GetFilter() string

GetFilter

type Session

type Session interface {
	Connect() (bool, error)
	Dispose()
	TestConnection() bool
	GetProperty(name string) string
	SetProperty(name, value string) string
	ResetProperty(name string) string
	GetClass(namespaceName, className string) (*Class, error)
	GetInstance(namespaceName string, instance *Instance) (*Instance, error)
	EnumerateClasses(namespaceName, className string) (*[]Class, error)
	EnumerateInstances(namespaceName, className string) (*[]Instance, error)
	QueryInstances(namespaceName, queryDislect, queryExpression string) (*[]Instance, error)
	EnumerateReferencingInstances(namespaceName string, sourceInstance Instance, associationClassName, sourceRole string) (*[]Instance, error)
}

Session

type SessionStatus

type SessionStatus int
const (
	Created      SessionStatus = 0
	Connected    SessionStatus = 1
	Disconnected SessionStatus = 2
	Disposed     SessionStatus = 3
)

type WhereOperation

type WhereOperation int
const (
	Equals            WhereOperation = 0
	LessThan          WhereOperation = 1
	GreaterThan       WhereOperation = 2
	LessThanEquals    WhereOperation = 3
	GreaterThenEquals WhereOperation = 4
	NotEqual          WhereOperation = 5
	Like              WhereOperation = 6
)

type WmiType

type WmiType int
const (
	WbemCimtypeSint8     WmiType = 16
	WbemCimtypeUint8     WmiType = 17
	WbemCimtypeSint16    WmiType = 2
	WbemCimtypeUint16    WmiType = 18
	WbemCimtypeSint32    WmiType = 3
	WbemCimtypeUint32    WmiType = 19
	WbemCimtypeSint64    WmiType = 20
	WbemCimtypeUint64    WmiType = 21
	WbemCimtypeReal32    WmiType = 4
	WbemCimtypeReal64    WmiType = 5
	WbemCimtypeBoolean   WmiType = 11
	WbemCimtypeString    WmiType = 8
	WbemCimtypeDatetime  WmiType = 101
	WbemCimtypeReference WmiType = 102
	WbemCimtypeChar16    WmiType = 103
	WbemCimtypeObject    WmiType = 13
)

Jump to

Keyboard shortcuts

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