IJsonpWsEndUserGetHypervisors Method
|
The method returns, along with the standard template platform, user-created custom templates and
templates offered for sale and available on its price list.
Namespace:
Aruba.Cloud.WsEndUser
Assembly:
Aruba.Cloud.WsEndUser (in Aruba.Cloud.WsEndUser.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax[OperationContractAttribute]
[WebGetAttribute(ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetHypervisors/{jsonp}/{userName}/{token}")]
Stream GetHypervisors(
string jsonp,
string userName,
string token
)<OperationContractAttribute>
<WebGetAttribute(ResponseFormat := WebMessageFormat.Json, UriTemplate := "GetHypervisors/{jsonp}/{userName}/{token}")>
Function GetHypervisors (
jsonp As String,
userName As String,
token As String
) As Stream[OperationContractAttribute]
[WebGetAttribute(ResponseFormat = WebMessageFormat::Json, UriTemplate = L"GetHypervisors/{jsonp}/{userName}/{token}")]
Stream^ GetHypervisors(
String^ jsonp,
String^ userName,
String^ token
)[<OperationContractAttribute>]
[<WebGetAttribute(ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetHypervisors/{jsonp}/{userName}/{token}")>]
abstract GetHypervisors :
jsonp : string *
userName : string *
token : string -> Stream
function GetHypervisors(
jsonp : String,
userName : String,
token : String
) : Stream
Parameters
- jsonp
- Type: SystemString
- userName
- Type: SystemString
- token
- Type: SystemString
Return Value
Type:
Stream
The method returns an object containing information on the outcome WsResultOfArrayOfHypervisor authentication.
The Value property for instance returns a List<Hypervisor>.
Examples
The following example describes a method, called GetAvailableHypervisor(), which means a call to GetHypervisors() to Aruba WsEndUser,
get a list of objects of class hypervisor. The list thus obtained is cycled so as to extract, for each hypervisor, the information that
characterize it. In the specific case of the example data are extracted and HypervisorType HypervisorServerType.
Then you remove the list of available templates for each object class hypervisor.
This list of templates being cycled so as to extract, for each template, the name (Name property) and type (property TemplateType).
private String GetAvailableHypervisor()
{
StringBuilder sb = new StringBuilder();
try
{
WsResultOfArrayOfHypervisor result = client.GetHypervisors();
if (result.Success)
{
foreach (Hypervisor hv in result.Value)
{
sb.AppendLine(String.Format("Hypervisor type: {0}, server type: ", hv.HypervisorType, hv.HypervisorServerType));
foreach (TemplateDetails tmpl in hv.Templates)
{
sb.AppendLine(String.Format("Template name: {0}, type: {1}", tmpl.Name, tmpl.TemplateType));
}
}
}
else
{
throw new ApplicationException(
String.Format("An error has occurred while invoking GetHypervisors(). This is the inner exception: {0}", result.ResultMessage));
}
}
catch (Exception ex)
{
throw new ApplicationException(String.Format(
"An error has occurred while getting the list of available hypervisors {0}", ex.Message));
}
return sb.ToString();
}
See Also