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