Search in sources :

Example 1 with UcsProfile

use of com.cloud.ucs.structure.UcsProfile in project cloudstack by apache.

the class UcsManagerImpl method listUcsProfiles.

@Override
public ListResponse<UcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd) {
    List<UcsProfile> profiles = getUcsProfiles(cmd.getUcsManagerId());
    ListResponse<UcsProfileResponse> response = new ListResponse<UcsProfileResponse>();
    List<UcsProfileResponse> rs = new ArrayList<UcsProfileResponse>();
    for (UcsProfile p : profiles) {
        UcsProfileResponse r = new UcsProfileResponse();
        r.setObjectName("ucsprofile");
        r.setDn(p.getDn());
        rs.add(r);
    }
    response.setResponses(rs);
    return response;
}
Also used : UcsProfile(com.cloud.ucs.structure.UcsProfile) ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) UcsProfileResponse(org.apache.cloudstack.api.response.UcsProfileResponse)

Example 2 with UcsProfile

use of com.cloud.ucs.structure.UcsProfile in project cloudstack by apache.

the class UcsManagerImpl method getUcsProfiles.

private List<UcsProfile> getUcsProfiles(Long ucsMgrId) {
    String cookie = getCookie(ucsMgrId);
    UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
    String cmd = UcsCommands.listProfiles(cookie);
    UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
    String res = client.call(cmd);
    List<UcsProfile> profiles = UcsProfile.fromXmlString(res);
    return profiles;
}
Also used : UcsManagerVO(com.cloud.ucs.database.UcsManagerVO) UcsProfile(com.cloud.ucs.structure.UcsProfile)

Aggregations

UcsProfile (com.cloud.ucs.structure.UcsProfile)2 UcsManagerVO (com.cloud.ucs.database.UcsManagerVO)1 ArrayList (java.util.ArrayList)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1 UcsProfileResponse (org.apache.cloudstack.api.response.UcsProfileResponse)1