Documentation
¶
Overview ¶
Package wsman implements a simple WSMAN client interface. It assumes you are talking to WSMAN over http(s) and using basic authentication.
Index ¶
- Constants
- func Resource(uri string) *dom.Element
- type Client
- func (c *Client) Create(resource string) *Message
- func (c *Client) Delete(resource string) *Message
- func (c *Client) Endpoint() string
- func (c *Client) Enumerate(resource string) *Message
- func (c *Client) EnumerateEPR(resource string) *Message
- func (c *Client) Get(resource string) *Message
- func (c *Client) Identify() (*soap.Message, error)
- func (c *Client) Invoke(resource, method string) *Message
- func (c *Client) NewMessage(action string) (msg *Message)
- func (c *Client) Post(msg *soap.Message) (response *soap.Message, err error)
- func (c *Client) Put(resource string) *Message
- type Message
- func (m *Message) AddOption(options ...*dom.Element) *Message
- func (m *Message) AddParameter(parameters ...*dom.Element) *Message
- func (m *Message) AddSelector(selector ...*dom.Element) *Message
- func (m *Message) AddValue(values ...*dom.Element) *Message
- func (m *Message) EnumItems() ([]*dom.Element, error)
- func (m *Message) GHC(field string) (string, error)
- func (m *Message) GetItem() (*dom.Element, error)
- func (m *Message) GetResource() string
- func (m *Message) InvokeResponse() (*dom.Element, string, error)
- func (m *Message) MakeOption(name string) *dom.Element
- func (m *Message) MakeParameter(name string) *dom.Element
- func (m *Message) MakeSelector(name string) *dom.Element
- func (m *Message) MakeValue(name string) *dom.Element
- func (m *Message) Options(opts ...string) *Message
- func (m *Message) Parameters(args ...string) *Message
- func (m *Message) ResourceURI(resource string) *Message
- func (m *Message) Selectors(args ...string) *Message
- func (m *Message) Send() (*Message, error)
- func (m *Message) Values(args ...string) *Message
Constants ¶
const ( // Models any simple single item retrieval GET = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get" // Models an update of an entire item PUT = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put" // Models creation of a new item CREATE = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create" // Models the deletion of an item DELETE = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete" // Begins an enumeration or query ENUMERATE = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate" // Retrieves the next batch of results from enumeration PULL = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull" // Releases an active enumerator RELEASE = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Release" // Models a subscription to an event source SUBSCRIBE = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe" // Renews a subscription prior to its expiration RENEW = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew" // Requests the status of a subscription GET_STATUS = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus" // Removes an active subscription UNSUBSCRIBE = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe" // Delivers a message to indicate that a subscription has terminated SUBSCRIBE_END = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd" // Delivers batched events based on a subscription EVENTS = "http://schemas.dmtf.org/wbem/wsman/1/wsman/Events" // A pseudo-event that models a heartbeat of an active subscription; // delivered when no real events are available, but used to indicate that the // event subscription and delivery mechanism is still active HEARTBEAT = "http://schemas.dmtf.org/wbem/wsman/1/wsman/Heartbeat" // A pseudo-event that indicates that the real event was dropped DROPPED_EVENTS = "http://schemas.dmtf.org/wbem/wsman/1/wsman/DroppedEvents" // Used by event subscribers to acknowledge receipt of events; // allows event streams to be strictly sequenced ACK = "http://schemas.dmtf.org/wbem/wsman/1/wsman/Ack" // Used for a singleton event that does not define its own action EVENT = "http://schemas.dmtf.org/wbem/wsman/1/wsman/Event" )
const ( NS_WSMAN = "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" NS_WSMID = "http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd" NS_WSDL = "http://schemas.xmlsoap.org/wsdl" NS_WSA = "http://schemas.xmlsoap.org/ws/2004/08/addressing" NS_WSA10 = "http://www.w3.org/2005/08/addressing" NS_WSAM = "http://www.w3.org/2007/05/addressing/metadata" NS_WSME = "http://schemas.xmlsoap.org/ws/2004/08/eventing" NS_WSMEN = "http://schemas.xmlsoap.org/ws/2004/09/enumeration" NS_WSMT = "http://schemas.xmlsoap.org/ws/2004/09/transfer" NS_WSP = "http://schemas.xmlsoap.org/ws/2004/09/policy" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { http.Client Debug, OptimizeEnum bool // contains filtered or unexported fields }
Client is a thin wrapper around http.Client.
func NewClient ¶
NewClient creates a new wsman.Client.
target must be a URL, and username and password must be the username and password to authenticate to the controller with. If username or password are empty, we will not try to authenticate. If useDigest is true, we will try to use digest auth instead of basic auth.
func (*Client) Create ¶
Create creates a wsman.Message that will update the passed-in resource. The updated resource should be passed in as the only element in the Body of the messate.
func (*Client) Delete ¶
Delete creates a wsman.Message that will update the passed-in resource. The updated resource should be passed in as the only element in the Body of the messate.
func (*Client) Endpoint ¶
Endpoint returns the endpoint that the Client will try to ocmmunicate with.
func (*Client) Enumerate ¶
Enumerate creates a wsman.Message that will enumerate all the objects available at resource. If there are many objects, it will arrange for the appropriate series of wsman Pull calls to be performed, so you can be certian that the response to this message has all the objects you specify.
func (*Client) EnumerateEPR ¶
EnumerateEPR creates a message that will enumerate the endpoints for a given resource.
func (*Client) Get ¶
Get creates a wsman.Message that will get an instance at the passed-in resource.
func (*Client) Identify ¶
Identify performs a basic WSMAN IDENTIFY call. The response will provide the version of WSMAN the endpoint speaks, along with some details about the WSMAN endpoint itself. Note that identify uses soap.Message directly instead of wsman.Message.
func (*Client) Invoke ¶
Invoke creates a wsman.Message that will invoke method on resource. After creating the Message, you need to add the appropriate selectors with msg.Selectors(), and the appropriate parameters with msg.Parameters()
func (*Client) NewMessage ¶
NewMessage creates a new wsman.Message that can be sent via c. It populates the message with the passed action and some other necessary headers.
type Message ¶
Message represents WSMAN messages
func (*Message) AddOption ¶
AddOption adds any number of elements (created with MakeOption) to the message header.
func (*Message) AddParameter ¶
AddParameter adds any number of elements (created with MakeParameter) to the message.
func (*Message) AddSelector ¶
AddSelector adds any number of elements (created with MakeSelector) to the message.
func (*Message) GetResource ¶
func (*Message) MakeOption ¶
MakeOption makes an element that can be added as an option to the message header with AddOption.
func (*Message) MakeParameter ¶
MakeParameter makes an element which can be added to the message with AddParameter
func (*Message) MakeSelector ¶
MakeSelector makes an element that can be added to the message with AddSelector
func (*Message) MakeValue ¶
MakeValue makes an element that can be used to set a new instance value for a Put call
func (*Message) Options ¶
Options is a fast way of creating options that are basically key/value pairs
func (*Message) Parameters ¶
Parameters sets the parameters for an invoke call. It takes an even number of strings, which should be key:value pairs. It works alot like Options, except it adds the parameters to the Body in the format that WSMAN expects parameter elements to be in.
func (*Message) ResourceURI ¶
ResourceURI sets the ResourceURI header of the message
func (*Message) Selectors ¶
Selectors are used to target the resource that Get, Put, and Invoke should work with. They work like Options does, except they add a SelectorSet element with Selectors instead of Options.