Search in sources :

Example 1 with PbmProfileResourceType

use of com.vmware.pbm.PbmProfileResourceType in project photon-model by vmware.

the class EnumerationClient method retrieveStoragePolicies.

/**
 * Retrieve the list of storage profiles from the server.
 */
public List<PbmProfile> retrieveStoragePolicies() throws com.vmware.pbm.RuntimeFaultFaultMsg, InvalidArgumentFaultMsg {
    // 1 Get PBM Profile Manager
    ManagedObjectReference profileMgr = this.connection.getPbmServiceInstanceContent().getProfileManager();
    // 2 Retrieve the list of profile identifiers.
    PbmProfileResourceType pbmProfileResourceType = new PbmProfileResourceType();
    pbmProfileResourceType.setResourceType(PbmProfileResourceTypeEnum.STORAGE.value());
    List<PbmProfileId> profileIds = this.connection.getPbmPort().pbmQueryProfile(profileMgr, pbmProfileResourceType, null);
    // 3 Retrieve the list of storage profiles.
    if (profileIds != null && !profileIds.isEmpty()) {
        return this.connection.getPbmPort().pbmRetrieveContent(profileMgr, profileIds);
    }
    return new ArrayList<>();
}
Also used : PbmProfileId(com.vmware.pbm.PbmProfileId) ArrayList(java.util.ArrayList) PbmProfileResourceType(com.vmware.pbm.PbmProfileResourceType) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Aggregations

PbmProfileId (com.vmware.pbm.PbmProfileId)1 PbmProfileResourceType (com.vmware.pbm.PbmProfileResourceType)1 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)1 ArrayList (java.util.ArrayList)1