IWsEndUserGetServers Method
|
Obtain server list of specified account. Can you filter result by state.
GetServer method get object list of Server class. Exist optional integer value to filter by state.
Namespace:
Aruba.Cloud.WsEndUser
Assembly:
Aruba.Cloud.WsEndUser (in Aruba.Cloud.WsEndUser.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax [OperationContractAttribute]
WsResult<Server[]> GetServers(
Nullable<int> statusId
)
<OperationContractAttribute>
Function GetServers (
statusId As Nullable(Of Integer)
) As WsResult(Of Server())
[OperationContractAttribute]
WsResult<array<Server^>^>^ GetServers(
Nullable<int> statusId
)
[<OperationContractAttribute>]
abstract GetServers :
statusId : Nullable<int> -> WsResult<Server[]>
function GetServers(
statusId : Nullable<int>
) : WsResult<Server[]>
Parameters
- statusId
- Type: SystemNullableInt32
Value type System.Int32. It’s status id of server. If null return all account’s servers.
Possible status code in follow table:
Codice | Stato |
---|
1 | Creation Server |
2 | Server Off |
3 | Started Server |
4 | Archivied Server |
5 | Deleted Server |
Return Value
Type:
WsResultServer
WsResultOfServerDetails contain server details information of authenticated user.
For more information consult WsResult class and ServerDetails class.
Examples private String GetServersList()
{
StringBuilder sb = new StringBuilder();
try
{
WsResultOfArrayOfServer result = client.GetServers(null);
if (result.Success)
{
sb.AppendLine("LIST OF AVAILABLE SERVER:");
List<Server> listOfServer = result.Value.ToList();
foreach (Server server in listOfServer)
{
sb.AppendLine(String.Format("Server: {0} Id: {1}", server.Name, server.ServerId));
sb.AppendLine(String.Format("\t Status: {0}", server.ServerStatus));
sb.AppendLine(String.Format("\t Number of CPU (total): {0}", server.CPUQuantity));
sb.AppendLine(String.Format("\t Number of disks (total): {0}", server.HDQuantity));
sb.AppendLine(String.Format("\t Disk size (total): {0}", server.HDTotalSize));
sb.AppendLine(String.Format("\t Ram quantity: {0}", server.RAMQuantity));
}
}
else
{
throw new ApplicationException(String.Format(
"An error has occurred while invoking GetServers(). This is the inner exception: {0}", result.ResultMessage));
}
}
catch (Exception ex)
{
throw new ApplicationException(String.Format("An error has occurred while{0}", ex.Message));
}
return sb.ToString();
}
See Also