Search in sources :

Example 41 with NamedRelatedResourceRep

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);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) StringOption(util.StringOption) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 42 with NamedRelatedResourceRep

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);
}
Also used : ApiMapperUtils.newApprovalReference(util.api.ApiMapperUtils.newApprovalReference) Reference(com.emc.vipr.model.catalog.Reference) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 43 with NamedRelatedResourceRep

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));
}
Also used : ScheculePoliciesDataTable(models.datatable.ScheculePoliciesDataTable) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) FilePolicyListRestRep(com.emc.storageos.model.file.policy.FilePolicyListRestRep) FlashException(controllers.util.FlashException)

Example 44 with NamedRelatedResourceRep

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;
}
Also used : CatalogImageList(com.emc.vipr.model.catalog.CatalogImageList) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) CatalogImage(com.emc.storageos.db.client.model.uimodels.CatalogImage) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 45 with NamedRelatedResourceRep

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;
}
Also used : CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) CatalogServiceList(com.emc.vipr.model.catalog.CatalogServiceList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5