Пример #1
0
 public EntityViewBase GetViewByRef <T>(ManagedObjectReference moRef)
 {
     return((EntityViewBase)vClient.GetView(moRef, null));
 }
Пример #2
0
 protected List<CustomizationSpecInfo> GetCustomizationSpecs(VimClient vimClient)
 {
     //
     // Get a list of Customization Spec Info items
     //
     try
     {
         //
         // Get all Spec Info items
         //
         List<CustomizationSpecInfo> lstSpecInfo = new List<CustomizationSpecInfo>();
         CustomizationSpecManager specManager = (CustomizationSpecManager)vimClient.GetView(vimClient.ServiceContent.CustomizationSpecManager, null);
         if (specManager != null)
         {
             foreach (CustomizationSpecInfo specInfo in specManager.Info)
             {
                 lstSpecInfo.Add(specInfo);
             }
             return lstSpecInfo;
         }
         else
         {
             return null;
         }
     }
     catch (VimException ex)
     {
         //
         // VMware Exception occurred
         //
         txtErrors.Text = "A server fault of type " + ex.MethodFault.GetType().Name + " with message '" + ex.Message + "' occured while performing requested operation.";
         Error_Panel.Visible = true;
         return null;
     }
 }
Пример #3
0
 protected CustomizationSpecItem GetCustomizationSpecItem(VimClient vimClient, string specName = null)
 {
     //
     // Get one or more Customization Spec Items
     //
     try
     {
         //
         // Need a manager to collect the spec items
         //
         CustomizationSpecManager specManager = (CustomizationSpecManager)vimClient.GetView(vimClient.ServiceContent.CustomizationSpecManager, null);
         if (specManager != null)
         {
             CustomizationSpecItem itmCustomizationSpecItem = specManager.GetCustomizationSpec(specName);
             return itmCustomizationSpecItem;
         }
         else
         {
             return null;
         }
     }
     catch (VimException ex)
     {
         //
         // VMware Exception occurred
         //
         txtErrors.Text = "A server fault of type " + ex.MethodFault.GetType().Name + " with message '" + ex.Message + "' occured while performing requested operation.";
         Error_Panel.Visible = true;
         return null;
     }
 }
Пример #4
0
 protected VmwareDistributedVirtualSwitch GetDvSwitch(VimClient vimClient, ManagedObjectReference dvportGroupSwitch)
 {
     //
     // Get a specific distributed switch
     //
     try
     {
         //
         // Get the switch associated with the moref
         //
         ViewBase appSwitch = vimClient.GetView(dvportGroupSwitch, null);
         if (appSwitch != null)
         {
             VmwareDistributedVirtualSwitch thisDvSwitch = (VmwareDistributedVirtualSwitch)appSwitch;
             return thisDvSwitch;
         }
         else
         {
             return null;
         }
     }
     catch (VimException ex)
     {
         //
         // VMware Exception occurred
         //
         txtErrors.Text = "A server fault of type " + ex.MethodFault.GetType().Name + " with message '" + ex.Message + "' occured while performing requested operation.";
         Error_Panel.Visible = true;
         return null;
     }
 }