Compare commits
6 Commits
refactor
...
MinimisedM
| Author | SHA1 | Date |
|---|---|---|
|
|
566baf015d | 3 years ago |
|
|
62d69d09e0 | 3 years ago |
|
|
efcbda9d40 | 3 years ago |
|
|
babc205261 | 3 years ago |
|
|
4043c59f36 | 3 years ago |
|
|
c25d1e982d | 3 years ago |
10 changed files with 41 additions and 601 deletions
@ -1,61 +0,0 @@ |
|||||||
package rest; |
|
||||||
|
|
||||||
import java.util.Collections; |
|
||||||
import java.util.LinkedHashMap; |
|
||||||
import java.util.Set; |
|
||||||
|
|
||||||
import dto.ScanObj; |
|
||||||
import dto.ConnectDB; |
|
||||||
import org.slf4j.Logger; |
|
||||||
import org.slf4j.LoggerFactory; |
|
||||||
|
|
||||||
import javax.ws.rs.GET; |
|
||||||
import javax.ws.rs.Path; |
|
||||||
import javax.ws.rs.PathParam; |
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
import io.quarkus.security.Authenticated; |
|
||||||
|
|
||||||
// @Path("/api/v1/[osh-scan]")
|
|
||||||
@Path("/scanGet") |
|
||||||
@Authenticated |
|
||||||
public class CreateGetResource { |
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CreateGetResource.class); |
|
||||||
|
|
||||||
CreateScanService createScanService; |
|
||||||
|
|
||||||
private Set<ScanObj> Scans = Collections.newSetFromMap(Collections.synchronizedMap(new LinkedHashMap<>())); |
|
||||||
|
|
||||||
public CreateGetResource() { |
|
||||||
// LDB: @TODO either put some code here or remove this not used public constructor
|
|
||||||
} |
|
||||||
|
|
||||||
@GET |
|
||||||
@Path("/{scanId}") |
|
||||||
public Set<ScanObj> list(@PathParam("scanId") String scanId) { |
|
||||||
//use to return specific scanIds just use usual fetch from sets, will be querying hte db directly here
|
|
||||||
ConnectDB connectDB = new ConnectDB(); |
|
||||||
String sql = "SELECT * FROM scans WHERE scan_id=?"; |
|
||||||
try(Connection conn = connectDB.connect(); |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql)) { |
|
||||||
pstmt.setString(1, scanId); |
|
||||||
ResultSet rs = pstmt.executeQuery(); |
|
||||||
while (rs.next()) { |
|
||||||
//very ugly solution needs some change to where we put the query
|
|
||||||
Scans.add(new ScanObj( |
|
||||||
rs.getString("scan_id"), |
|
||||||
rs.getString("offering_id"), |
|
||||||
rs.getString("event_id"), |
|
||||||
rs.getString("is_managed_service"), |
|
||||||
rs.getString("component_list"))); |
|
||||||
} |
|
||||||
} catch (SQLException e) { |
|
||||||
logger.error(e.getMessage()); |
|
||||||
} |
|
||||||
return Scans; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,53 +0,0 @@ |
|||||||
package rest; |
|
||||||
|
|
||||||
import dto.ConnectDB; |
|
||||||
import dto.ScanObjPayload; |
|
||||||
import dto.ScanObj; |
|
||||||
import dto.ScanObjPayload; |
|
||||||
import org.eclipse.microprofile.rest.client.inject.RestClient; |
|
||||||
import org.json.JSONObject; |
|
||||||
|
|
||||||
import org.eclipse.microprofile.rest.client.inject.RestClient; |
|
||||||
import org.json.JSONException; |
|
||||||
import org.json.JSONObject; |
|
||||||
import org.slf4j.Logger; |
|
||||||
import org.slf4j.LoggerFactory; |
|
||||||
import java.net.URISyntaxException; |
|
||||||
import io.quarkus.security.Authenticated; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.ws.rs.Consumes; |
|
||||||
import javax.ws.rs.POST; |
|
||||||
import javax.ws.rs.Path; |
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
@Path("/") |
|
||||||
public class CreateScanResource { |
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CreateScanResource.class); |
|
||||||
|
|
||||||
@RestClient |
|
||||||
CreateScanService createScanService; |
|
||||||
|
|
||||||
@POST |
|
||||||
@Consumes({ "application/json" }) |
|
||||||
//in theory should take List<String> to clean it up
|
|
||||||
public void invokeScanAnalyze(@Valid String scanInvocation) throws URISyntaxException { |
|
||||||
throw new UnsupportedOperationException("unImplemented fucntionality"); |
|
||||||
// JSONObject jsonData = new JSONObject(scanInvocation);
|
|
||||||
// ScanObj scanObj = ScanObjPayload.constructScanPayload(jsonData);
|
|
||||||
// ConnectDB connectDB = new ConnectDB();
|
|
||||||
// Connection conn = connectDB.connect();
|
|
||||||
// Statement stmt = null;
|
|
||||||
// String sql = "INSERT INTO scans (scanid, productid, eventid, ismanagedservice, componentlist) VALUES ('" +scanObj.scanId+"', '"+scanObj.productId+"', '"+scanObj.eventId+"', '"+scanObj.isManagedService+"', '"+scanObj.componentList+"')";
|
|
||||||
// try{
|
|
||||||
// stmt = conn.createStatement();
|
|
||||||
// ResultSet rs = stmt.executeQuery(sql);
|
|
||||||
// conn.close();
|
|
||||||
// } catch (SQLException e){
|
|
||||||
// System.out.println(e);
|
|
||||||
// }
|
|
||||||
// return scanObj;
|
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,68 +0,0 @@ |
|||||||
package rest; |
|
||||||
|
|
||||||
import dto.ConnectDB; |
|
||||||
import dto.ScanObj; |
|
||||||
import io.quarkus.security.Authenticated; |
|
||||||
import org.eclipse.microprofile.rest.client.inject.RestClient; |
|
||||||
|
|
||||||
import java.net.URISyntaxException; |
|
||||||
import io.quarkus.security.Authenticated; |
|
||||||
|
|
||||||
import org.eclipse.microprofile.rest.client.inject.RestClient; |
|
||||||
import org.slf4j.Logger; |
|
||||||
import org.slf4j.LoggerFactory; |
|
||||||
|
|
||||||
import javax.ws.rs.Path; |
|
||||||
import javax.ws.rs.PUT; |
|
||||||
import javax.ws.rs.PathParam; |
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
@Authenticated |
|
||||||
@Path("/startScan") |
|
||||||
public class CreateStartScan { |
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CreateStartScan.class); |
|
||||||
|
|
||||||
@RestClient |
|
||||||
CreateScanService createScanService; |
|
||||||
GreetingResource greetingResource; |
|
||||||
|
|
||||||
@PUT |
|
||||||
@Path("/{scanId}") |
|
||||||
public void invokeScanAnalyze(@PathParam("scanId") String scanId) throws URISyntaxException { |
|
||||||
throw new UnsupportedOperationException("unImplemented fucntionality"); |
|
||||||
// ConnectDB connectDB = new ConnectDB();
|
|
||||||
// Connection conn = connectDB.connect();
|
|
||||||
// //this is ugly needs to berewritten
|
|
||||||
// Statement stmt = null;
|
|
||||||
// ScanObj finalScan = null;
|
|
||||||
|
|
||||||
// String sql = "SELECT * FROM scans WHERE scanid=" + scanId;
|
|
||||||
// //need to add figure out an archieve system and wether its nessacery (archieve value??)
|
|
||||||
// try{
|
|
||||||
// stmt = conn.createStatement();
|
|
||||||
// //terrible solution has to be a better way of doing this
|
|
||||||
// ResultSet rs = stmt.executeQuery(sql);
|
|
||||||
|
|
||||||
// //fix for individual results (not resultset)
|
|
||||||
// //TODO: need to add unique keys to DBs
|
|
||||||
// finalScan = new ScanObj(rs.getString("scanid"),rs.getString("productid"),rs.getString("eventid"),rs.getString("ismanagedservice"),rs.getString("componentlist"));
|
|
||||||
// String copySql = "INSERT INTO archive (scanid, productid, eventid, ismanagedservice, componentlist) VALUES ('" +finalScan.scanId+"', '"+finalScan.productId+"', '"+finalScan.eventId+"', '"+finalScan.isManagedService+"', '"+finalScan.componentList+"')";
|
|
||||||
// stmt.executeUpdate(copySql);
|
|
||||||
|
|
||||||
// //TODO add proper checks
|
|
||||||
// String deleteSql = "DELETE FROM scans WHERE scanid=" + scanId;
|
|
||||||
// stmt.executeUpdate(deleteSql);
|
|
||||||
|
|
||||||
// //send task to the actual interface here using the resultset returned (should multiple scanids be allowed):
|
|
||||||
// //once the task is complete AND we have confirmation that the scan is done run the following sql
|
|
||||||
// conn.close();
|
|
||||||
// } catch (SQLException e){
|
|
||||||
// System.out.println(e);
|
|
||||||
// }
|
|
||||||
// return finalScan;
|
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,43 +0,0 @@ |
|||||||
package rest; |
|
||||||
|
|
||||||
import dto.ConnectDB; |
|
||||||
|
|
||||||
import org.eclipse.microprofile.rest.client.inject.RestClient; |
|
||||||
import org.slf4j.Logger; |
|
||||||
import org.slf4j.LoggerFactory; |
|
||||||
|
|
||||||
import javax.ws.rs.Path; |
|
||||||
import javax.ws.rs.DELETE; |
|
||||||
import javax.ws.rs.PathParam; |
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.PreparedStatement; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
@Path("/deleteScan") |
|
||||||
public class RemoveScan { |
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(RemoveScan.class); |
|
||||||
|
|
||||||
// @Inject
|
|
||||||
@RestClient |
|
||||||
CreateScanService createScanService; |
|
||||||
|
|
||||||
@DELETE |
|
||||||
@Path("/{scanId}") |
|
||||||
public boolean invokeScanAnalyze(@PathParam("scanId") String scanId) { |
|
||||||
boolean rc = false; |
|
||||||
//send task to the actual interface here using the resultset returned (should multiple scanids be allowed):
|
|
||||||
//once the task is complete AND we have confirmation that the scan is done run the following sql
|
|
||||||
String qry = "DELETE FROM scans WHERE scan_id=?"; |
|
||||||
ConnectDB connectDB = new ConnectDB(); |
|
||||||
try(Connection conn = connectDB.connect(); |
|
||||||
PreparedStatement pstmt = conn.prepareStatement(qry)) { |
|
||||||
pstmt.setString(1, scanId); |
|
||||||
pstmt.executeUpdate(); |
|
||||||
rc = true; |
|
||||||
} catch (SQLException e) { |
|
||||||
logger.error(e.getMessage()); |
|
||||||
} |
|
||||||
return rc; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,52 +0,0 @@ |
|||||||
// package rest;
|
|
||||||
|
|
||||||
|
|
||||||
// import dto.ConnectDB;
|
|
||||||
// import dto.Scan;
|
|
||||||
|
|
||||||
import org.hibernate.Session; |
|
||||||
import org.hibernate.SessionFactory; |
|
||||||
import org.hibernate.Transaction; |
|
||||||
import org.hibernate.boot.Metadata; |
|
||||||
import org.hibernate.boot.MetadataSources; |
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry; |
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; |
|
||||||
|
|
||||||
import javax.ws.rs.GET; |
|
||||||
import javax.ws.rs.Path; |
|
||||||
// import org.hibernate.EntityManager;
|
|
||||||
|
|
||||||
|
|
||||||
// @Path("/storeData")
|
|
||||||
// public class StoreData {
|
|
||||||
|
|
||||||
// //all of these need cleaning up to be a more sensible soution
|
|
||||||
// // @RestClient
|
|
||||||
// // CreateScanService createScanService;
|
|
||||||
|
|
||||||
// @GET
|
|
||||||
// public void Store() {
|
|
||||||
|
|
||||||
// //Create typesafe ServiceRegistry object
|
|
||||||
// StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build();
|
|
||||||
|
|
||||||
// Metadata meta = new MetadataSources(ssr).getMetadataBuilder().build();
|
|
||||||
|
|
||||||
// SessionFactory factory = meta.getSessionFactoryBuilder().build();
|
|
||||||
// Session session = factory.openSession();
|
|
||||||
// Transaction t = session.beginTransaction();
|
|
||||||
// Scan e1=new Scan();
|
|
||||||
// e1.setScanId(2);
|
|
||||||
// e1.setProductId("1");
|
|
||||||
// e1.setEventId("Chawla");
|
|
||||||
// e1.setIsManagedService("aa");
|
|
||||||
// e1.setComponentList("aaa");
|
|
||||||
|
|
||||||
// session.save(e1);
|
|
||||||
// t.commit();
|
|
||||||
// System.out.println("successfully saved");
|
|
||||||
// factory.close();
|
|
||||||
// session.close();
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@ -1,20 +0,0 @@ |
|||||||
// package rest;
|
|
||||||
|
|
||||||
// import java.util.List;
|
|
||||||
|
|
||||||
// import jakarta.enterprise.context.ApplicationScoped;
|
|
||||||
// import io.fabric8.tekton.client.TektonClient;
|
|
||||||
// import io.fabric8.tekton.pipeline.v1beta1.Pipeline;
|
|
||||||
|
|
||||||
|
|
||||||
// @ApplicationScoped
|
|
||||||
// public class TektonResourceClient {
|
|
||||||
|
|
||||||
// // @Inject
|
|
||||||
// TektonClient tektonClient;l
|
|
||||||
|
|
||||||
// public List<Pipeline> listPipelines() {
|
|
||||||
// return tektonClient.v1beta1().pipelines().list().getItems();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
@ -1,175 +0,0 @@ |
|||||||
// package rest;
|
|
||||||
|
|
||||||
|
|
||||||
import io.fabric8.tekton.client.DefaultTektonClient; |
|
||||||
import io.fabric8.tekton.client.TektonClient; |
|
||||||
|
|
||||||
|
|
||||||
import javax.inject.Inject; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.ws.rs.Consumes; |
|
||||||
import javax.ws.rs.POST; |
|
||||||
import javax.ws.rs.Path; |
|
||||||
import java.net.URI; |
|
||||||
import java.net.URISyntaxException; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Arrays; |
|
||||||
import java.util.List; |
|
||||||
import java.util.UUID; |
|
||||||
import org.json.JSONObject; |
|
||||||
import org.json.JSONArray; |
|
||||||
import dto.ScanObj; |
|
||||||
import dto.BrewObj; |
|
||||||
import dto.ConnectDB; |
|
||||||
import dto.ScanObjPayload; |
|
||||||
import dto.BrewObjPayload; |
|
||||||
import dto.GitObj; |
|
||||||
import dto.GitObjPayload; |
|
||||||
import dto.PncObj; |
|
||||||
import dto.PncObjPayload; |
|
||||||
|
|
||||||
import static constants.HttpHeaders.AUTHORIZATION_STRING; |
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.DriverManager; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.DriverManager; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.sql.Statement; |
|
||||||
|
|
||||||
import java.util.Collections; |
|
||||||
import java.util.LinkedHashMap; |
|
||||||
import java.util.Set; |
|
||||||
import dto.ScanObj; |
|
||||||
import dto.ConnectDB; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.DriverManager; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.DriverManager; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.sql.Statement; |
|
||||||
|
|
||||||
import javax.ws.rs.DELETE; |
|
||||||
import javax.ws.rs.GET; |
|
||||||
import javax.ws.rs.POST; |
|
||||||
import javax.ws.rs.Path; |
|
||||||
import javax.inject.Inject; |
|
||||||
import javax.ws.rs.GET; |
|
||||||
import javax.ws.rs.Path; |
|
||||||
import javax.ws.rs.PathParam; |
|
||||||
import java.util.Set; |
|
||||||
import java.util.stream.Collectors; |
|
||||||
import javax.inject.Inject; |
|
||||||
import javax.ws.rs.Consumes; |
|
||||||
|
|
||||||
import java.sql.*; |
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper; |
|
||||||
import com.fasterxml.jackson.databind.ObjectWriter; |
|
||||||
|
|
||||||
// import org.hibernate.EntityManager;
|
|
||||||
import jakarta.persistence.EntityManager; |
|
||||||
import jakarta.persistence.Cacheable; |
|
||||||
import jakarta.persistence.Column; |
|
||||||
import jakarta.persistence.Entity; |
|
||||||
import jakarta.persistence.GeneratedValue; |
|
||||||
import jakarta.persistence.Id; |
|
||||||
import jakarta.persistence.NamedQuery; |
|
||||||
import jakarta.persistence.QueryHint; |
|
||||||
import jakarta.persistence.SequenceGenerator; |
|
||||||
import jakarta.persistence.Table; |
|
||||||
|
|
||||||
|
|
||||||
import io.fabric8.tekton.client.DefaultTektonClient; |
|
||||||
import io.fabric8.tekton.client.TektonClient; |
|
||||||
import io.fabric8.tekton.pipeline.v1beta1.TaskBuilder; |
|
||||||
import io.fabric8.tekton.pipeline.v1beta1.Task; |
|
||||||
|
|
||||||
import org.eclipse.microprofile.rest.client.inject.RestClient; |
|
||||||
import dto.ScanObj; |
|
||||||
|
|
||||||
import javax.inject.Inject; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.ws.rs.Consumes; |
|
||||||
import javax.ws.rs.POST; |
|
||||||
import javax.ws.rs.Path; |
|
||||||
import java.net.URI; |
|
||||||
import java.net.URISyntaxException; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Arrays; |
|
||||||
import java.util.List; |
|
||||||
import java.util.UUID; |
|
||||||
import org.json.JSONObject; |
|
||||||
import org.json.JSONArray; |
|
||||||
import dto.ScanObj; |
|
||||||
import dto.BrewObj; |
|
||||||
import dto.ConnectDB; |
|
||||||
import dto.ScanObjPayload; |
|
||||||
import dto.BrewObjPayload; |
|
||||||
import dto.GitObj; |
|
||||||
import dto.GitObjPayload; |
|
||||||
import dto.PncObj; |
|
||||||
import dto.PncObjPayload; |
|
||||||
|
|
||||||
import static constants.HttpHeaders.AUTHORIZATION_STRING; |
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.DriverManager; |
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
import java.sql.Connection; |
|
||||||
import java.sql.DriverManager; |
|
||||||
import java.sql.ResultSet; |
|
||||||
import java.sql.Statement; |
|
||||||
|
|
||||||
import io.fabric8.tekton.client.DefaultTektonClient; |
|
||||||
import io.fabric8.tekton.client.TektonClient; |
|
||||||
import io.fabric8.tekton.pipeline.v1beta1.TaskBuilder; |
|
||||||
import io.fabric8.tekton.pipeline.v1beta1.TaskRunBuilder; |
|
||||||
|
|
||||||
|
|
||||||
@Path("/tekton") |
|
||||||
public class TektonTaskCreate { |
|
||||||
|
|
||||||
@RestClient |
|
||||||
|
|
||||||
private static final String NAMESPACE = "default"; |
|
||||||
|
|
||||||
@POST |
|
||||||
@Consumes({ "application/json" }) |
|
||||||
public void invokeTektonTask(String data) { |
|
||||||
JSONObject jsonData = new JSONObject(data); |
|
||||||
// ScanObj scanObj = ScanObjPayload.constructScanPayload(jsonData);
|
|
||||||
|
|
||||||
//dont leave this in live needs to be adjusted (currently would cause a ton of issues)
|
|
||||||
String tektonArgs = "osh-cli mock-build --config="+jsonData.get("config")+"--brew-build"+jsonData.get("nvr"); |
|
||||||
|
|
||||||
try (TektonClient tkn = new DefaultTektonClient()) { |
|
||||||
// Create Task
|
|
||||||
tkn.v1beta1().tasks().inNamespace(NAMESPACE).resource(new TaskBuilder() |
|
||||||
.withNewMetadata().withName("tekton-osh-client").endMetadata() |
|
||||||
.withNewSpec() |
|
||||||
.addNewStep() |
|
||||||
.withName("osh-client") |
|
||||||
.withImage("alpine:3.12") |
|
||||||
.withCommand("osh-cli") |
|
||||||
.withArgs(tektonArgs) |
|
||||||
.endStep() |
|
||||||
.endSpec() |
|
||||||
.build()).createOrReplace(); |
|
||||||
|
|
||||||
// Create TaskRun
|
|
||||||
tkn.v1beta1().taskRuns().inNamespace(NAMESPACE).resource(new TaskRunBuilder() |
|
||||||
.withNewMetadata().withName("tekton-osh-client-task-run").endMetadata() |
|
||||||
.withNewSpec() |
|
||||||
.withNewTaskRef() |
|
||||||
.withName("tekton-osh-client") |
|
||||||
.endTaskRef() |
|
||||||
.endSpec() |
|
||||||
.build()).createOrReplace(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,116 +0,0 @@ |
|||||||
// package rest;
|
|
||||||
|
|
||||||
|
|
||||||
// import io.fabric8.tekton.client.DefaultTektonClient;
|
|
||||||
// import io.fabric8.tekton.client.TektonClient;
|
|
||||||
|
|
||||||
|
|
||||||
// import javax.inject.Inject;
|
|
||||||
// import javax.validation.Valid;
|
|
||||||
// import javax.ws.rs.Consumes;
|
|
||||||
// import javax.ws.rs.POST;
|
|
||||||
// import javax.ws.rs.Path;
|
|
||||||
// import java.net.URI;
|
|
||||||
// import java.net.URISyntaxException;
|
|
||||||
// import java.util.ArrayList;
|
|
||||||
// import java.util.Arrays;
|
|
||||||
// import java.util.List;
|
|
||||||
// import java.util.UUID;
|
|
||||||
// import org.json.JSONObject;
|
|
||||||
// import org.json.JSONArray;
|
|
||||||
// import dto.ScanObj;
|
|
||||||
// import dto.BrewObj;
|
|
||||||
// import dto.ConnectDB;
|
|
||||||
// import dto.ScanObjPayload;
|
|
||||||
// import dto.BrewObjPayload;
|
|
||||||
// import dto.GitObj;
|
|
||||||
// import dto.GitObjPayload;
|
|
||||||
// import dto.PncObj;
|
|
||||||
// import dto.PncObjPayload;
|
|
||||||
|
|
||||||
// import static constants.HttpHeaders.AUTHORIZATION_STRING;
|
|
||||||
// import java.sql.Connection;
|
|
||||||
// import java.sql.DriverManager;
|
|
||||||
// import java.sql.SQLException;
|
|
||||||
|
|
||||||
// import java.sql.Connection;
|
|
||||||
// import java.sql.DriverManager;
|
|
||||||
// import java.sql.ResultSet;
|
|
||||||
// import java.sql.Statement;
|
|
||||||
|
|
||||||
// import java.util.Collections;
|
|
||||||
// import java.util.LinkedHashMap;
|
|
||||||
// import java.util.Set;
|
|
||||||
// import dto.ScanObj;
|
|
||||||
// import dto.ConnectDB;
|
|
||||||
|
|
||||||
// import java.sql.Connection;
|
|
||||||
// import java.sql.DriverManager;
|
|
||||||
// import java.sql.SQLException;
|
|
||||||
|
|
||||||
// import java.sql.Connection;
|
|
||||||
// import java.sql.DriverManager;
|
|
||||||
// import java.sql.ResultSet;
|
|
||||||
// import java.sql.Statement;
|
|
||||||
|
|
||||||
// import javax.ws.rs.DELETE;
|
|
||||||
// import javax.ws.rs.GET;
|
|
||||||
// import javax.ws.rs.POST;
|
|
||||||
// import javax.ws.rs.Path;
|
|
||||||
// import javax.inject.Inject;
|
|
||||||
// import javax.ws.rs.GET;
|
|
||||||
// import javax.ws.rs.Path;
|
|
||||||
// import javax.ws.rs.PathParam;
|
|
||||||
// import java.util.Set;
|
|
||||||
// import java.util.stream.Collectors;
|
|
||||||
// import javax.inject.Inject;
|
|
||||||
// import javax.ws.rs.Consumes;
|
|
||||||
|
|
||||||
// import java.sql.*;
|
|
||||||
|
|
||||||
// import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
// import com.fasterxml.jackson.databind.ObjectWriter;
|
|
||||||
|
|
||||||
// // import org.hibernate.EntityManager;
|
|
||||||
// import jakarta.persistence.EntityManager;
|
|
||||||
// import jakarta.persistence.Cacheable;
|
|
||||||
// import jakarta.persistence.Column;
|
|
||||||
// import jakarta.persistence.Entity;
|
|
||||||
// import jakarta.persistence.GeneratedValue;
|
|
||||||
// import jakarta.persistence.Id;
|
|
||||||
// import jakarta.persistence.NamedQuery;
|
|
||||||
// import jakarta.persistence.QueryHint;
|
|
||||||
// import jakarta.persistence.SequenceGenerator;
|
|
||||||
// import jakarta.persistence.Table;
|
|
||||||
|
|
||||||
|
|
||||||
// import io.fabric8.tekton.client.DefaultTektonClient;
|
|
||||||
// import io.fabric8.tekton.client.TektonClient;
|
|
||||||
// import io.fabric8.tekton.pipeline.v1beta1.TaskBuilder;
|
|
||||||
// import io.fabric8.tekton.pipeline.v1beta1.Task;
|
|
||||||
|
|
||||||
// public class callTekton {
|
|
||||||
|
|
||||||
// private static final String NAMESPACE = "default";
|
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
// try (TektonClient tkn = new DefaultTektonClient()) {
|
|
||||||
// // Load Task object from YAML
|
|
||||||
// Task task = tkn.v1beta1()
|
|
||||||
// .tasks()
|
|
||||||
// .load(callTekton.class.getResourceAsStream("../resources/baseScan.yml")).get();
|
|
||||||
|
|
||||||
// // Create Task object into Kubernetes
|
|
||||||
// tkn.v1beta1().tasks().inNamespace(NAMESPACE).createOrReplace(task);
|
|
||||||
|
|
||||||
// // Get Task object from APIServer
|
|
||||||
// String taskName = task.getMetadata().getName();
|
|
||||||
// task = tkn.v1beta1().tasks().inNamespace(NAMESPACE)
|
|
||||||
// .withName(taskName)
|
|
||||||
// .get();
|
|
||||||
|
|
||||||
// // Delete Task object
|
|
||||||
// tkn.v1beta1().tasks().inNamespace(NAMESPACE).withName(taskName).delete();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
Loading…
Reference in new issue