コード例 #1
0
  /**
   * Unset protection type assigned to the varray
   *
   * @param id the URN of a ViPR varry
   * @prereq none
   * @brief unset protection type field
   * @return No data returned in response body
   */
  @DELETE
  @Path("/{id}/protectionType")
  public Response unsetProtectionType(@PathParam("id") URI id) {
    VirtualArray varray = getVirtualArrayById(id, true);

    String origProtectionType =
        (varray.getProtectionType() == null) ? "" : varray.getProtectionType();

    varray.setProtectionType("");
    _dbClient.persistObject(varray);

    auditOp(
        OperationTypeEnum.UNSET_VARRAY_PROTECTIONTYPE,
        true,
        null,
        id.toString(),
        varray.getLabel(),
        origProtectionType);
    return Response.ok().build();
  }
コード例 #2
0
  /**
   * 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;
  }