Skip to content

Commit b20802d

Browse files
committed
added examples
Signed-off-by: munishchouhan <[email protected]>
1 parent a447d8f commit b20802d

20 files changed

+228
-23
lines changed

typespec/models/BuildStatusResponse.tsp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import "./Status.tsp";
22

33
@doc("Response payload for build status.")
4+
@example(#{
5+
id:"6c084f2e43f86a78_1",
6+
status:Status.COMPLETED,
7+
startTime:"2024-04-09T20:31:35.355423Z",
8+
duration: "123.914989000",
9+
succeeded: true
10+
}
11+
)
412
model BuildStatusResponse {
513
duration: string;
614
id: string;

typespec/models/CondaOpts.tsp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
@doc("Options for Conda environments.")
2+
@example(#{
3+
basePackages: "python=3.8",
4+
commands: #["pip install bwa", "pip install salmon"],
5+
mambaImage: "mambaorg/micromamba:0.15.3"
6+
})
27
model CondaOpts {
38
basePackages: string;
49
commands: string[];
510
mambaImage: string;
6-
}
11+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import "./CondaOpts.tsp";
22

33
@doc("Package configurations for container builds.")
4-
model Packages {
4+
model CondaPackages {
55
channels: string[];
66
condaOpts?: CondaOpts;
77
entries: string[];
8-
environment: string;
8+
environment?: string;
99
type: "CONDA";
1010
}

typespec/models/ContainerConfig.tsp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
import "./ContainerLayer.tsp";
22

33
@doc("Configuration details for a container.")
4+
@example(#{
5+
cmd: #["echo", "hello"],
6+
entrypoint: #["/bin/sh"],
7+
env: #["FOO=bar"],
8+
layers: #[
9+
#{
10+
gzipDigest: "sha256:1234567890abcdef",
11+
gzipSize: "1234",
12+
location: "https://seqera.io/layer.tar.gz",
13+
skipHashing: false,
14+
tarDigest: "sha256:abcdef1234567890"
15+
}
16+
],
17+
workingDir: "/app"
18+
})
419
model ContainerConfig {
520
cmd: string[];
621
entrypoint: string[];

typespec/models/ContainerInspectConfig.tsp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
import "./RootFS.tsp";
22

33
@doc("Configuration details of a container.")
4-
model Config {
4+
@example(#{
5+
architecture: "linux/amd64",
6+
config: #{
7+
attachStdin: false,
8+
attachStdout: true,
9+
attachStderr: true,
10+
tty: false,
11+
env: #["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],
12+
cmd: #["sh"],
13+
image: "alpine:latest"
14+
},
15+
container: "docker.io/alpine:latest",
16+
created: "2021-06-10T15:00:00.000000000Z",
17+
rootfs: #{
18+
diff_ids: #["sha256:1234567890abcdef"],
19+
type: "layers"
20+
}
21+
})
22+
model ContainerInspectConfig {
523
architecture: string;
624
config: {
725
attachStdin: boolean;
@@ -15,4 +33,4 @@ model Config {
1533
container: string;
1634
created: string;
1735
rootfs: RootFS;
18-
}
36+
}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
@doc("Request payload for inspecting a container.")
2+
@example(#{
3+
containerImage: "docker.io/alpine:latest",
4+
towerAccessToken: "1234567890abcdef",
5+
towerEndpoint: "https://api.cloud.seqera.io",
6+
towerWorkspaceId: 1234567890
7+
})
28
model ContainerInspectRequest {
39
containerImage: string;
410
towerAccessToken: string;
511
towerEndpoint: string;
612
towerWorkspaceId: int64;
7-
}
13+
}

typespec/models/ContainerInspectResponse.tsp

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,60 @@ import "./ContainerInspectConfig.tsp";
22
import "./Manifest.tsp";
33

