use of com.emc.storageos.model.object.ObjectNamespaceList in project coprhd-controller by CoprHD.
the class ObjectNamespaceService method getObjectNamespaces.
/**
* Get IDs of all object storage namespaces
*
* @brief List namespace names and IDs
* @return object namespace list
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR, Role.TENANT_ADMIN, Role.SECURITY_ADMIN })
public ObjectNamespaceList getObjectNamespaces() {
_log.info("Getting namespaces from all object storage systesm");
ObjectNamespaceList objNamespaceList = new ObjectNamespaceList();
List<URI> ids = _dbClient.queryByType(ObjectNamespace.class, true);
for (URI id : ids) {
ObjectNamespace objNamespace = _dbClient.queryObject(ObjectNamespace.class, id);
if (objNamespace != null) {
objNamespaceList.getNamespaces().add(toNamedRelatedResource(objNamespace, objNamespace.getNativeGuid()));
}
}
return objNamespaceList;
}
use of com.emc.storageos.model.object.ObjectNamespaceList 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;
}
use of com.emc.storageos.model.object.ObjectNamespaceList in project coprhd-controller by CoprHD.
the class StorageSystemService method getAllObjectNamespaces.
/**
* Gets all object namespaces for the registered storage system with the passed id
*
* @param id the URN of a ViPR storage system.
*
* @brief List object storage namespaces
* @return A reference to a ObjectNamespaceList
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/object-namespaces")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public ObjectNamespaceList getAllObjectNamespaces(@PathParam("id") URI id) {
// Make sure storage system is registered.
ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
StorageSystem system = queryResource(id);
ArgValidator.checkEntity(system, id, isIdEmbeddedInURL(id));
if (!StorageSystem.Type.ecs.toString().equals(system.getSystemType())) {
throw APIException.badRequests.invalidParameterURIInvalid("id", id);
}
ObjectNamespaceList objNamespaceList = new ObjectNamespaceList();
URIQueryResultList objNamespaceURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceObjectNamespaceConstraint(id), objNamespaceURIs);
Iterator<URI> ecsNsIter = objNamespaceURIs.iterator();
while (ecsNsIter.hasNext()) {
URI nsURI = ecsNsIter.next();
ObjectNamespace namespace = _dbClient.queryObject(ObjectNamespace.class, nsURI);
if (namespace != null && !namespace.getInactive()) {
objNamespaceList.getNamespaces().add(toNamedRelatedResource(namespace, namespace.getNativeGuid()));
}
}
return objNamespaceList;
}
Aggregations