Exemplo n.º 1
0
        public static OrgFederationSettingsType GetFederationSettings(
            vCloudClient client,
            ReferenceType adminOrgReference)
        {
            string url = adminOrgReference.href + "/settings/federation";

            return(SdkUtil.Get <OrgFederationSettingsType>(client, url, 200));
        }
        protected VcloudResource(vCloudClient client, T resourceType)
        {
            ResourceType resource = (ResourceType)resourceType;

            this._resourceType = resourceType;
            this._client       = client;
            this.SetReference(resource);
        }
Exemplo n.º 3
0
 public static Task Reset(vCloudClient client, ReferenceType externalNetworkReference)
 {
     try
     {
         return(new Task(client, SdkUtil.Post <TaskType>(client, externalNetworkReference.href + "/action/reset", (string)null, (string)null, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 4
0
 public static Task Delete(vCloudClient client, ReferenceType adminVdcRef)
 {
     try
     {
         return(AdminVdc.DeleteAdminVdc(client, adminVdcRef.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 5
0
 private static void DeleteAdminCatalog(vCloudClient client, string adminCatalogUrl)
 {
     try
     {
         SdkUtil.Delete <TaskType>(client, adminCatalogUrl, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 6
0
 public static void Delete(vCloudClient client, ReferenceType rightRef)
 {
     try
     {
         SdkUtil.Delete <TaskType>(client, rightRef.href, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 7
0
 public static void Delete(vCloudClient client, ReferenceType adminCatalogRef)
 {
     try
     {
         AdminCatalog.DeleteAdminCatalog(client, adminCatalogRef.href);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 8
0
 public static void Delete(vCloudClient client, ReferenceType roleRef)
 {
     try
     {
         Role.DeleteRole(client, roleRef.href);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 9
0
 public static Task Delete(vCloudClient client, ReferenceType vmwNetworkPoolRef)
 {
     try
     {
         return(VMWNetworkPool.DeleteVMWNetworkPool(client, vmwNetworkPoolRef.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 10
0
 public static string GetTimeoutAction(vCloudClient client, ReferenceType blockingTaskRef)
 {
     try
     {
         return(SdkUtil.Get <BlockingTaskType>(client, blockingTaskRef.href, 200).timeoutAction);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 11
0
 public static void Unlock(vCloudClient client, ReferenceType userRef)
 {
     try
     {
         SdkUtil.Post <TaskType>(client, userRef.href + "/action/unlock", (string)null, (string)null, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 12
0
 public static void Delete(vCloudClient client, ReferenceType vmwDatastoreRef)
 {
     try
     {
         SdkUtil.Delete <VMWDatastore>(client, vmwDatastoreRef.href, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 13
0
 private static Task DeleteAdminVdc(vCloudClient client, string adminVdcUrl)
 {
     try
     {
         return(new Task(client, SdkUtil.Delete <TaskType>(client, adminVdcUrl, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 14
0
 public static Task Delete(vCloudClient client, ReferenceType gatewayRef)
 {
     try
     {
         return(new Task(client, SdkUtil.Delete <TaskType>(client, gatewayRef.href, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 15
0
 public static Task Delete(vCloudClient client, ReferenceType orgNetworkRef)
 {
     try
     {
         return(AdminOrgNetwork.DeleteOrgNetwork(client, orgNetworkRef.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 16
0
 private static Task DeleteOrgNetwork(vCloudClient client, string orgNetworkUrl)
 {
     try
     {
         return(new Task(client, SdkUtil.Delete <TaskType>(client, orgNetworkUrl, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 17
0
 public static T Get <T>(vCloudClient client, string url, int statusCode)
 {
     try
     {
         return(SdkUtil.ValidateResponse <T>(RestUtil.Get(client, url), statusCode));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 18
0
 public static Task Reset(vCloudClient client, ReferenceType adminOrgNetworkReference)
 {
     try
     {
         return(AdminOrgNetwork.ExecuteAction(client, adminOrgNetworkReference.href + "/action/reset", (string)null, (string)null, 202));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 19
0
 public static Task Delete(vCloudClient client, ReferenceType vmwProviderVdcRef)
 {
     try
     {
         return(VMWProviderVdc.DeleteVMWProviderVdc(client, vmwProviderVdcRef.href));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 20
0
 public static void Delete(vCloudClient client, ReferenceType groupRef)
 {
     try
     {
         Group.DeleteGroup(client, groupRef.href);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 21
0
 private static void DeleteGroup(vCloudClient client, string groupUrl)
 {
     try
     {
         SdkUtil.Delete <TaskType>(client, groupUrl, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 22
0
 public static void Delete(vCloudClient client, ReferenceType userRef)
 {
     try
     {
         User.DeleteUser(client, userRef.href);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 23
0
 public static Group GetGroupByReference(vCloudClient client, ReferenceType groupRef)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_URL_MSG) + " - " + groupRef.href);
         return(new Group(client, VcloudResource <GroupType> .GetResourceByReference(client, groupRef)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 24
0
 public static VMWVimServer GetVMWVimServerById(vCloudClient client, string vCloudId)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_VCLOUD_ID_MSG) + " - " + vCloudId);
         return(new VMWVimServer(client, VcloudEntity <VimServerType> .GetEntityById(client, vCloudId, "application/vnd.vmware.admin.vmwvirtualcenter+xml")));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 25
0
 public static AdminVdc GetAdminVdcById(vCloudClient client, string vCloudId)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_VCLOUD_ID_MSG) + " - " + vCloudId);
         return(new AdminVdc(client, VcloudEntity <AdminVdcType> .GetEntityById(client, vCloudId, "application/vnd.vmware.admin.vdc+xml")));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 26
0
 public static void Disable(vCloudClient client, ReferenceType adminVdcRef)
 {
     try
     {
         string orgActionUrl = adminVdcRef.href + "/action/disable";
         AdminVdc.ExecuteVdcAction(client, orgActionUrl, (string)null, (string)null, 204);
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 27
0
 public static User GetUserByReference(vCloudClient client, ReferenceType userRef)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_URL_MSG) + " - " + userRef.href);
         return(new User(client, VcloudResource <UserType> .GetResourceByReference(client, userRef)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 28
0
 public static AdminVdc GetAdminVdcByReference(vCloudClient client, ReferenceType vdcRef)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_URL_MSG) + " - " + vdcRef.href);
         return(new AdminVdc(client, VcloudResource <AdminVdcType> .GetResourceByReference(client, vdcRef)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 29
0
 public static Task EnableHost(vCloudClient client, ReferenceType vmwHostRef)
 {
     try
     {
         string url = vmwHostRef.href + "/action/enable";
         return(new Task(client, SdkUtil.Post <TaskType>(client, url, (string)null, (string)null, 202)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 30
0
 public static VMWHost GetVMWHostByReference(vCloudClient client, ReferenceType reference)
 {
     try
     {
         Logger.Log(TraceLevel.Information, SdkUtil.GetI18nString(SdkMessage.GET_URL_MSG) + " - " + reference.href);
         return(new VMWHost(client, VcloudResource <HostType> .GetResourceByReference(client, reference)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
Exemplo n.º 31
0
        /// <summary>
        /// Create a vCloudClient instance
        /// </summary>
        /// <param name="vCloudUrl">the vCloud Director server URL.</param>
        /// <param name="username">the name of a user account (format:user@vcloud-organization)</param>
        /// <param name="password">the user's password</param>
        private void CreateVCloudClient(string vCloudUrl, string username, string password)
        {
            try
            {
                FakeCertificatePolicy();

                client = new vCloudClient(vCloudUrl, com.vmware.vcloud.sdk.constants.Version.V5_1);

                client.Login(username, password);
            }
            catch (TimeoutException e)
            {
                Log.logger.Error("login vCloud client timeout", e);
                throw new EnvironmentException(VCLOUD, e.Message, e);
            }
            catch (VCloudException e)
            {
                Log.logger.Error(e.Message, e);
                throw new EnvironmentException(VCLOUD, e.Message, e);
            }
            catch (Exception e)
            {
                Log.logger.Error(e.Message, e);
                throw new EnvironmentException(VCLOUD, e.Message, e);
            }
        }