/** * Get protectionType attached with a virtual array * * @param id the URN of a ViPR varray * @return the protection type */ public String getProtectionType(URI id) { String getFlag = String.format(INTERNAL_VARRAY_GET_PROTECTIONTYPE, id.toString()); WebResource rRoot = createRequest(getFlag); VirtualArrayInternalFlags resp = null; try { resp = addSignature(rRoot).get(VirtualArrayInternalFlags.class); } catch (UniformInterfaceException e) { _log.warn("could not get protection of varray {}. Err:{}", id, e); if (e.getResponse().getStatus() == 404) { throw APIException.notFound.unableToFindEntityInURL(id); } } return resp.getProtectionType(); }
/** * Get device registered status of a virtual array * * @param id the URN of a ViPR varray * @return the device registered status */ public Boolean getDeviceRegistered(URI id) { String getFlag = String.format(INTERNAL_VARRAY_GET_REGISTERED, id.toString()); WebResource rRoot = createRequest(getFlag); VirtualArrayInternalFlags resp = null; try { resp = addSignature(rRoot).get(VirtualArrayInternalFlags.class); } catch (UniformInterfaceException e) { _log.warn("could not get registered status of varray {}. Err:{}", id, e); if (e.getResponse().getStatus() == 404) { throw APIException.notFound.unableToFindEntityInURL(id); } } return resp.getDeviceRegistered(); }
/** * Get device registered status of a virtual array * * @param id the URN of a ViPR varray * @return the VirtualArrayInternalFlags */ @GET @Path("/{id}/deviceRegistered") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public VirtualArrayInternalFlags getDeviceRegistered(@PathParam("id") URI id) { VirtualArray varray = getVirtualArrayById(id, true); VirtualArrayInternalFlags varrayInternalFlags = new VirtualArrayInternalFlags(); varrayInternalFlags.setDeviceRegistered(varray.getDeviceRegistered()); auditOp( OperationTypeEnum.GET_VARRAY_REGISTERED, true, null, id.toString(), varray.getLabel(), String.valueOf(varray.getDeviceRegistered())); return varrayInternalFlags; }
/** * Get protectionType attached with a virtual array * * @param id the URN of a ViPR varray * @return the VirtualArrayInternalFlags */ @GET @Path("/{id}/protectionType") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public VirtualArrayInternalFlags getProtectionType(@PathParam("id") URI id) { String protectionType = ""; VirtualArray varray = getVirtualArrayById(id, true); if (varray.getProtectionType() != null) { protectionType = varray.getProtectionType(); } VirtualArrayInternalFlags varrayInternalFlags = new VirtualArrayInternalFlags(); varrayInternalFlags.setProtectionType(protectionType); auditOp( OperationTypeEnum.GET_VARRAY_PROTECTIONTYPE, true, null, id.toString(), varray.getLabel(), protectionType); return varrayInternalFlags; }