briansolo1985 commented on code in PR #6434:
URL: https://github.com/apache/nifi/pull/6434#discussion_r984825389


##########
c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/C2HttpClient.java:
##########
@@ -123,18 +129,41 @@ public Optional<byte[]> retrieveUpdateContent(String 
flowUpdateUrl) {
 
     @Override
     public void acknowledgeOperation(C2OperationAck operationAck) {
-        logger.info("Acknowledging Operation [{}] C2 URL [{}]", 
operationAck.getOperationId(), clientConfig.getC2AckUrl());
+        logger.info("Acknowledging Operation {} C2 URL {}", 
operationAck.getOperationId(), clientConfig.getC2AckUrl());
         serializer.serialize(operationAck)
-            .map(operationAckBody -> RequestBody.create(operationAckBody, 
MEDIA_TYPE_APPLICATION_JSON))
+            .map(operationAckBody -> create(operationAckBody, 
MEDIA_TYPE_APPLICATION_JSON))
             .map(requestBody -> new 
Request.Builder().post(requestBody).url(clientConfig.getC2AckUrl()).build())
             
.map(C2RequestCompression.forType(clientConfig.getC2RequestCompression())::compress)
             .ifPresent(this::sendAck);
     }
 
+    @Override
+    public Optional<String> uploadDebugBundle(String debugCallbackUrl, byte[] 
debugBundle) {

Review Comment:
   Renamed the methods and parameters



##########
c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/C2HttpClient.java:
##########
@@ -123,18 +129,41 @@ public Optional<byte[]> retrieveUpdateContent(String 
flowUpdateUrl) {
 
     @Override
     public void acknowledgeOperation(C2OperationAck operationAck) {
-        logger.info("Acknowledging Operation [{}] C2 URL [{}]", 
operationAck.getOperationId(), clientConfig.getC2AckUrl());
+        logger.info("Acknowledging Operation {} C2 URL {}", 
operationAck.getOperationId(), clientConfig.getC2AckUrl());
         serializer.serialize(operationAck)
-            .map(operationAckBody -> RequestBody.create(operationAckBody, 
MEDIA_TYPE_APPLICATION_JSON))
+            .map(operationAckBody -> create(operationAckBody, 
MEDIA_TYPE_APPLICATION_JSON))
             .map(requestBody -> new 
Request.Builder().post(requestBody).url(clientConfig.getC2AckUrl()).build())
             
.map(C2RequestCompression.forType(clientConfig.getC2RequestCompression())::compress)
             .ifPresent(this::sendAck);
     }
 
+    @Override
+    public Optional<String> uploadDebugBundle(String debugCallbackUrl, byte[] 
debugBundle) {
+        Request request = new Request.Builder()
+            .url(debugCallbackUrl)
+            .post(new MultipartBody.Builder()
+                .setType(FORM)
+                .addFormDataPart(MULTIPART_FORM_FILE_FIELD_NAME, 
DEBUG_BUNDLE_FILE_NAME, create(debugBundle, DEBUG_BUNDLE_MIME_TYPE))
+                .build())
+            .build();
+
+        logger.info("Uploading debug bundle to url {} with size {}", 
debugCallbackUrl, debugBundle.length);
+        try (Response response = 
httpClientReference.get().newCall(request).execute()) {
+            if (!response.isSuccessful()) {
+                logger.warn("Upload debug bundle failed to C2 server {} with 
status code {}", debugCallbackUrl, response.code());

Review Comment:
   Changed level to error



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to