Add support for custom attributes to vsphere input (#5971)

This commit is contained in:
Pontus Rydin
2019-08-14 20:03:33 -04:00
committed by Daniel Nelson
parent 5e0c63f2e6
commit 2755595019
6 changed files with 205 additions and 57 deletions

View File

@@ -305,3 +305,18 @@ func (c *Client) ListResources(ctx context.Context, root *view.ContainerView, ki
defer cancel1()
return root.Retrieve(ctx1, kind, ps, dst)
}
func (c *Client) GetCustomFields(ctx context.Context) (map[int32]string, error) {
ctx1, cancel1 := context.WithTimeout(ctx, c.Timeout)
defer cancel1()
cfm := object.NewCustomFieldsManager(c.Client.Client)
fields, err := cfm.Field(ctx1)
if err != nil {
return nil, err
}
r := make(map[int32]string)
for _, f := range fields {
r[f.Key] = f.Name
}
return r, nil
}