Search in sources :

Example 1 with ObjectNamespaceRestRep

use of com.emc.storageos.model.object.ObjectNamespaceRestRep in project coprhd-controller by CoprHD.

the class ObjectNamespaceService method getObjectNamespace.

/**
 * Get details of the object storage namespace specified
 *
 * @param id object storage namespace id
 * @brief Show details for a namespace
 * @return details of the namespace
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR, Role.TENANT_ADMIN, Role.SECURITY_ADMIN })
public ObjectNamespaceRestRep getObjectNamespace(@PathParam("id") URI id) {
    _log.info("Getting details for the namespace: {}", id);
    ArgValidator.checkFieldUriType(id, ObjectNamespace.class, "id");
    ArgValidator.checkUri(id);
    ObjectNamespace objNamespace = _dbClient.queryObject(ObjectNamespace.class, id);
    ArgValidator.checkEntity(objNamespace, id, isIdEmbeddedInURL(id));
    ObjectNamespaceRestRep restRep = toObjectNamespaceRestRep(objNamespace, _dbClient, _coordinator);
    return restRep;
}
Also used : ObjectNamespaceRestRep(com.emc.storageos.model.object.ObjectNamespaceRestRep) ObjectNamespace(com.emc.storageos.db.client.model.ObjectNamespace) 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 ObjectNamespaceRestRep

use of com.emc.storageos.model.object.ObjectNamespaceRestRep in project coprhd-controller by CoprHD.

the class TenantUtils method getUnmappedNamespace.

public static List<StringOption> getUnmappedNamespace() {
    ObjectNamespaceList objNamespaceList = getViprClient().objectNamespace().getObjectNamespaces();
    List<StringOption> namespaceOptions = Lists.newArrayList();
    List<NamedRelatedResourceRep> ObjNamedList = objNamespaceList.getNamespaces();
    for (NamedRelatedResourceRep namedRes : ObjNamedList) {
        URI uri = namedRes.getId();
        ObjectNamespaceRestRep objNs = getViprClient().objectNamespace().getObjectNamespace(uri);
        if (objNs != null && objNs.getMapped() == false) {
            // only unmapped namespaces to be added to list
            namespaceOptions.add(new StringOption(objNs.getNativeId(), objNs.getNsName()));
        }
    }
    return namespaceOptions;
}
Also used : ObjectNamespaceList(com.emc.storageos.model.object.ObjectNamespaceList) ObjectNamespaceRestRep(com.emc.storageos.model.object.ObjectNamespaceRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 3 with ObjectNamespaceRestRep

use of com.emc.storageos.model.object.ObjectNamespaceRestRep in project coprhd-controller by CoprHD.

the class SystemsMapper method map.

public static ObjectNamespaceRestRep map(ObjectNamespace from) {
    if (from == null) {
        return null;
    }
    ObjectNamespaceRestRep to = new ObjectNamespaceRestRep();
    to.setNsName(from.getNsName());
    to.setNativeId(from.getNativeId());
    to.setMapped(from.getMapped());
    to.setTenant(from.getTenant());
    to.setStorageDevice(from.getStorageDevice());
    return to;
}
Also used : ObjectNamespaceRestRep(com.emc.storageos.model.object.ObjectNamespaceRestRep)

Aggregations

ObjectNamespaceRestRep (com.emc.storageos.model.object.ObjectNamespaceRestRep)3 ObjectNamespace (com.emc.storageos.db.client.model.ObjectNamespace)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 ObjectNamespaceList (com.emc.storageos.model.object.ObjectNamespaceList)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 URI (java.net.URI)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1