use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class FileSystems method getScheculePolicies.
public static void getScheculePolicies() {
ViPRCoreClient client = BourneUtil.getViprClient();
List<NamedRelatedResourceRep> filePolicies = client.fileProtectionPolicies().listFilePolicies().getFilePolicies();
List<StringOption> policyOptions = Lists.newArrayList();
for (NamedRelatedResourceRep filePolicy : filePolicies) {
FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(filePolicy.getId());
if (policyRestRep != null && "file_system".equalsIgnoreCase(policyRestRep.getAppliedAt())) {
policyOptions.add(new StringOption(policyRestRep.getId().toString(), filePolicy.getName()));
}
}
renderJSON(policyOptions);
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class ApprovalsApi method approvals.
public static void approvals() {
List<Reference> approvals = Lists.newArrayList();
List<NamedRelatedResourceRep> allApprovals = getCatalogClient().approvals().listByUserTenant();
for (NamedRelatedResourceRep element : allApprovals) {
approvals.add(newApprovalReference(element.getId().toString()));
}
renderApi(approvals);
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class FileProtectionPolicies method listJson.
@FlashException(value = "list", keep = true)
public static void listJson() {
FilePolicyListRestRep viprSchedulePolicies = getViprClient().fileProtectionPolicies().listFilePolicies();
List<ScheculePoliciesDataTable.FileProtectionPolicy> scheculePolicies = Lists.newArrayList();
for (NamedRelatedResourceRep policy : viprSchedulePolicies.getFilePolicies()) {
scheculePolicies.add(new ScheculePoliciesDataTable.FileProtectionPolicy(getViprClient().fileProtectionPolicies().getFilePolicy(policy.getId())));
}
renderJSON(DataTablesSupport.createJSON(scheculePolicies, params));
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class CatalogImageService method getCatalogImages.
/**
* Gets the list of catalog images
*
* @param tenantId the URN of a tenant
* @brief List Catalog Images
* @return a list of catalog images
* @throws DatabaseException when a DB error occurs
*/
@GET
@Path("")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public CatalogImageList getCatalogImages(@DefaultValue("") @QueryParam(SearchConstants.TENANT_ID_PARAM) String tenantId) throws DatabaseException {
StorageOSUser user = getUserFromContext();
if (StringUtils.isBlank(tenantId)) {
tenantId = user.getTenantId();
}
verifyAuthorizedInTenantOrg(uri(tenantId), getUserFromContext());
List<CatalogImage> catalogImages = catalogImageManager.getCatalogImages(uri(tenantId));
CatalogImageList list = new CatalogImageList();
for (CatalogImage catalogImage : catalogImages) {
NamedRelatedResourceRep resourceRep = toNamedRelatedResource(ResourceTypeEnum.CATALOG_IMAGE, catalogImage.getId(), catalogImage.getLabel());
list.getCatalogImages().add(resourceRep);
}
return list;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class CatalogServiceMapper method toCatalogServiceList.
public static CatalogServiceList toCatalogServiceList(List<CatalogService> catalogServices) {
CatalogServiceList list = new CatalogServiceList();
for (CatalogService catalogService : catalogServices) {
NamedRelatedResourceRep resourceRep = toNamedRelatedResource(ResourceTypeEnum.CATALOG_SERVICE, catalogService.getId(), catalogService.getLabel());
list.getCatalogServices().add(resourceRep);
}
return list;
}
Aggregations