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

ASF GitHub Bot logged work on KNOX-2156:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Dec/19 21:05
            Start Date: 20/Dec/19 21:05
    Worklog Time Spent: 10m 
      Work Description: pzampino commented on pull request #228: KNOX-2156 - CM 
discovery - KUDUUI discovery
URL: https://github.com/apache/knox/pull/228#discussion_r360574806
 
 

 ##########
 File path: 
gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/kudu/KuduUIServiceModelGenerator.java
 ##########
 @@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations 
under
+ * the License.
+ */
+package org.apache.knox.gateway.topology.discovery.cm.model.kudu;
+
+import com.cloudera.api.swagger.client.ApiException;
+import com.cloudera.api.swagger.model.ApiConfigList;
+import com.cloudera.api.swagger.model.ApiRole;
+import com.cloudera.api.swagger.model.ApiService;
+import com.cloudera.api.swagger.model.ApiServiceConfig;
+import org.apache.knox.gateway.topology.discovery.cm.ServiceModel;
+import 
org.apache.knox.gateway.topology.discovery.cm.model.AbstractServiceModelGenerator;
+
+import java.util.Locale;
+
+public class KuduUIServiceModelGenerator extends AbstractServiceModelGenerator 
{
+
+  public static final String SERVICE      = "KUDUUI";
+  public static final String SERVICE_TYPE = "KUDU";
+  public static final String ROLE_TYPE    = "KUDU_MASTER";
+
+
+  @Override
+  public String getService() {
+    return SERVICE;
+  }
+
+  @Override
+  public String getServiceType() {
+    return SERVICE_TYPE;
+  }
+
+  @Override
+  public String getRoleType() {
+    return ROLE_TYPE;
+  }
+
+  @Override
+  public ServiceModel.Type getModelType() {
+    return ServiceModel.Type.UI;
+  }
+
+  @Override
+  public ServiceModel generateService(ApiService service, ApiServiceConfig 
serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
+    String hostname = role.getHostRef().getHostname();
+
+    boolean sslEnabled = Boolean.parseBoolean(getRoleConfigValue(roleConfig, 
"ssl_enabled"));
+    String scheme = sslEnabled ? "https" : "http";
+
+    String port = getRoleConfigValue(roleConfig, "webserver_port");
+    return createServiceModel(String.format(Locale.getDefault(), 
"%s://%s:%s/", scheme, hostname, port));
 
 Review comment:
   Local.getDefault() is used in the others. We can revisit that for all of 
them.
 
----------------------------------------------------------------
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: 361860)
    Time Spent: 40m  (was: 0.5h)

> CM discovery - KUDUUI discovery
> -------------------------------
>
>                 Key: KNOX-2156
>                 URL: https://issues.apache.org/jira/browse/KNOX-2156
>             Project: Apache Knox
>          Issue Type: Sub-task
>          Components: Server
>    Affects Versions: 1.3.0
>            Reporter: Philip Zampino
>            Assignee: Philip Zampino
>            Priority: Major
>             Fix For: 1.4.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Apache Kudu UI URL(s) should be discovered from ClouderaManager-managed 
> clusters.



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

Reply via email to