コード例 #1
0
 public EnvelopeType GetOvf()
 {
     try
     {
         return(Vapp.GetOvf(this.VcloudClient, this.Reference.href + "/ovf"));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
コード例 #2
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);
     }
 }
コード例 #3
0
 public void ChangeOwner(ReferenceType userReference)
 {
     try
     {
         Vapp.ChangeOwner(this.Reference.href + "/owner", userReference, this.VcloudClient);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
コード例 #4
0
 public static void ChangeOwner(
     vCloudClient client,
     ReferenceType vappRef,
     ReferenceType userReference)
 {
     try
     {
         Vapp.ChangeOwner(vappRef.href + "/owner", userReference, client);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
コード例 #5
0
        public Vapp UploadVapp(
            InstantiateOvfParamsType InstantiateOvfParamsType,
            string localOvfFileLocation)
        {
            Vapp       vapp = this.InstantiateOvf(InstantiateOvfParamsType);
            FileStream fileStream1;

            try
            {
                fileStream1 = File.OpenRead(localOvfFileLocation);
            }
            catch (FileNotFoundException ex)
            {
                throw new VCloudRuntimeException((Exception)ex);
            }
            string fileName = Path.GetFileName(localOvfFileLocation);

            vapp.UploadOVFFile((Stream)fileStream1, fileStream1.Length);
            Vapp vappByReference1 = Vapp.GetVappByReference(this.VcloudClient, vapp.Reference);

            while (!vappByReference1.Resource.ovfDescriptorUploaded)
            {
                vappByReference1 = Vapp.GetVappByReference(this.VcloudClient, vappByReference1.Reference);
            }
            try
            {
                fileStream1.Close();
            }
            catch (IOException ex)
            {
                throw new VCloudRuntimeException((Exception)ex);
            }
            foreach (string uploadFileName in vappByReference1.GetUploadFileNames())
            {
                string     path = localOvfFileLocation.Replace(fileName, uploadFileName);
                FileStream fileStream2;
                try
                {
                    fileStream2 = File.OpenRead(path);
                }
                catch (FileNotFoundException ex)
                {
                    throw new VCloudRuntimeException((Exception)ex);
                }
                vappByReference1.UploadFile(uploadFileName, (Stream)fileStream2, fileStream2.Length);
                try
                {
                    fileStream2.Close();
                }
                catch (IOException ex)
                {
                    throw new VCloudRuntimeException((Exception)ex);
                }
            }
            Vapp vappByReference2 = Vapp.GetVappByReference(this.VcloudClient, vappByReference1.Reference);

            while (vappByReference2.Resource.status == VappTemplateStatus.UNRESOLVED.Value())
            {
                vappByReference2 = Vapp.GetVappByReference(this.VcloudClient, vappByReference2.Reference);
            }
            return(Vapp.GetVappByReference(this.VcloudClient, vappByReference2.Reference));
        }