-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CYB-139][CYB-151][CYB-164] Transferring the configuration in a zip a…
…rchive between clusters. New rest api with UI. (#61)
- Loading branch information
1 parent
a57f6a0
commit 97aaef0
Showing
111 changed files
with
11,446 additions
and
5,979 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.cloudera.cyber</groupId> | ||
<artifactId>cyber-services</artifactId> | ||
<version>2.3.1</version> | ||
</parent> | ||
<artifactId>cyber-service-common</artifactId> | ||
<name>Archetype - cyber-service-common</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<commons-compress.version>1.24.0</commons-compress.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-compress</artifactId> | ||
<version>${commons-compress.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<scope>test</scope> | ||
<version>${assertj.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
36 changes: 36 additions & 0 deletions
36
.../cyber-services/cyber-service-common/src/main/java/com/cloudera/service/common/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.cloudera.service.common; | ||
|
||
import lombok.experimental.UtilityClass; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.Arrays; | ||
import java.util.function.Function; | ||
|
||
@UtilityClass | ||
public class Utils { | ||
|
||
/** | ||
* Retrieves an enum constant of the specified enum type based on a case-insensitive search of a string representation, | ||
* using a custom mapping function to extract the string representation from the enum constant. | ||
* | ||
* @param <T> the enum type | ||
* @param name the string representation to search for | ||
* @param enumClass the Class object representing the enum type | ||
* @param nameFunction a function that extracts the string representation from an enum constant | ||
* @return the enum constant matching the provided string representation, or null if not found | ||
* @throws NullPointerException if {@code name}, {@code enumClass}, or {@code nameFunction} is null | ||
*/ | ||
public static <T extends Enum<T>> T getEnumFromString(String name, Class<T> enumClass, Function<T, String> nameFunction) { | ||
return Arrays.stream(enumClass.getEnumConstants()) | ||
.filter(type -> StringUtils.equalsIgnoreCase(name, nameFunction.apply(type))) | ||
.findFirst() | ||
.orElse(null); | ||
} | ||
|
||
public static <T extends Enum<T>> T getEnumFromStringContains(String name, Class<T> enumClass, Function<T, String> nameFunction) { | ||
return Arrays.stream(enumClass.getEnumConstants()) | ||
.filter(type -> StringUtils.containsIgnoreCase(name, nameFunction.apply(type))) | ||
.findFirst() | ||
.orElse(null); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ommon/src/main/java/com/cloudera/service/common/config/kafka/ClouderaKafkaProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.cloudera.service.common.config.kafka; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.autoconfigure.kafka.KafkaProperties; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Getter | ||
@Setter | ||
public class ClouderaKafkaProperties extends KafkaProperties { | ||
private String replyTopic; | ||
private String requestTopic; | ||
} |
4 changes: 4 additions & 0 deletions
4
...main/java/com/cloudera/service/common/config/kafka/ClouderaManagementKafkaProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.cloudera.service.common.config.kafka; | ||
|
||
public class ClouderaManagementKafkaProperties extends ClouderaKafkaProperties{ | ||
} |
4 changes: 4 additions & 0 deletions
4
...src/main/java/com/cloudera/service/common/config/kafka/ClouderaWorkerKafkaProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.cloudera.service.common.config.kafka; | ||
|
||
public class ClouderaWorkerKafkaProperties extends ClouderaKafkaProperties { | ||
} |
18 changes: 18 additions & 0 deletions
18
...s/cyber-service-common/src/main/java/com/cloudera/service/common/request/RequestBody.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.cloudera.service.common.request; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class RequestBody { | ||
private String clusterServiceId; | ||
private String jobIdHex; | ||
private String pipelineDir; | ||
private String branch; | ||
private byte[] payload; | ||
} |
5 changes: 5 additions & 0 deletions
5
...s/cyber-service-common/src/main/java/com/cloudera/service/common/request/RequestType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.cloudera.service.common.request; | ||
|
||
public enum RequestType { | ||
GET_ALL_CLUSTERS_SERVICE_REQUEST, GET_CLUSTER_SERVICE_REQUEST, START_JOB_REQUEST, RESTART_JOB_REQUEST, STOP_JOB_REQUEST, GET_JOB_CONFIG_REQUEST, UPDATE_JOB_CONFIG_REQUEST | ||
} |
18 changes: 18 additions & 0 deletions
18
.../cyber-service-common/src/main/java/com/cloudera/service/common/response/ClusterMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.cloudera.service.common.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ClusterMeta { | ||
private String name; | ||
private String clusterId; | ||
private String clusterStatus; | ||
private String version; | ||
private String flinkVersion; | ||
} |
61 changes: 61 additions & 0 deletions
61
...services/cyber-service-common/src/main/java/com/cloudera/service/common/response/Job.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.cloudera.service.common.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.apache.flink.api.common.JobID; | ||
import org.apache.flink.api.common.JobStatus; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Job { | ||
private JobID jobId; | ||
|
||
private String jobIdString; | ||
|
||
private String jobFullName; | ||
|
||
private String jobName; | ||
|
||
private JobStatus jobState; | ||
|
||
private String jobBranch; | ||
|
||
private String jobPipeline; | ||
|
||
private String startTime; | ||
|
||
private JobType jobType; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
public enum JobType { | ||
GENERATOR("generate", "cs-restart-generator", "."), | ||
PARSER("parse", "cs-restart-parser", "."), | ||
TRIAGE("triage", "cs-restart-triage", "."), | ||
PROFILE("profile", "cs-restart-profile", "."), | ||
INDEX("index", "cs-restart-index", "."); | ||
|
||
private final String name; | ||
private final String scriptName; | ||
private final String nameDelimiter; | ||
|
||
public String[] getScript(Job job) { | ||
switch (this) { | ||
case GENERATOR: | ||
case PROFILE: | ||
case PARSER: | ||
return new String[]{scriptName, job.getJobBranch(), job.getJobPipeline(), job.getJobName()}; | ||
case INDEX: | ||
case TRIAGE: | ||
return new String[]{scriptName, job.getJobBranch(), job.getJobPipeline()}; | ||
} | ||
return new String[]{}; | ||
} | ||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...cyber-service-common/src/main/java/com/cloudera/service/common/response/ResponseBody.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.cloudera.service.common.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ResponseBody { | ||
private Map<String, String> jobConfigs; | ||
private List<Job> jobs; | ||
private Map<String, String> errorMessage; | ||
private ClusterMeta clusterMeta; | ||
} |
5 changes: 5 additions & 0 deletions
5
...cyber-service-common/src/main/java/com/cloudera/service/common/response/ResponseType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.cloudera.service.common.response; | ||
|
||
public enum ResponseType { | ||
GET_ALL_CLUSTERS_SERVICE_RESPONSE, GET_CLUSTER_SERVICE_RESPONSE, START_JOB_RESPONSE, RESTART_JOB_RESPONSE, STOP_JOB_RESPONSE, GET_JOB_CONFIG_RESPONSE, UPDATE_JOB_CONFIG_RESPONSE, ERROR_RESPONSE | ||
} |
Oops, something went wrong.