44
@doc("Response payload for inspecting a container.")
5+
@example(#{
6+
Container: #{
7+
registry: "docker.io",
8+
hostName: "docker.io",
9+
imageName: "alpine",
10+
reference: "latest",
11+
digest: "sha256:1234567890abcdef",
12+
config: #{
13+
architecture: "linux/amd64",
14+
config: #{
15+
attachStdin: false,
16+
attachStdout: true,
17+
attachStderr: true,
18+
tty: false,
19+
env: #["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],
20+
cmd: #["sh"],
21+
image: "alpine:latest"
22+
},
23+
container: "docker.io/alpine:latest",
24+
created: "2021-06-10T15:00:00.000000000Z",
25+
rootfs: #{
26+
diff_ids: #["sha256:1234567890abcdef"],
27+
type: "layers"
28+
}
29+
},
30+
manifest: #{
31+
schemaVersion: 2,
32+
mediaType: "application/vnd.docker.distribution.manifest.v2+json",
33+
config: #{
34+
mediaType: "application/vnd.docker.container.image.v1+json",
35+
size: 123456,
36+
digest: "sha256:1234567890abcdef"
37+
},
38+
layers: #[
39+
#{
40+
mediaType: "application/vnd.docker.image.rootfs.diff.tar.gzip",
41+
size: 123456,
42+
digest: "sha256:1234567890abcdef"
43+
}
44+
]
45+
},
46+
v1: false,
47+
v2: true,
48+
oci: false
49+
}
50+
})
551
model ContainerInspectResponse {
652
Container: {
753
registry: string;
854
hostName: string;
955
imageName: string;
1056
reference: string;
1157
digest: string;
12-
config: Config;
58+
config: ContainerInspectConfig;
1359
manifest: Manifest;
1460
v1: boolean;
1561
v2: boolean;

typespec/models/ContainerLayer.tsp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
@doc("Represents a layer in a container image.")
2+
@example(#{
3+
gzipDigest: "sha256:1234567890abcdef",
4+
gzipSize: "123456",
5+
location: "https://example.com/image.tar.gz",
6+
skipHashing: false,
7+
tarDigest: "sha256:abcdef1234567890"
8+
})
29
model ContainerLayer {
310
gzipDigest: string;
411
gzipSize: string;

typespec/models/ContainerMirrorResponse.tsp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@ import "./ContainerPlatform.tsp";
22
import "./Status.tsp";
33

44
@doc("Response payload for container mirroring.")
5+
@example(#{
6+
mirrorId: "6c084f2e43f86a78_1",
7+
digest: "sha256:1234567890abcdef",
8+
sourceImage: "docker.io/alpine:latest",
9+
targetImage: "docker.io/alpine:latest",
10+
platform: #{
11+
os: "LINUX",
12+
arch: "AMD64",
13+
variant: "v1"
14+
},
15+
creationTime: "2024-04-09T20:31:35.355423Z",
16+
status: Status.COMPLETED,
17+
duration: "123.914989000",
18+
exitCode: 0,
19+
logs: "Successfully mirrored image."
20+
})
521
model ContainerMirrorResponse {
622
mirrorId: string;
723
digest: string;

typespec/models/ContainerPlatform.tsp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
@doc("Represents os platform of a container.")
2+
@example(#{
3+
os: "linux",
4+
arch: "amd64",
5+
variant: "v1"
6+
})
27
model ContainerPlatform {
38
os: string;
49
arch: string;

typespec/models/ContainerRequest.tsp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
11
import "./ContainerConfig.tsp";
2-
import "./Packages.tsp";
2+
import "./CondaPackages.tsp";
33
import "./ScanMode.tsp";
44
import "./ScanLevel.tsp";
55

66
@doc("Request payload for creating a container token.")
7+
@example(#{
8+
packages:#{
9+
type: "CONDA",
10+
entries: #["salmon", "bwa"],
11+
channels: #["conda-forge", "bioconda"]
12+
},
13+
format: "docker",
14+
containerPlatform:"linux/amd64"
15+
})
716
model ContainerRequest {
8-
buildContext: ContainerLayer;
17+
buildContext?: ContainerLayer;
918
buildRepository?: string;
1019
cacheRepository?: string;
11-
containerConfig: ContainerConfig;
20+
containerConfig?: ContainerConfig;
1221
containerFile?: string;
13-
containerImage: string;
14-
containerIncludes: string[];
22+
containerImage?: string;
23+
containerIncludes?: string[];
1524
containerPlatform: string;
16-
dryRun: boolean;
25+
dryRun?: boolean;
1726
fingerprint?: string;
1827
format: "sif" | "docker";
1928
freeze?: boolean;
2029
nameStrategy?: "none" | "tagPrefix" | "imageSuffix";
2130
mirror?: boolean;
22-
packages?: Packages;
31+
packages?: CondaPackages;
2332
scanMode?: ScanMode;
2433
scanLevels?: ScanLevel[];
25-
timestamp: string;
34+
timestamp?: string;
2635
towerAccessToken?: string;
2736
towerEndpoint?: string;
2837
towerRefreshToken?: string;
2938
towerWorkspaceId?: int32;
30-
workflowId: string;
39+
workflowId?: string;
3140
}

