Update vmware/govmomi vendor: add vapi package
Zones implementation for vSphere cloud provider needs dependencies which are not included in current vmware/govmomi vendor. So this update added "vapi" package to support zones.
This commit is contained in:
2
vendor/github.com/vmware/govmomi/vim25/client.go
generated
vendored
2
vendor/github.com/vmware/govmomi/vim25/client.go
generated
vendored
@@ -28,7 +28,7 @@ import (
|
||||
|
||||
const (
|
||||
Namespace = "vim25"
|
||||
Version = "6.5"
|
||||
Version = "6.7"
|
||||
Path = "/sdk"
|
||||
)
|
||||
|
||||
|
||||
16
vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go
generated
vendored
16
vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go
generated
vendored
@@ -65,6 +65,22 @@ func ObjectContentToType(o types.ObjectContent) (interface{}, error) {
|
||||
return v.Elem().Interface(), nil
|
||||
}
|
||||
|
||||
// ApplyPropertyChange converts the response of a call to WaitForUpdates
|
||||
// and applies it to the given managed object.
|
||||
func ApplyPropertyChange(obj Reference, changes []types.PropertyChange) {
|
||||
t := typeInfoForType(obj.Reference().Type)
|
||||
v := reflect.ValueOf(obj)
|
||||
|
||||
for _, p := range changes {
|
||||
rv, ok := t.props[p.Name]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
assignValue(v, rv, reflect.ValueOf(p.Val))
|
||||
}
|
||||
}
|
||||
|
||||
// LoadRetrievePropertiesResponse converts the response of a call to
|
||||
// RetrieveProperties to one or more managed objects.
|
||||
func LoadRetrievePropertiesResponse(res *types.RetrievePropertiesResponse, dst interface{}) error {
|
||||
|
||||
46
vendor/github.com/vmware/govmomi/vim25/mo/type_info.go
generated
vendored
46
vendor/github.com/vmware/govmomi/vim25/mo/type_info.go
generated
vendored
@@ -155,6 +155,8 @@ func (t *typeInfo) build(typ reflect.Type, fn string, fi []int) {
|
||||
}
|
||||
}
|
||||
|
||||
var nilValue reflect.Value
|
||||
|
||||
// assignValue assignes a value 'pv' to the struct pointed to by 'val', given a
|
||||
// slice of field indices. It recurses into the struct until it finds the field
|
||||
// specified by the indices. It creates new values for pointer types where
|
||||
@@ -172,6 +174,11 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) {
|
||||
rv := val.Field(fi[0])
|
||||
fi = fi[1:]
|
||||
if len(fi) == 0 {
|
||||
if pv == nilValue {
|
||||
pv = reflect.Zero(rv.Type())
|
||||
rv.Set(pv)
|
||||
return
|
||||
}
|
||||
rt := rv.Type()
|
||||
pt := pv.Type()
|
||||
|
||||
@@ -182,6 +189,24 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) {
|
||||
rt = rv.Type()
|
||||
}
|
||||
|
||||
// If the target type is a slice, but the source is not, deference any ArrayOfXYZ type
|
||||
if rt.Kind() == reflect.Slice && pt.Kind() != reflect.Slice {
|
||||
if pt.Kind() == reflect.Ptr {
|
||||
pv = pv.Elem()
|
||||
pt = pt.Elem()
|
||||
}
|
||||
|
||||
m := arrayOfRegexp.FindStringSubmatch(pt.Name())
|
||||
if len(m) > 0 {
|
||||
pv = pv.FieldByName(m[1]) // ArrayOfXYZ type has single field named XYZ
|
||||
pt = pv.Type()
|
||||
|
||||
if !pv.IsValid() {
|
||||
panic(fmt.Sprintf("expected %s type to have field %s", m[0], m[1]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If type is an interface, check if pv implements it.
|
||||
if rt.Kind() == reflect.Interface && !pt.Implements(rt) {
|
||||
// Check if pointer to pv implements it.
|
||||
@@ -200,7 +225,7 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) {
|
||||
} else if rt.ConvertibleTo(pt) {
|
||||
rv.Set(pv.Convert(rt))
|
||||
} else {
|
||||
panic(fmt.Sprintf("cannot assign %s (%s) to %s (%s)", rt.Name(), rt.Kind(), pt.Name(), pt.Kind()))
|
||||
panic(fmt.Sprintf("cannot assign %q (%s) to %q (%s)", rt.Name(), rt.Kind(), pt.Name(), pt.Kind()))
|
||||
}
|
||||
|
||||
return
|
||||
@@ -211,23 +236,6 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) {
|
||||
|
||||
var arrayOfRegexp = regexp.MustCompile("ArrayOf(.*)$")
|
||||
|
||||
func anyTypeToValue(t interface{}) reflect.Value {
|
||||
rt := reflect.TypeOf(t)
|
||||
rv := reflect.ValueOf(t)
|
||||
|
||||
// Dereference if ArrayOfXYZ type
|
||||
m := arrayOfRegexp.FindStringSubmatch(rt.Name())
|
||||
if len(m) > 0 {
|
||||
// ArrayOfXYZ type has single field named XYZ
|
||||
rv = rv.FieldByName(m[1])
|
||||
if !rv.IsValid() {
|
||||
panic(fmt.Sprintf("expected %s type to have field %s", m[0], m[1]))
|
||||
}
|
||||
}
|
||||
|
||||
return rv
|
||||
}
|
||||
|
||||
// LoadObjectFromContent loads properties from the 'PropSet' field in the
|
||||
// specified ObjectContent value into the value it represents, which is
|
||||
// returned as a reflect.Value.
|
||||
@@ -240,7 +248,7 @@ func (t *typeInfo) LoadFromObjectContent(o types.ObjectContent) (reflect.Value,
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
assignValue(v, rv, anyTypeToValue(p.Val))
|
||||
assignValue(v, rv, reflect.ValueOf(p.Val))
|
||||
}
|
||||
|
||||
return v, nil
|
||||
|
||||
17
vendor/github.com/vmware/govmomi/vim25/soap/client.go
generated
vendored
17
vendor/github.com/vmware/govmomi/vim25/soap/client.go
generated
vendored
@@ -77,6 +77,17 @@ type Client struct {
|
||||
|
||||
var schemeMatch = regexp.MustCompile(`^\w+://`)
|
||||
|
||||
type errInvalidCACertificate struct {
|
||||
File string
|
||||
}
|
||||
|
||||
func (e errInvalidCACertificate) Error() string {
|
||||
return fmt.Sprintf(
|
||||
"invalid certificate '%s', cannot be used as a trusted CA certificate",
|
||||
e.File,
|
||||
)
|
||||
}
|
||||
|
||||
// ParseURL is wrapper around url.Parse, where Scheme defaults to "https" and Path defaults to "/sdk"
|
||||
func ParseURL(s string) (*url.URL, error) {
|
||||
var err error
|
||||
@@ -200,7 +211,11 @@ func (c *Client) SetRootCAs(file string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pool.AppendCertsFromPEM(pem)
|
||||
if ok := pool.AppendCertsFromPEM(pem); !ok {
|
||||
return errInvalidCACertificate{
|
||||
File: name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c.t.TLSClientConfig.RootCAs = pool
|
||||
|
||||
6
vendor/github.com/vmware/govmomi/vim25/soap/error.go
generated
vendored
6
vendor/github.com/vmware/govmomi/vim25/soap/error.go
generated
vendored
@@ -39,7 +39,11 @@ func (s soapFaultError) Error() string {
|
||||
msg := s.fault.String
|
||||
|
||||
if msg == "" {
|
||||
msg = reflect.TypeOf(s.fault.Detail.Fault).Name()
|
||||
if s.fault.Detail.Fault == nil {
|
||||
msg = "unknown fault"
|
||||
} else {
|
||||
msg = reflect.TypeOf(s.fault.Detail.Fault).Name()
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s: %s", s.fault.Code, msg)
|
||||
|
||||
Reference in New Issue
Block a user