[ 
https://issues.apache.org/jira/browse/GOBBLIN-1130?focusedWorklogId=427850&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-427850
 ]

ASF GitHub Bot logged work on GOBBLIN-1130:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Apr/20 20:58
            Start Date: 27/Apr/20 20:58
    Worklog Time Spent: 10m 
      Work Description: jack-moseley commented on a change in pull request 
#2971:
URL: https://github.com/apache/incubator-gobblin/pull/2971#discussion_r416143398



##########
File path: 
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanMultiCallables.java
##########
@@ -375,4 +375,44 @@ public AzkabanClientStatus call()
       }
     }
   }
+
+  /**
+   * A callable that will add a proxy user to a project on Azkaban
+   */
+  @Builder
+  static class addProxyUserCallable implements Callable<AzkabanClientStatus> {
+    private AzkabanClient client;
+    private String projectName;
+    private String proxyUserName;
+    private boolean invalidSession = false;
+
+    @Override
+    public AzkabanClientStatus call()
+        throws AzkabanClientException {
+      try (Closer closer = Closer.create()) {
+        client.refreshSession(this.invalidSession);
+        List<NameValuePair> nvps = new ArrayList<>();
+        nvps.add(new BasicNameValuePair(AzkabanClientParams.AJAX, 
"addProxyUser"));
+        nvps.add(new BasicNameValuePair(AzkabanClientParams.SESSION_ID, 
client.sessionId));
+        nvps.add(new BasicNameValuePair(AzkabanClientParams.PROJECT, 
projectName));
+        nvps.add(new BasicNameValuePair(AzkabanClientParams.NAME, 
proxyUserName));
+
+        Header contentType = new BasicHeader(HttpHeaders.CONTENT_TYPE, 
"application/x-www-form-urlencoded");
+        Header requestType = new BasicHeader("X-Requested-With", 
"XMLHttpRequest");
+
+        HttpGet httpGet = new HttpGet(client.url + "/manager?" + 
URLEncodedUtils.format(nvps, "UTF-8"));
+        httpGet.setHeaders(new Header[]{contentType, requestType});
+
+        CloseableHttpResponse response = client.httpClient.execute(httpGet);
+        closer.register(response);
+        client.handleResponse(response);

Review comment:
       I was just copying how the other methods did it, I'll change it at those 
places as well.




----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 427850)
    Time Spent: 50m  (was: 40m)

> Add API for adding proxy user to azkaban project
> ------------------------------------------------
>
>                 Key: GOBBLIN-1130
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1130
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Jack Moseley
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to