Skip to content

Commit

Permalink
Merge branch 'master' into 314-update-to-micronaut-41
Browse files Browse the repository at this point in the history
  • Loading branch information
munishchouhan authored Oct 9, 2024
2 parents 8378276 + c6de5dc commit c90c410
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 4 deletions.
5 changes: 5 additions & 0 deletions typespec/models/ContainerRequest.tsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import "./ContainerConfig.tsp";
import "./Packages.tsp";
import "./ScanMode.tsp";
import "./ScanLevel.tsp";

@doc("Request payload for creating a container token.")
model ContainerRequest {
Expand All @@ -16,7 +18,10 @@ model ContainerRequest {
format: "sif" | "docker";
freeze?: boolean;
nameStrategy?: "none" | "tagPrefix" | "imageSuffix";
mirrorRegistry?: string;
packages?: Packages;
scanMode?: ScanMode;
scanLevels?: ScanLevel[];
timestamp: string;
towerAccessToken?: string;
towerEndpoint?: string;
Expand Down
10 changes: 8 additions & 2 deletions typespec/models/ContainerResponse.tsp
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import "./ContainerStatus.tsp";

@doc("Response payload for container token creation.")
model ContainerResponse {
buildId: string;
cached: boolean;
containerImage: string;
containerToken: string;
expiration: string;
freeze?: boolean;
freeze: boolean;
mirror: boolean;
requestId: string;
scanId: string;
status: ContainerStatus;
targetImage: string;
}
}
6 changes: 6 additions & 0 deletions typespec/models/ContainerStatus.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enum ContainerStatus {
PENDING,
BUILDING,
SCANNING,
DONE
}
21 changes: 21 additions & 0 deletions typespec/models/ContainerStatusResponse.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import "./ContainerStatus.tsp";

@doc("Response payload for container status.")
model ContainerStatusResponse {
id: string;
status: ContainerStatus;
buildId: string;
mirrorId: string;
scanId: string;
vulnerabilities: Record<vulnerability>;
succeeded: boolean;
reason: string;
detailsUri: string;
creationTime: string;
duration: string;
}

model vulnerability {
severity: string;
count: int32
}
6 changes: 6 additions & 0 deletions typespec/models/ScanLevel.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enum ScanLevel {
LOW,
MEDIUM,
HIGH,
CRITICAL
}
5 changes: 5 additions & 0 deletions typespec/models/ScanMode.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enum ScanMode{
none,
async,
required
}
1 change: 1 addition & 0 deletions typespec/models/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ import "./WaveBuildRecord.tsp";
import "./ValidateRegistryCredsRequest.tsp";
import "./WaveContainerRecord.tsp";
import "./ContainerMirrorResponse.tsp";
import "./ContainerStatusResponse.tsp";
12 changes: 10 additions & 2 deletions typespec/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ namespace wave {
@statusCode statusCode: 200;
};

@route("/{token}")
@get op getContainerDetails(@path token: string): {
@route("/container/{requestId}")
@get op getContainerDetails(@path requestId: string): {
@body response: WaveContainerRecord;
@statusCode statusCode: 200;
}|{
@statusCode statusCode: 404;
};

@route("/{requestId}/status")
@get op getContainerStatus(@path requestId: string): {
@body response: ContainerStatusResponse;
@statusCode statusCode: 200;
}|{
@statusCode statusCode: 404;
};
}

@route("/v1alpha1/builds/{buildId}")
Expand Down

0 comments on commit c90c410

Please sign in to comment.