Skip to content

open-amt-cloud-toolkit/go-wsman-messages

Repository files navigation

go-wsman-messages

CodeQL Build Codecov OSSF-Scorecard Score Discord

Disclaimer: Production viable releases are tagged and listed under 'Releases'. All other check-ins should be considered 'in-development' and should not be used in production

This repository contains a Go library that implements APIs for communicating with Intel® Active Management Technology (AMT) capable platforms. These APIs are based on the AMT SDK documentation, which can be found here.

How to use it

To use this library, you need to import it in your Go project:

import "github.com/open-amt-cloud-toolkit/go-wsman-messages"

Then, you can create an instance of the wsman.Messages struct by passing in the client parameters using the client.Parameters struct. For example:

clientParams := client.Parameters{
    Target:             "192.168.0.120",
    Username:           "admin",
    Password:           "amtP@ssw0rd",
    UseDigest:          true,
    UseTLS:             true,
    SelfSignedAllowed:  true,
    LogAMTMessages:     true,
}
wsmanMessages := wsman.NewMessages(clientParams)

Next, you can call the various methods of the wsman.Messages struct. Go-wsman-messages will authenticate with AMT using the client parameters provided and send the message to the Intel® AMT device and handle the response, returning a package specific Response struct or error message. For example, to get the general settings of an Intel® AMT device, you can do:

response, err := wsmanMessages.AMT.GeneralSettings.Get()
if err != nil {
    // handle error
}
// process response

Dev tips for passing CI Checks

  • Install gofumpt go install mvdan.cc/gofumpt@latest (replaces gofmt)
  • Install gci go install github.com/daixiang0/gci@latest (organizes imports)
  • Ensure code is formatted correctly with gofumpt -l -w -extra ./
  • Ensure code is gci'd with gci.exe write --skip-generated -s standard -s default .
  • Ensure all unit tests pass with go test ./...
  • Ensure code has been linted with docker run --rm -v ${pwd}:/app -w /app golangci/golangci-lint:latest golangci-lint run -v

About

This repository contains a Go library that creates properly formatted wsman messages to send to Intel® Active Management Technology (AMT) capable platforms. These messages are based on the AMT SDK documentation.

Resources

License

Security policy

Stars

Watchers

Forks

Languages