Repository: corona-warn-app/cwa-server
File: common/federation/src/main/java/app/coronawarn/server/common/federation/client/FederationGatewayClient.java (Java)

Code before:

  /**
   * HTTP POST request federation gateway endpoint /diagnosiskyes/upload.
   *
   * @param raw            Payload body. This property contains a raw byte array with the encoded protobuf
   *                       DiagnosisKeyBatch.
   * @param batchTag       Unique batchTag to be identified by EFGS.
   * @param batchSignature Batch Signature as per PKCS#7 spec using Authorized Signing Certificate.
   */
  @PostMapping(value = "/diagnosiskeys/upload",
      consumes = "application/protobuf; version=1.0",
      headers = {"Accept=application/json; version=1.0",
          "X-SSL-Client-SHA256=${federation-gateway.ssl.certificate-sha}",
          "X-SSL-Client-DN=${federation-gateway.ssl.certificate-dn}"})
  ResponseEntity<BatchUploadResponse> postBatchUpload(
      byte[] raw,
      @RequestHeader("batchTag") String batchTag,
      @RequestHeader("batchSignature") String batchSignature);


  /**
   * HTTP GET request to federation gateway endpoint /diagnosiskeys/audit/download to get audit information about the
   * requested {@code batchtag} on the specific {@code date}. The EFGS audit interface can return the following
   * statuses: 200 - Returns the audit information for the {@code batch tag}. 400 - Invalid or missing request header.
   * 403 - Invalid or missing client certificate. 404 - The batch tag is not found or no data exists. 406 - Data format
   * or content is not valid. 410 - The date is expired or no more exists.
   *
   * @param date     The date for which the batch should be audited.
   * @param batchTag The batchTag of the batch that should be audited.
   * @return Response of the EFGS audit interface as string¬.
   */
  @GetMapping(value = "/diagnosiskeys/audit/download/{date}/{batchTag}",
      headers = {"Accept=application/json; version=1.0",
          "X-SSL-Client-SHA256=${federation-gateway.ssl.certificate-sha}",
          "X-SSL-Client-DN=${federation-gateway.ssl.certificate-dn}"})
  ResponseEntity<String> getAuditInformation(@PathVariable("date") String date,
      @PathVariable("batchTag") String batchTag);
}


Review comment (performance):
```suggestion
   * statuses:
   * <li>200 - Returns the audit information for the {@code batch tag}.</li>
   * <li>400 - Invalid or missing request header.</li>
   * <li>403 - Invalid or missing client certificate.</li>
   * <li>404 - The batch tag is not found or no data exists.</li>
   * <li>406 - Data format or content is not valid.</li>
   * <li>410 - The date is expired or no more exists.</li>
```

Code after:

  /**
   * HTTP POST request federation gateway endpoint /diagnosiskyes/upload.
   *
   * @param raw            Payload body. This property contains a raw byte array with the encoded protobuf
   *                       DiagnosisKeyBatch.
   * @param batchTag       Unique batchTag to be identified by EFGS.
   * @param batchSignature Batch Signature as per PKCS#7 spec using Authorized Signing Certificate.
   */
  @PostMapping(value = "/diagnosiskeys/upload",
      consumes = "application/protobuf; version=1.0",
      headers = {"Accept=application/json; version=1.0",
          "X-SSL-Client-SHA256=${federation-gateway.ssl.certificate-sha}",
          "X-SSL-Client-DN=${federation-gateway.ssl.certificate-dn}"})
  ResponseEntity<BatchUploadResponse> postBatchUpload(
      byte[] raw,
      @RequestHeader("batchTag") String batchTag,
      @RequestHeader("batchSignature") String batchSignature);

  /**
   * HTTP GET request to federation gateway endpoint /diagnosiskeys/audit/download to get audit information about the
   * requested {@code batchtag} on the specific {@code date}. The EFGS audit interface can return the following
   * statuses:
   * <li>200 - Returns the audit information for the {@code batch tag}.</li>
   * <li>400 - Invalid or missing request header.</li>
   * <li>403 - Invalid or missing client certificate.</li>
   * <li>404 - The batch tag is not found or no data exists.</li>
   * <li>406 - Data format or content is not valid.</li>
   * <li>410 - The date is expired or no more exists.</li>
   *
   * @param date     The date for which the batch should be audited.
   * @param batchTag The batchTag of the batch that should be audited.
   * @return Response of the EFGS audit interface as string.
   */
  @GetMapping(value = "/diagnosiskeys/audit/download/{date}/{batchTag}",
      headers = {"Accept=application/json; version=1.0",
          "X-SSL-Client-SHA256=${federation-gateway.ssl.certificate-sha}",
          "X-SSL-Client-DN=${federation-gateway.ssl.certificate-dn}"})
  ResponseEntity<String> getAuditInformation(@PathVariable("date") String date,
      @PathVariable("batchTag") String batchTag);
}