Search in sources :

Example 1 with CustomConfigTypeList

use of com.emc.storageos.model.customconfig.CustomConfigTypeList in project coprhd-controller by CoprHD.

the class CustomConfigService method getCustomConfigTypes.

/**
 * List config types.
 *
 * @brief List of config types
 * @return The list of config types.
 */
@GET
@Path("/types")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public CustomConfigTypeList getCustomConfigTypes() {
    List<CustomConfigType> items = customConfigHandler.getCustomConfigTypes();
    List<RelatedConfigTypeRep> types = new ArrayList<RelatedConfigTypeRep>();
    for (CustomConfigType item : items) {
        RelatedConfigTypeRep type = new RelatedConfigTypeRep();
        // build config type Link
        String service = ResourceTypeEnum.CONFIG_TYPE.getService();
        StringBuilder build = (new StringBuilder(service)).append('/').append(item.getName());
        type.setConfigName(item.getName());
        try {
            type.setSelfLink(new RestLinkRep("self", new URI(build.toString())));
        } catch (URISyntaxException e) {
        // it should not happen
        }
        types.add(type);
    }
    return new CustomConfigTypeList(types);
}
Also used : CustomConfigType(com.emc.storageos.customconfigcontroller.CustomConfigType) RelatedConfigTypeRep(com.emc.storageos.model.customconfig.RelatedConfigTypeRep) ArrayList(java.util.ArrayList) RestLinkRep(com.emc.storageos.model.RestLinkRep) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) CustomConfigTypeList(com.emc.storageos.model.customconfig.CustomConfigTypeList) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with CustomConfigTypeList

use of com.emc.storageos.model.customconfig.CustomConfigTypeList in project coprhd-controller by CoprHD.

the class CustomConfigs method getCustomConfigTypes.

public List<CustomConfigTypeRep> getCustomConfigTypes() {
    CustomConfigTypeList list = client.get(CustomConfigTypeList.class, PathConstants.CUSTOM_CONFIG_TYPE_URL);
    List<CustomConfigTypeRep> configTypes = new ArrayList<>();
    for (RelatedConfigTypeRep configTypeRep : list.getConfigTypes()) {
        CustomConfigTypeRep template = getCustomConfigType(configTypeRep.getConfigName());
        configTypes.add(template);
    }
    return configTypes;
}
Also used : CustomConfigTypeRep(com.emc.storageos.model.customconfig.CustomConfigTypeRep) RelatedConfigTypeRep(com.emc.storageos.model.customconfig.RelatedConfigTypeRep) ArrayList(java.util.ArrayList) CustomConfigTypeList(com.emc.storageos.model.customconfig.CustomConfigTypeList)

Aggregations

CustomConfigTypeList (com.emc.storageos.model.customconfig.CustomConfigTypeList)2 RelatedConfigTypeRep (com.emc.storageos.model.customconfig.RelatedConfigTypeRep)2 ArrayList (java.util.ArrayList)2 CustomConfigType (com.emc.storageos.customconfigcontroller.CustomConfigType)1 RestLinkRep (com.emc.storageos.model.RestLinkRep)1 CustomConfigTypeRep (com.emc.storageos.model.customconfig.CustomConfigTypeRep)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1