typespec/models/ContainerResponse.tsp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
import "./ContainerStatus.tsp";
22

33
@doc("Response payload for container token creation.")
4+
@example(#{
5+
containerToken:"732b73aa17c8",
6+
targetImage:"wave.seqera.io/wt/732b73aa17c8/build/dev:salmon_bwa--5e49881e6ad74121",
7+
expiration:"2024-04-09T21:19:01.715321Z",
8+
buildId:"5e49881e6ad74121_1",
9+
cached:false,
10+
freeze:false,
11+
mirror:false,
12+
requestId:"5e49881e6ad74121",
13+
scanId:"5e49881e6ad74121",
14+
containerImage:"docker.io/build/dev:salmon_bwa--5e49881e6ad74121",
15+
status:ContainerStatus.PENDING
16+
})
417
model ContainerResponse {
518
buildId: string;
619
cached: boolean;

typespec/models/ContainerStatusResponse.tsp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
import "./ContainerStatus.tsp";
22

33
@doc("Response payload for container status.")
4+
@example(#{
5+
id:"6c084f2e43f86a78",
6+
buildId:"6c084f2e43f86a78_1",
7+
status:ContainerStatus.DONE,
8+
creationTime:"2024-04-09T20:31:35.355423Z",
9+
detailsUri:"https://wave.seqera.io/view/builds/6c084f2e43f86a78_1",
10+
duration:"123.914989000",
11+
succeeded:true,
12+
scanId:"6c084f2e43f86a78_1",
13+
})
414
model ContainerStatusResponse {
515
id: string;
616
status: ContainerStatus;
717
buildId: string;
8-
mirrorId: string;
18+
mirrorId?: string;
919
scanId: string;
10-
vulnerabilities: Record<vulnerability>;
20+
vulnerabilities?: Record<vulnerability>;
1121
succeeded: boolean;
12-
reason: string;
22+
reason?: string;
1323
detailsUri: string;
1424
creationTime: string;
1525
duration: string;

typespec/models/Manifest.tsp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
import "./ManifestLayer.tsp";
22

33
@doc("Manifest details of a container.")
4+
@example(#{
5+
config: #{
6+
digest: "sha256:6c084f2e43f86a78",
7+
mediaType: "application/vnd.docker.container.image.v1+json",
8+
size: 1234
9+
},
10+
layers: #[
11+
#{
12+
digest: "sha256:6c084f2e43f86a78",
13+
mediaType: "application/vnd.docker.container.image.v1+json",
14+
size: 1234
15+
}
16+
],
17+
mediaType: "application/vnd.docker.container.image.v1+json",
18+
schemaVersion: 2
19+
})
420
model Manifest {
521
config: {
622
digest: string;
@@ -10,4 +26,4 @@ model Manifest {
1026
layers: ManifestLayer[];
1127
mediaType: string;
1228
schemaVersion: int32;
13-
}
29+
}

typespec/models/ManifestLayer.tsp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
@doc("Manifest layer details of a container.")
2+
@example(#{
3+
digest: "sha256:6c084f2e43f86a78",
4+
mediaType: "application/vnd.docker.container.image.v1+json",
5+
size: 1234
6+
})
27
model ManifestLayer {
38
digest: string;
49
mediaType: string;
510
size: int64;
6-
}
11+
}

typespec/models/RootFS.tsp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
@doc("Details about the root filesystem of a container.")
2+
@example(#{
3+
diff_ids: #[
4+
"sha256:6c084f2e43f86a78",
5+
"sha256:6c084f2e43f86a78"
6+
],
7+
type: "layers"
8+
})
29
model RootFS {
310
diff_ids: string[];
411
type: string;

typespec/models/User.tsp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
@doc("Wave USer details")
2+
@example(#{
3+
id: 1,
4+
userName: "test",
5+
6+
})
27
model User {
38
id: int64;
49
userName: string;

typespec/models/ValidateRegistryCredsRequest.tsp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
@doc("request payload of validate credentials request")
2+
@example(#{
3+
password: "password",
4+
registry: "docker.io/wave",
5+
userName: "username"
6+
})
27
model ValidateRegistryCredsRequest {
38
password: string;
49
registry: string;
510
userName: string;
611
}
7-

0 commit comments

Comments
 (0)