Merge branch '8784-dir-listings'
[arvados.git] / sdk / go / arvados / container.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 // Container is an arvados#container resource.
8 type Container struct {
9         UUID                 string               `json:"uuid"`
10         Command              []string             `json:"command"`
11         ContainerImage       string               `json:"container_image"`
12         Cwd                  string               `json:"cwd"`
13         Environment          map[string]string    `json:"environment"`
14         LockedByUUID         string               `json:"locked_by_uuid"`
15         Mounts               map[string]Mount     `json:"mounts"`
16         Output               string               `json:"output"`
17         OutputPath           string               `json:"output_path"`
18         Priority             int                  `json:"priority"`
19         RuntimeConstraints   RuntimeConstraints   `json:"runtime_constraints"`
20         State                ContainerState       `json:"state"`
21         SchedulingParameters SchedulingParameters `json:"scheduling_parameters"`
22 }
23
24 // Mount is special behavior to attach to a filesystem path or device.
25 type Mount struct {
26         Kind              string      `json:"kind"`
27         Writable          bool        `json:"writable"`
28         PortableDataHash  string      `json:"portable_data_hash"`
29         UUID              string      `json:"uuid"`
30         DeviceType        string      `json:"device_type"`
31         Path              string      `json:"path"`
32         Content           interface{} `json:"content"`
33         ExcludeFromOutput bool        `json:"exclude_from_output"`
34         Capacity          int64       `json:capacity`
35 }
36
37 // RuntimeConstraints specify a container's compute resources (RAM,
38 // CPU) and network connectivity.
39 type RuntimeConstraints struct {
40         API          *bool
41         RAM          int `json:"ram"`
42         VCPUs        int `json:"vcpus"`
43         KeepCacheRAM int `json:"keep_cache_ram"`
44 }
45
46 // SchedulingParameters specify a container's scheduling parameters
47 // such as Partitions
48 type SchedulingParameters struct {
49         Partitions []string `json:"partitions"`
50 }
51
52 // ContainerList is an arvados#containerList resource.
53 type ContainerList struct {
54         Items          []Container `json:"items"`
55         ItemsAvailable int         `json:"items_available"`
56         Offset         int         `json:"offset"`
57         Limit          int         `json:"limit"`
58 }
59
60 // ContainerState is a string corresponding to a valid Container state.
61 type ContainerState string
62
63 const (
64         ContainerStateQueued    = ContainerState("Queued")
65         ContainerStateLocked    = ContainerState("Locked")
66         ContainerStateRunning   = ContainerState("Running")
67         ContainerStateComplete  = ContainerState("Complete")
68         ContainerStateCancelled = ContainerState("Cancelled")
69 )