15922: Preserve etag in responses.
[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 import "time"
8
9 // Container is an arvados#container resource.
10 type Container struct {
11         UUID                 string                 `json:"uuid"`
12         Etag                 string                 `json:"etag"`
13         CreatedAt            time.Time              `json:"created_at"`
14         ModifiedByClientUUID string                 `json:"modified_by_client_uuid"`
15         ModifiedByUserUUID   string                 `json:"modified_by_user_uuid"`
16         ModifiedAt           time.Time              `json:"modified_at"`
17         Command              []string               `json:"command"`
18         ContainerImage       string                 `json:"container_image"`
19         Cwd                  string                 `json:"cwd"`
20         Environment          map[string]string      `json:"environment"`
21         LockedByUUID         string                 `json:"locked_by_uuid"`
22         Mounts               map[string]Mount       `json:"mounts"`
23         Output               string                 `json:"output"`
24         OutputPath           string                 `json:"output_path"`
25         Priority             int64                  `json:"priority"`
26         RuntimeConstraints   RuntimeConstraints     `json:"runtime_constraints"`
27         State                ContainerState         `json:"state"`
28         SchedulingParameters SchedulingParameters   `json:"scheduling_parameters"`
29         ExitCode             int                    `json:"exit_code"`
30         RuntimeStatus        map[string]interface{} `json:"runtime_status"`
31 }
32
33 // Container is an arvados#container resource.
34 type ContainerRequest struct {
35         UUID                    string                 `json:"uuid"`
36         OwnerUUID               string                 `json:"owner_uuid"`
37         CreatedAt               time.Time              `json:"created_at"`
38         ModifiedByClientUUID    string                 `json:"modified_by_client_uuid"`
39         ModifiedByUserUUID      string                 `json:"modified_by_user_uuid"`
40         ModifiedAt              time.Time              `json:"modified_at"`
41         Href                    string                 `json:"href"`
42         Kind                    string                 `json:"kind"`
43         Etag                    string                 `json:"etag"`
44         Name                    string                 `json:"name"`
45         Description             string                 `json:"description"`
46         Properties              map[string]interface{} `json:"properties"`
47         State                   ContainerRequestState  `json:"state"`
48         RequestingContainerUUID string                 `json:"requesting_container_uuid"`
49         ContainerUUID           string                 `json:"container_uuid"`
50         ContainerCountMax       int                    `json:"container_count_max"`
51         Mounts                  map[string]Mount       `json:"mounts"`
52         RuntimeConstraints      RuntimeConstraints     `json:"runtime_constraints"`
53         SchedulingParameters    SchedulingParameters   `json:"scheduling_parameters"`
54         ContainerImage          string                 `json:"container_image"`
55         Environment             map[string]string      `json:"environment"`
56         Cwd                     string                 `json:"cwd"`
57         Command                 []string               `json:"command"`
58         OutputPath              string                 `json:"output_path"`
59         OutputName              string                 `json:"output_name"`
60         OutputTTL               int                    `json:"output_ttl"`
61         Priority                int                    `json:"priority"`
62         UseExisting             bool                   `json:"use_existing"`
63         LogUUID                 string                 `json:"log_uuid"`
64         OutputUUID              string                 `json:"output_uuid"`
65         RuntimeToken            string                 `json:"runtime_token"`
66 }
67
68 // Mount is special behavior to attach to a filesystem path or device.
69 type Mount struct {
70         Kind              string      `json:"kind"`
71         Writable          bool        `json:"writable"`
72         PortableDataHash  string      `json:"portable_data_hash"`
73         UUID              string      `json:"uuid"`
74         DeviceType        string      `json:"device_type"`
75         Path              string      `json:"path"`
76         Content           interface{} `json:"content"`
77         ExcludeFromOutput bool        `json:"exclude_from_output"`
78         Capacity          int64       `json:"capacity"`
79         Commit            string      `json:"commit"`          // only if kind=="git_tree"
80         RepositoryName    string      `json:"repository_name"` // only if kind=="git_tree"
81         GitURL            string      `json:"git_url"`         // only if kind=="git_tree"
82 }
83
84 // RuntimeConstraints specify a container's compute resources (RAM,
85 // CPU) and network connectivity.
86 type RuntimeConstraints struct {
87         API          *bool
88         RAM          int64 `json:"ram"`
89         VCPUs        int   `json:"vcpus"`
90         KeepCacheRAM int64 `json:"keep_cache_ram"`
91 }
92
93 // SchedulingParameters specify a container's scheduling parameters
94 // such as Partitions
95 type SchedulingParameters struct {
96         Partitions  []string `json:"partitions"`
97         Preemptible bool     `json:"preemptible"`
98         MaxRunTime  int      `json:"max_run_time"`
99 }
100
101 // ContainerList is an arvados#containerList resource.
102 type ContainerList struct {
103         Items          []Container `json:"items"`
104         ItemsAvailable int         `json:"items_available"`
105         Offset         int         `json:"offset"`
106         Limit          int         `json:"limit"`
107 }
108
109 // ContainerState is a string corresponding to a valid Container state.
110 type ContainerState string
111
112 const (
113         ContainerStateQueued    = ContainerState("Queued")
114         ContainerStateLocked    = ContainerState("Locked")
115         ContainerStateRunning   = ContainerState("Running")
116         ContainerStateComplete  = ContainerState("Complete")
117         ContainerStateCancelled = ContainerState("Cancelled")
118 )
119
120 // ContainerState is a string corresponding to a valid Container state.
121 type ContainerRequestState string
122
123 const (
124         ContainerRequestStateUncomitted = ContainerState("Uncommitted")
125         ContainerRequestStateCommitted  = ContainerState("Committed")
126         ContainerRequestStateFinal      = ContainerState("Final")
127 )