Example #1
0
        private static VappTemplate ExecuteVappTemplateUpload(
            vCloudClient client,
            string vdcActionUrl,
            string reqPayload,
            string contentType)
        {
            ReferenceType entity = new CatalogItem(client, SdkUtil.Post <CatalogItemType>(client, vdcActionUrl, reqPayload, contentType, 201)).Resource.Entity;

            return(VappTemplate.GetVappTemplateByReference(client, entity));
        }
Example #2
0
 public static Task Reset(vCloudClient client, ReferenceType _ref)
 {
     try
     {
         return(AbstractVapp <T> .ExecuteAbstractVappAction(client, _ref.href + "/power/action/reset", (string)null, (string)null, 202));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #3
0
 private static void DeleteCatalogItem(vCloudClient client, string catalogItemUrl)
 {
     try
     {
         SdkUtil.Delete <TaskType>(client, catalogItemUrl, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #4
0
 public static void Delete(vCloudClient client, ReferenceType catalogItemRef)
 {
     try
     {
         CatalogItem.DeleteCatalogItem(client, catalogItemRef.href);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #5
0
 public static void CancelTask(vCloudClient client, ReferenceType taskReference)
 {
     try
     {
         Task.ExecuteAction(client, taskReference.href + "/action/cancel", (string)null, (string)null, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #6
0
 public static EnvelopeType GetOvf(vCloudClient client, string vAppTemplateOvfUrl)
 {
     try
     {
         return(SdkUtil.Get <EnvelopeType>(client, vAppTemplateOvfUrl, 200));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #7
0
 public static Task Delete(vCloudClient client, ReferenceType _ref)
 {
     try
     {
         return(AbstractVapp <T> .AsyncDelete(client, _ref.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #8
0
 private static Task DeletevAppTemplate(vCloudClient client, string vAppTemplateUrl)
 {
     try
     {
         return(new Task(client, SdkUtil.Delete <TaskType>(client, vAppTemplateUrl, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #9
0
 public static Task Reboot(vCloudClient client, ReferenceType _ref)
 {
     try
     {
         return(new Task(client, SdkUtil.Post <TaskType>(client, _ref.href + "/power/action/reboot", (string)null, (string)null, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #10
0
 public static Task RevertToCurrentSnapshot(vCloudClient client, ReferenceType refer)
 {
     try
     {
         return(new Task(client, SdkUtil.Post <TaskType>(client, refer.href + "/action/revertToCurrentSnapshot", (string)null, (string)null, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #11
0
 public static Task Delete(vCloudClient client, ReferenceType diskRef)
 {
     try
     {
         return(Disk.DeleteDisk(client, diskRef.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #12
0
 public static EnvelopeType GetOvf(vCloudClient client, ReferenceType vappRef)
 {
     try
     {
         return(Vapp.GetOvf(client, vappRef.href + "/ovf"));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #13
0
 public static int GetProgress(vCloudClient client, ReferenceType taskReference)
 {
     try
     {
         return(new Task(client, VcloudResource <TaskType> .GetResourceByReference(client, taskReference)).Resource.Progress);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #14
0
 public static Task Delete(vCloudClient client, ReferenceType vAppTemplateRef)
 {
     try
     {
         return(VappTemplate.DeletevAppTemplate(client, vAppTemplateRef.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #15
0
 public static Task Delete(vCloudClient client, ReferenceType mediaRef)
 {
     try
     {
         return(Media.DeleteMedia(client, mediaRef.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #16
0
        private static Task DeleteMediaWithCatalogItem(vCloudClient client, ReferenceType mediaRef)
        {
            Media  mediaByReference = Media.GetMediaByReference(client, mediaRef);
            string href             = mediaRef.href;

            if (mediaByReference.IsPartOfCatalogItem())
            {
                CatalogItem.Delete(client, mediaByReference.GetCatalogItemReference());
            }
            return(new Task(client, SdkUtil.Delete <TaskType>(client, href, 202)));
        }
Example #17
0
 public static Task Consolidate(vCloudClient client, ReferenceType vappTemplateVmRef)
 {
     try
     {
         return(new Task(client, SdkUtil.Post <TaskType>(client, vappTemplateVmRef.href + "/action/consolidate", (string)null, (string)null, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #18
0
 public static Task DiscardSuspend(vCloudClient client, ReferenceType _ref)
 {
     try
     {
         return(AbstractVapp <T> .ExecuteAbstractVappAction(client, _ref.href + "/action/discardSuspendedState", (string)null, (string)null, 202));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #19
0
 public static Task EnableDownload(vCloudClient client, ReferenceType mediapRef)
 {
     try
     {
         string url = mediapRef.href + "/action/enableDownload";
         return(new Task(client, SdkUtil.Post <TaskType>(client, url, (string)null, (string)null, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #20
0
 public static Task EnableDownload(vCloudClient client, ReferenceType vAppTemplateRef)
 {
     try
     {
         string vappActionUrl = vAppTemplateRef.href + "/action/enableDownload";
         return(VappTemplate.ExecuteVappTemplateAction(client, vappActionUrl, (string)null, (string)null, 202));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #21
0
 public static Media GetMediaById(vCloudClient client, string vCloudId)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_VCLOUD_ID_MSG) + " - " + vCloudId);
         return(new Media(client, VcloudEntity <com.vmware.vcloud.api.rest.schema.MediaType> .GetEntityById(client, vCloudId, "application/vnd.vmware.vcloud.media+xml")));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #22
0
 public static Task GetTaskByReference(vCloudClient client, ReferenceType taskRef)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_URL_MSG) + " - " + taskRef.href);
         return(new Task(client, VcloudResource <TaskType> .GetResourceByReference(client, taskRef)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #23
0
 public static Media GetMediaByReference(vCloudClient client, ReferenceType mediaRef)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_URL_MSG) + " - " + mediaRef.href);
         return(new Media(client, VcloudResource <com.vmware.vcloud.api.rest.schema.MediaType> .GetResourceByReference(client, mediaRef)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #24
0
 public static void DisableDownload(vCloudClient client, ReferenceType vAppTemplateRef)
 {
     try
     {
         string url = vAppTemplateRef.href + "/action/disableDownload";
         SdkUtil.Post <TaskType>(client, url, (string)null, (string)null, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #25
0
 public static Task GetTaskById(vCloudClient client, string vCloudId)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_VCLOUD_ID_MSG) + " - " + vCloudId);
         return(new Task(client, VcloudEntity <TaskType> .GetEntityById(client, vCloudId, "application/vnd.vmware.vcloud.task+xml")));
     }
     catch (VCloudException ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #26
0
 public static void DisableMaintenance(vCloudClient client, ReferenceType vappRef)
 {
     try
     {
         string url = vappRef.href + "/action/exitMaintenanceMode";
         SdkUtil.Post <TaskType>(client, url, (string)null, (string)null, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #27
0
 public static CustomizationSectionType GetCustomizationSection(
     vCloudClient client,
     ReferenceType vappTemplateRef)
 {
     try
     {
         return(SdkUtil.Get <CustomizationSectionType>(client, vappTemplateRef.href + "/customizationSection/", 200));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #28
0
 public static NetworkConfigSectionType GetNetworkConfigSection(
     vCloudClient client,
     ReferenceType vappTemplateRef)
 {
     try
     {
         return(SdkUtil.Get <NetworkConfigSectionType>(client, vappTemplateRef.href + "/networkConfigSection/", 200));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #29
0
 public static LeaseSettingsSectionType GetLeaseSettingsSection(
     vCloudClient client,
     ReferenceType vappTemplateRef)
 {
     try
     {
         return(SdkUtil.Get <LeaseSettingsSectionType>(client, vappTemplateRef.href + "/leaseSettingsSection/", 200));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Example #30
0
        private static Task DeleteVappTemplateWithCatalogItem(
            vCloudClient client,
            ReferenceType vappTemplRef)
        {
            VappTemplate templateByReference = VappTemplate.GetVappTemplateByReference(client, vappTemplRef);
            string       href = vappTemplRef.href;

            if (templateByReference.IsPartOfCatalogItem())
            {
                CatalogItem.Delete(client, templateByReference.GetCatalogItemReference());
            }
            return(new Task(client, SdkUtil.Delete <TaskType>(client, href, 202)));
        }