rhtyd commented on a change in pull request #3553: CloudStack Backup & Recovery 
Framework
URL: https://github.com/apache/cloudstack/pull/3553#discussion_r378977333
 
 

 ##########
 File path: 
plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java
 ##########
 @@ -160,7 +155,25 @@ protected void setVeeamSshCredentials(String hostIp, 
String username, String pas
         this.veeamServerPassword = password;
     }
 
+    private void authenticate() {
+        // 
https://helpcenter.veeam.com/docs/backup/rest/http_authentication.html?ver=95u4
+        final HttpPost request = new HttpPost(apiURI.toString() + 
"/sessionMngr/?v=v1_4");
+        try {
+            final HttpResponse response = httpClient.execute(request, 
httpContext);
+            veeamSessionId = 
response.getFirstHeader(SESSION_HEADER).getValue();
+            checkAuthFailure(response);
+            if (response.getStatusLine().getStatusCode() != 
HttpStatus.SC_CREATED) {
+                throw new CloudRuntimeException("Failed to create and 
authenticate Veeam API client, please check the settings.");
+            }
 
 Review comment:
   I've refactored this to fail fast initially when the client is created 
(which authenticates on creation)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to