private VimApi_55.ObjectContent[] RetrievePropertiesEx(VimApi_55.ManagedObjectReference propertyCollector, VimApi_55.PropertyFilterSpec[] specs, int?maxObjects) { List <VimApi_55.ObjectContent> objectList = new List <VimApi_55.ObjectContent>(); //VimService _service = new VimService(); var result = vimService.RetrievePropertiesEx(propertyCollector, specs, new VimApi_55.RetrieveOptions() { maxObjects = maxObjects.GetValueOrDefault(), maxObjectsSpecified = (maxObjects != null) }); if (result != null) { string token = result.token; objectList.AddRange(result.objects.AsEnumerable()); while (token != null && !string.Empty.Equals(token)) { result = vimService.ContinueRetrievePropertiesEx(propertyCollector, token); if (result != null) { token = result.token; objectList.AddRange(result.objects.AsEnumerable()); } } } return(objectList.ToArray()); }
private VimApi_55.ObjectContent[] GetObjectProperties( VMware.Vim.ManagedObjectReference collector, VMware.Vim.ManagedObjectReference mobj, string[] properties ) { if (mobj == null) { return(null); } VimApi_55.ManagedObjectReference usecoll = collector != null ? new VimApi_55.ManagedObjectReference() { type = collector.Type, Value = collector.Value } : null; if (usecoll == null) { usecoll = new VimApi_55.ManagedObjectReference() { type = this.vConnection.PropertyCollector.Type, Value = this.vConnection.PropertyCollector.Value }; } VimApi_55.PropertyFilterSpec spec = new VimApi_55.PropertyFilterSpec(); spec.propSet = new VimApi_55.PropertySpec[] { new VimApi_55.PropertySpec() }; spec.propSet[0].all = properties == null || properties.Length == 0; spec.propSet[0].allSpecified = spec.propSet[0].all; spec.propSet[0].type = mobj.Type; spec.propSet[0].pathSet = properties; spec.objectSet = new VimApi_55.ObjectSpec[] { new VimApi_55.ObjectSpec() }; spec.objectSet[0].obj = mobj != null ? new VimApi_55.ManagedObjectReference() { type = mobj.Type, Value = mobj.Value } : null; spec.objectSet[0].skip = false; return(RetrievePropertiesEx(usecoll, new VimApi_55.PropertyFilterSpec[] { spec })); }
private VimApi_55.ObjectContent[] RetrievePropertiesEx(VimApi_55.ManagedObjectReference propertyCollector, VimApi_55.PropertyFilterSpec[] specs) { return(RetrievePropertiesEx(propertyCollector, specs, null)); }