govmomi: Index | Files

package soap

import ""


Package Files

client.go debug.go error.go soap.go


const (
    SessionCookieName = "vmware_soap_session"


var DefaultDownload = Download{
    Method: "GET",
var DefaultUpload = Upload{
    Type:   "application/octet-stream",
    Method: "PUT",

func IsRegularError Uses

func IsRegularError(err error) bool

func IsSoapFault Uses

func IsSoapFault(err error) bool

func IsVimFault Uses

func IsVimFault(err error) bool

func ParseURL Uses

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

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

func ThumbprintSHA1 Uses

func ThumbprintSHA1(cert *x509.Certificate) string

ThumbprintSHA1 returns the thumbprint of the given cert in the same format used by the SDK and Client.SetThumbprint.

See: SSLVerifyFault.Thumbprint, SessionManagerGenericServiceTicket.Thumbprint, HostConnectSpec.SslThumbprint

func ToRegularError Uses

func ToRegularError(err error) error

func ToVimFault Uses

func ToVimFault(err error) types.BaseMethodFault

func Wrap Uses

func Wrap(err error) error

func WrapRegularError Uses

func WrapRegularError(err error) error

func WrapSoapFault Uses

func WrapSoapFault(f *Fault) error

func WrapVimFault Uses

func WrapVimFault(v types.BaseMethodFault) error

type Client Uses

type Client struct {

    Namespace string // Vim namespace
    Version   string // Vim version
    Types     types.Func
    UserAgent string
    // contains filtered or unexported fields

func NewClient Uses

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

func (*Client) Certificate Uses

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

func (*Client) CloseIdleConnections Uses

func (c *Client) CloseIdleConnections()

func (*Client) DefaultTransport Uses

func (c *Client) DefaultTransport() *http.Transport

func (*Client) Do Uses

func (c *Client) Do(ctx context.Context, req *http.Request, f func(*http.Response) error) error

func (*Client) Download Uses

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

Download GETs the remote file from the given URL

func (*Client) DownloadFile Uses

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

DownloadFile GETs the given URL to a local file

func (*Client) DownloadRequest Uses

func (c *Client) DownloadRequest(ctx context.Context, u *url.URL, param *Download) (*http.Response, error)

DownloadRequest wraps http.Client.Do, returning the http.Response without checking its StatusCode

func (*Client) LoadThumbprints Uses

func (c *Client) LoadThumbprints(file string) error

LoadThumbprints from file with the give name. If name is empty or name does not exist this function will return nil.

func (*Client) MarshalJSON Uses

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

func (*Client) NewServiceClient Uses

func (c *Client) NewServiceClient(path string, namespace string) *Client

NewServiceClient creates a NewClient with the given URL.Path and namespace.

func (*Client) ParseURL Uses

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 Uses

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

func (*Client) SetCertificate Uses

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

func (*Client) SetRootCAs Uses

func (c *Client) SetRootCAs(file string) error

SetRootCAs defines the set of root certificate authorities that clients use when verifying server certificates. By default TLS uses the host's root CA set.

See: http.Client.Transport.TLSClientConfig.RootCAs

func (*Client) SetThumbprint Uses

func (c *Client) SetThumbprint(host string, thumbprint string)

SetThumbprint sets the known certificate thumbprint for the given host. A custom DialTLS function is used to support thumbprint based verification. We first try tls.Dial with the default tls.Config, only falling back to thumbprint verification if it fails with an x509.UnknownAuthorityError or x509.HostnameError

See: http.Client.Transport.DialTLS

func (*Client) Thumbprint Uses

func (c *Client) Thumbprint(host string) string

Thumbprint returns the certificate thumbprint for the given host if known to this client.

func (*Client) Tunnel Uses

func (c *Client) Tunnel() *Client

Tunnel returns a Client configured to proxy requests through vCenter's http port 80, to the SDK tunnel virtual host. Use of the SDK tunnel is required by LoginExtensionByCertificate() and optional for other methods.

func (*Client) URL Uses

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

func (*Client) UnmarshalJSON Uses

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

func (*Client) Upload Uses

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

Upload PUTs the local file to the given URL

func (*Client) UploadFile Uses

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

UploadFile PUTs the local file to the given URL

func (*Client) WithHeader Uses

func (c *Client) WithHeader(ctx context.Context, header Header) context.Context

WithHeader can be used to modify the outgoing request soap.Header fields.

func (*Client) WriteFile Uses

func (c *Client) WriteFile(ctx context.Context, file string, src io.Reader, size int64, s progress.Sinker, w io.Writer) error

type Download Uses

type Download struct {
    Method   string
    Headers  map[string]string
    Ticket   *http.Cookie
    Progress progress.Sinker
    Writer   io.Writer

type Envelope Uses

type Envelope struct {
    XMLName xml.Name `xml:" Envelope"`
    Header  *Header  `xml:" Header,omitempty"`
    Body    interface{}

type Fault Uses

type Fault struct {
    XMLName xml.Name `xml:" Fault"`
    Code    string   `xml:"faultcode"`
    String  string   `xml:"faultstring"`
    Detail  struct {
        Fault types.AnyType `xml:",any,typeattr"`
    }   `xml:"detail"`

func ToSoapFault Uses

func ToSoapFault(err error) *Fault

func (*Fault) VimFault Uses

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

type HasFault Uses

type HasFault interface {
    Fault() *Fault
type Header struct {
    Action   string      `xml:"-"`                         // Action is the 'SOAPAction' HTTP header value. Defaults to "Client.Namespace/Client.Version".
    Cookie   string      `xml:"vcSessionCookie,omitempty"` // Cookie is a vCenter session cookie that can be used with other SDK endpoints (e.g. pbm).
    ID       string      `xml:"operationID,omitempty"`     // ID is the operationID used by ESX/vCenter logging for correlation.
    Security interface{} `xml:",omitempty"`                // Security is used for SAML token authentication and request signing.

Header includes optional soap Header fields.

type RoundTripper Uses

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

type Signer Uses

type Signer interface {
    Sign(Envelope) ([]byte, error)

Signer can be implemented by soap.Header.Security to sign requests. If the soap.Header.Security field is set to an implementation of Signer via WithHeader(), then Client.RoundTrip will call Sign() to marshal the SOAP request.

type Upload Uses

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

Package soap imports 29 packages (graph) and is imported by 887 packages. Updated 2020-07-16. Refresh now. Tools for package owners.