-
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.
Signed-off-by: Paolo Di Tommaso <[email protected]>
- Loading branch information
1 parent
aa20564
commit a61e34e
Showing
16 changed files
with
557 additions
and
22 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,6 +7,5 @@ pluginManagement { | |
|
||
|
||
rootProject.name = 'libseqera' | ||
include('lib-mail') | ||
include('wave-api') | ||
include('wave-utils') |
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.12.0 | ||
0.13.0-B1 |
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
30 changes: 30 additions & 0 deletions
30
wave-api/src/main/java/io/seqera/wave/api/ContainerStatus.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,30 @@ | ||
/* | ||
* Copyright 2023, Seqera Labs | ||
* | ||
* Licensed 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 io.seqera.wave.api; | ||
|
||
/** | ||
* Model a container provisioning request status | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
public enum ContainerStatus { | ||
PENDING, | ||
BUILDING, | ||
SCANNING, | ||
READY | ||
} |
171 changes: 171 additions & 0 deletions
171
wave-api/src/main/java/io/seqera/wave/api/ContainerStatusResponse.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,171 @@ | ||
/* | ||
* Copyright 2023, Seqera Labs | ||
* | ||
* Licensed 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 io.seqera.wave.api; | ||
|
||
import java.time.Duration; | ||
import java.time.Instant; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Model the response of container provisioning status request | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
public class ContainerStatusResponse { | ||
|
||
/** | ||
* Container request Id | ||
*/ | ||
final public String id; | ||
|
||
/** | ||
* Container request status | ||
*/ | ||
final public ContainerStatus status; | ||
|
||
/** | ||
* The build id associated with this request | ||
*/ | ||
final public String buildId; | ||
|
||
/** | ||
* The mirror id associated with this request | ||
*/ | ||
final public String mirrorId; | ||
|
||
/** | ||
* The security scan id associated with this request | ||
*/ | ||
final public String scanId; | ||
|
||
/** | ||
* Security vulnerability summary | ||
*/ | ||
final public Map<String,Integer> vulnerabilities; | ||
|
||
/** | ||
* Whenever the request is succeeded or not | ||
*/ | ||
final public Boolean succeeded; | ||
|
||
/** | ||
* Descriptive reason for returned status, used for failures | ||
*/ | ||
final public String reason; | ||
|
||
/** | ||
* Link to detail page | ||
*/ | ||
final public String detailsUri; | ||
|
||
/** | ||
* Container request time | ||
*/ | ||
final public Instant creationTime; | ||
|
||
/** | ||
* Duration to complete build | ||
*/ | ||
final public Duration duration; | ||
|
||
/* | ||
* required for serialization/deserialization | ||
*/ | ||
protected ContainerStatusResponse() { | ||
this.id = null; | ||
this.status = null; | ||
this.buildId = null; | ||
this.mirrorId = null; | ||
this.creationTime = null; | ||
this.duration = null; | ||
this.succeeded = null; | ||
this.scanId = null; | ||
this.vulnerabilities = null; | ||
this.reason = null; | ||
this.detailsUri = null; | ||
} | ||
|
||
public ContainerStatusResponse( | ||
String id, | ||
ContainerStatus status, | ||
String buildId, | ||
String mirrorId, | ||
String scanId, | ||
Map<String,Integer> vulnerabilities, | ||
Boolean succeeded, | ||
String reason, | ||
String detailsUri, | ||
Instant creationTime, | ||
Duration duration | ||
) | ||
{ | ||
this.id = id; | ||
this.status = status; | ||
this.buildId = buildId; | ||
this.mirrorId = mirrorId; | ||
this.scanId = scanId; | ||
this.vulnerabilities = vulnerabilities; | ||
this.succeeded = succeeded; | ||
this.reason = reason; | ||
this.detailsUri = detailsUri; | ||
this.creationTime = creationTime; | ||
this.duration = duration; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ContainerStatusResponse that = (ContainerStatusResponse) o; | ||
return Objects.equals(id, that.id) | ||
&& status == that.status | ||
&& Objects.equals(buildId, that.buildId) | ||
&& Objects.equals(mirrorId, that.mirrorId) | ||
&& Objects.equals(scanId, that.scanId) | ||
&& Objects.equals(creationTime, that.creationTime) | ||
&& Objects.equals(duration, that.duration) | ||
&& Objects.equals(succeeded, that.succeeded) | ||
&& Objects.equals(vulnerabilities, that.vulnerabilities) | ||
&& Objects.equals(reason, that.reason) | ||
&& Objects.equals(detailsUri, that.detailsUri) | ||
; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id, status, buildId, mirrorId, scanId, creationTime, duration, succeeded, vulnerabilities, reason, detailsUri); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ContainerStatusResponse{" + | ||
"id='" + id + '\'' + | ||
", status=" + status + | ||
", buildId='" + buildId + '\'' + | ||
", mirrorId='" + mirrorId + '\'' + | ||
", scanId='" + scanId + '\'' + | ||
", creationTime=" + creationTime + | ||
", duration=" + duration + | ||
", succeeded=" + succeeded + | ||
", vulnerabilities=" + vulnerabilities + | ||
", reason='" + reason + '\'' + | ||
", detailsUri='" + detailsUri + '\'' + | ||
'}'; | ||
} | ||
} |
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,30 @@ | ||
/* | ||
* Copyright 2023, Seqera Labs | ||
* | ||
* Licensed 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 io.seqera.wave.api; | ||
|
||
/** | ||
* Model a security scan vulnerability level | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
public enum ScanLevel { | ||
low, | ||
medium, | ||
high, | ||
critical | ||
} |
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 @@ | ||
/* | ||
* Wave, containers provisioning service | ||
* Copyright (c) 2023-2024, Seqera Labs | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.seqera.wave.api; | ||
|
||
/** | ||
* Define the possible container security scan modes | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
public enum ScanMode { | ||
none, | ||
async, | ||
sync, | ||
lazy, | ||
; | ||
|
||
public boolean asBoolean() { | ||
return this != none; | ||
} | ||
} |
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
Oops, something went wrong.