soap

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: Apache-2.0 Imports: 22 Imported by: 1,593

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDownload = Download{
	Method: "GET",
}
View Source
var DefaultUpload = Upload{
	Type:   "application/octet-stream",
	Method: "PUT",
}
View Source
var DefaultVimNamespace = "urn:vim25"
View Source
var DefaultVimVersion = "6.0"

Functions

func IsRegularError

func IsRegularError(err error) bool

func IsSoapFault

func IsSoapFault(err error) bool

func IsVimFault

func IsVimFault(err error) bool

func ParseURL added in v0.3.0

func ParseURL(s string) (*url.URL, error)

ParseURL is wrapper around url.Parse, where Scheme defaults to "https" and Path defaults to "/sdk"

func ToRegularError

func ToRegularError(err error) error

func ToVimFault

func ToVimFault(err error) types.BaseMethodFault

func Wrap

func Wrap(err error) error

func WrapRegularError

func WrapRegularError(err error) error

func WrapSoapFault

func WrapSoapFault(f *Fault) error

func WrapVimFault

func WrapVimFault(v types.BaseMethodFault) error

Types

type Client

type Client struct {
	http.Client

	Namespace string // Vim namespace
	Version   string // Vim version
	// contains filtered or unexported fields
}

func NewClient

func NewClient(u *url.URL, insecure bool) *Client

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections()

func (*Client) Download added in v0.6.0

func (c *Client) Download(u *url.URL, param *Download) (io.ReadCloser, int64, error)

Download GETs the remote file from the given URL

func (*Client) DownloadFile

func (c *Client) DownloadFile(file string, u *url.URL, param *Download) error

DownloadFile GETs the given URL to a local file

func (*Client) MarshalJSON

func (c *Client) MarshalJSON() ([]byte, error)

func (*Client) ParseURL

func (c *Client) ParseURL(urlStr string) (*url.URL, error)

ParseURL wraps url.Parse to rewrite the URL.Host field In the case of VM guest uploads or NFC lease URLs, a Host field with a value of "*" is rewritten to the Client's URL.Host.

func (*Client) RoundTrip

func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error

func (*Client) SetCertificate added in v0.3.0

func (c *Client) SetCertificate(cert tls.Certificate)

func (*Client) URL

func (c *Client) URL() *url.URL

func (*Client) UnmarshalJSON

func (c *Client) UnmarshalJSON(b []byte) error

func (*Client) Upload

func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error

Upload PUTs the local file to the given URL

func (*Client) UploadFile

func (c *Client) UploadFile(file string, u *url.URL, param *Upload) error

UploadFile PUTs the local file to the given URL

type Download

type Download struct {
	Method   string
	Ticket   *http.Cookie
	Progress progress.Sinker
}

type Envelope

type Envelope struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
	Header  *Header  `xml:",omitempty"`
	Body    interface{}
}

type Fault

type Fault struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"`
	Code    string   `xml:"faultcode"`
	String  string   `xml:"faultstring"`
	Detail  struct {
		Fault types.AnyType `xml:",any,typeattr"`
	} `xml:"detail"`
}

func ToSoapFault

func ToSoapFault(err error) *Fault

func (*Fault) VimFault

func (f *Fault) VimFault() types.AnyType

type HasFault

type HasFault interface {
	Fault() *Fault
}
type Header struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"`
}

type RoundTripper

type RoundTripper interface {
	RoundTrip(ctx context.Context, req, res HasFault) error
}

type Upload

type Upload struct {
	Type          string
	Method        string
	ContentLength int64
	Headers       map[string]string
	Ticket        *http.Cookie
	Progress      progress.Sinker
}

Jump to

Keyboard shortcuts

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