1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
15 "github.com/sirupsen/logrus"
18 type APIEndpoint struct {
21 // "new attributes" key for create/update requests
26 EndpointConfigGet = APIEndpoint{"GET", "arvados/v1/config", ""}
27 EndpointVocabularyGet = APIEndpoint{"GET", "arvados/v1/vocabulary", ""}
28 EndpointDiscoveryDocument = APIEndpoint{"GET", "discovery/v1/apis/arvados/v1/rest", ""}
29 EndpointLogin = APIEndpoint{"GET", "login", ""}
30 EndpointLogout = APIEndpoint{"GET", "logout", ""}
31 EndpointAuthorizedKeyCreate = APIEndpoint{"POST", "arvados/v1/authorized_keys", "authorized_key"}
32 EndpointAuthorizedKeyUpdate = APIEndpoint{"PATCH", "arvados/v1/authorized_keys/{uuid}", "authorized_key"}
33 EndpointAuthorizedKeyGet = APIEndpoint{"GET", "arvados/v1/authorized_keys/{uuid}", ""}
34 EndpointAuthorizedKeyList = APIEndpoint{"GET", "arvados/v1/authorized_keys", ""}
35 EndpointAuthorizedKeyDelete = APIEndpoint{"DELETE", "arvados/v1/authorized_keys/{uuid}", ""}
36 EndpointCollectionCreate = APIEndpoint{"POST", "arvados/v1/collections", "collection"}
37 EndpointCollectionUpdate = APIEndpoint{"PATCH", "arvados/v1/collections/{uuid}", "collection"}
38 EndpointCollectionGet = APIEndpoint{"GET", "arvados/v1/collections/{uuid}", ""}
39 EndpointCollectionList = APIEndpoint{"GET", "arvados/v1/collections", ""}
40 EndpointCollectionProvenance = APIEndpoint{"GET", "arvados/v1/collections/{uuid}/provenance", ""}
41 EndpointCollectionUsedBy = APIEndpoint{"GET", "arvados/v1/collections/{uuid}/used_by", ""}
42 EndpointCollectionDelete = APIEndpoint{"DELETE", "arvados/v1/collections/{uuid}", ""}
43 EndpointCollectionTrash = APIEndpoint{"POST", "arvados/v1/collections/{uuid}/trash", ""}
44 EndpointCollectionUntrash = APIEndpoint{"POST", "arvados/v1/collections/{uuid}/untrash", ""}
45 EndpointSpecimenCreate = APIEndpoint{"POST", "arvados/v1/specimens", "specimen"}
46 EndpointSpecimenUpdate = APIEndpoint{"PATCH", "arvados/v1/specimens/{uuid}", "specimen"}
47 EndpointSpecimenGet = APIEndpoint{"GET", "arvados/v1/specimens/{uuid}", ""}
48 EndpointSpecimenList = APIEndpoint{"GET", "arvados/v1/specimens", ""}
49 EndpointSpecimenDelete = APIEndpoint{"DELETE", "arvados/v1/specimens/{uuid}", ""}
50 EndpointContainerCreate = APIEndpoint{"POST", "arvados/v1/containers", "container"}
51 EndpointContainerUpdate = APIEndpoint{"PATCH", "arvados/v1/containers/{uuid}", "container"}
52 EndpointContainerPriorityUpdate = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/update_priority", "container"}
53 EndpointContainerGet = APIEndpoint{"GET", "arvados/v1/containers/{uuid}", ""}
54 EndpointContainerList = APIEndpoint{"GET", "arvados/v1/containers", ""}
55 EndpointContainerDelete = APIEndpoint{"DELETE", "arvados/v1/containers/{uuid}", ""}
56 EndpointContainerLock = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/lock", ""}
57 EndpointContainerUnlock = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/unlock", ""}
58 EndpointContainerSSH = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/ssh", ""}
59 EndpointContainerSSHCompat = APIEndpoint{"POST", "arvados/v1/connect/{uuid}/ssh", ""} // for compatibility with arvados <2.7
60 EndpointContainerGatewayTunnel = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/gateway_tunnel", ""}
61 EndpointContainerGatewayTunnelCompat = APIEndpoint{"POST", "arvados/v1/connect/{uuid}/gateway_tunnel", ""} // for compatibility with arvados <2.7
62 EndpointContainerRequestCreate = APIEndpoint{"POST", "arvados/v1/container_requests", "container_request"}
63 EndpointContainerRequestUpdate = APIEndpoint{"PATCH", "arvados/v1/container_requests/{uuid}", "container_request"}
64 EndpointContainerRequestGet = APIEndpoint{"GET", "arvados/v1/container_requests/{uuid}", ""}
65 EndpointContainerRequestList = APIEndpoint{"GET", "arvados/v1/container_requests", ""}
66 EndpointContainerRequestDelete = APIEndpoint{"DELETE", "arvados/v1/container_requests/{uuid}", ""}
67 EndpointContainerRequestContainerStatus = APIEndpoint{"GET", "arvados/v1/container_requests/{uuid}/container_status", ""}
68 EndpointContainerRequestLog = APIEndpoint{"GET", "arvados/v1/container_requests/{uuid}/log{path:|/.*}", ""}
69 EndpointGroupCreate = APIEndpoint{"POST", "arvados/v1/groups", "group"}
70 EndpointGroupUpdate = APIEndpoint{"PATCH", "arvados/v1/groups/{uuid}", "group"}
71 EndpointGroupGet = APIEndpoint{"GET", "arvados/v1/groups/{uuid}", ""}
72 EndpointGroupList = APIEndpoint{"GET", "arvados/v1/groups", ""}
73 EndpointGroupContents = APIEndpoint{"GET", "arvados/v1/groups/contents", ""}
74 EndpointGroupContentsUUIDInPath = APIEndpoint{"GET", "arvados/v1/groups/{uuid}/contents", ""} // Alternative HTTP route; client-side code should always use EndpointGroupContents instead
75 EndpointGroupShared = APIEndpoint{"GET", "arvados/v1/groups/shared", ""}
76 EndpointGroupDelete = APIEndpoint{"DELETE", "arvados/v1/groups/{uuid}", ""}
77 EndpointGroupTrash = APIEndpoint{"POST", "arvados/v1/groups/{uuid}/trash", ""}
78 EndpointGroupUntrash = APIEndpoint{"POST", "arvados/v1/groups/{uuid}/untrash", ""}
79 EndpointLinkCreate = APIEndpoint{"POST", "arvados/v1/links", "link"}
80 EndpointLinkUpdate = APIEndpoint{"PATCH", "arvados/v1/links/{uuid}", "link"}
81 EndpointLinkGet = APIEndpoint{"GET", "arvados/v1/links/{uuid}", ""}
82 EndpointLinkList = APIEndpoint{"GET", "arvados/v1/links", ""}
83 EndpointLinkDelete = APIEndpoint{"DELETE", "arvados/v1/links/{uuid}", ""}
84 EndpointLogCreate = APIEndpoint{"POST", "arvados/v1/logs", "log"}
85 EndpointLogUpdate = APIEndpoint{"PATCH", "arvados/v1/logs/{uuid}", "log"}
86 EndpointLogGet = APIEndpoint{"GET", "arvados/v1/logs/{uuid}", ""}
87 EndpointLogList = APIEndpoint{"GET", "arvados/v1/logs", ""}
88 EndpointLogDelete = APIEndpoint{"DELETE", "arvados/v1/logs/{uuid}", ""}
89 EndpointSysTrashSweep = APIEndpoint{"POST", "sys/trash_sweep", ""}
90 EndpointUserActivate = APIEndpoint{"POST", "arvados/v1/users/{uuid}/activate", ""}
91 EndpointUserCreate = APIEndpoint{"POST", "arvados/v1/users", "user"}
92 EndpointUserCurrent = APIEndpoint{"GET", "arvados/v1/users/current", ""}
93 EndpointUserDelete = APIEndpoint{"DELETE", "arvados/v1/users/{uuid}", ""}
94 EndpointUserGet = APIEndpoint{"GET", "arvados/v1/users/{uuid}", ""}
95 EndpointUserGetCurrent = APIEndpoint{"GET", "arvados/v1/users/current", ""}
96 EndpointUserGetSystem = APIEndpoint{"GET", "arvados/v1/users/system", ""}
97 EndpointUserList = APIEndpoint{"GET", "arvados/v1/users", ""}
98 EndpointUserMerge = APIEndpoint{"POST", "arvados/v1/users/merge", ""}
99 EndpointUserSetup = APIEndpoint{"POST", "arvados/v1/users/setup", "user"}
100 EndpointUserSystem = APIEndpoint{"GET", "arvados/v1/users/system", ""}
101 EndpointUserUnsetup = APIEndpoint{"POST", "arvados/v1/users/{uuid}/unsetup", ""}
102 EndpointUserUpdate = APIEndpoint{"PATCH", "arvados/v1/users/{uuid}", "user"}
103 EndpointUserBatchUpdate = APIEndpoint{"PATCH", "arvados/v1/users/batch_update", ""}
104 EndpointUserAuthenticate = APIEndpoint{"POST", "arvados/v1/users/authenticate", ""}
105 EndpointAPIClientAuthorizationCurrent = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/current", ""}
106 EndpointAPIClientAuthorizationCreate = APIEndpoint{"POST", "arvados/v1/api_client_authorizations", "api_client_authorization"}
107 EndpointAPIClientAuthorizationUpdate = APIEndpoint{"PUT", "arvados/v1/api_client_authorizations/{uuid}", "api_client_authorization"}
108 EndpointAPIClientAuthorizationList = APIEndpoint{"GET", "arvados/v1/api_client_authorizations", ""}
109 EndpointAPIClientAuthorizationDelete = APIEndpoint{"DELETE", "arvados/v1/api_client_authorizations/{uuid}", ""}
110 EndpointAPIClientAuthorizationGet = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/{uuid}", ""}
113 type ContainerSSHOptions struct {
114 UUID string `json:"uuid"`
115 DetachKeys string `json:"detach_keys"`
116 LoginUsername string `json:"login_username"`
117 NoForward bool `json:"no_forward"`
120 type ConnectionResponse struct {
121 Conn net.Conn `json:"-"`
122 Bufrw *bufio.ReadWriter `json:"-"`
123 Logger logrus.FieldLogger `json:"-"`
124 Header http.Header `json:"-"`
127 type ContainerGatewayTunnelOptions struct {
128 UUID string `json:"uuid"`
129 AuthSecret string `json:"auth_secret"`
132 type GetOptions struct {
133 UUID string `json:"uuid,omitempty"`
134 Select []string `json:"select"`
135 IncludeTrash bool `json:"include_trash"`
136 ForwardedFor string `json:"forwarded_for,omitempty"`
137 Remote string `json:"remote,omitempty"`
140 type UntrashOptions struct {
141 UUID string `json:"uuid"`
142 EnsureUniqueName bool `json:"ensure_unique_name"`
145 type ListOptions struct {
146 ClusterID string `json:"cluster_id"`
147 Select []string `json:"select"`
148 Filters []Filter `json:"filters"`
149 Where map[string]interface{} `json:"where"`
150 Limit int64 `json:"limit"`
151 Offset int64 `json:"offset"`
152 Order []string `json:"order"`
153 Distinct bool `json:"distinct"`
154 Count string `json:"count"`
155 IncludeTrash bool `json:"include_trash"`
156 IncludeOldVersions bool `json:"include_old_versions"`
157 BypassFederation bool `json:"bypass_federation"`
158 ForwardedFor string `json:"forwarded_for,omitempty"`
159 Include string `json:"include"`
162 type CreateOptions struct {
163 ClusterID string `json:"cluster_id"`
164 EnsureUniqueName bool `json:"ensure_unique_name"`
165 Select []string `json:"select"`
166 Attrs map[string]interface{} `json:"attrs"`
167 // ReplaceFiles only applies when creating a collection.
168 ReplaceFiles map[string]string `json:"replace_files"`
171 type UpdateOptions struct {
172 UUID string `json:"uuid"`
173 Attrs map[string]interface{} `json:"attrs"`
174 Select []string `json:"select"`
175 BypassFederation bool `json:"bypass_federation"`
176 // ReplaceFiles only applies when updating a collection.
177 ReplaceFiles map[string]string `json:"replace_files"`
180 type GroupContentsOptions struct {
181 ClusterID string `json:"cluster_id"`
182 UUID string `json:"uuid,omitempty"`
183 Select []string `json:"select"`
184 Filters []Filter `json:"filters"`
185 Limit int64 `json:"limit"`
186 Offset int64 `json:"offset"`
187 Order []string `json:"order"`
188 Distinct bool `json:"distinct"`
189 Count string `json:"count"`
190 Include string `json:"include"`
191 Recursive bool `json:"recursive"`
192 IncludeTrash bool `json:"include_trash"`
193 IncludeOldVersions bool `json:"include_old_versions"`
194 ExcludeHomeProject bool `json:"exclude_home_project"`
197 type UserActivateOptions struct {
198 UUID string `json:"uuid"`
201 type UserSetupOptions struct {
202 UUID string `json:"uuid,omitempty"`
203 Email string `json:"email,omitempty"`
204 OpenIDPrefix string `json:"openid_prefix,omitempty"`
205 RepoName string `json:"repo_name,omitempty"`
206 VMUUID string `json:"vm_uuid,omitempty"`
207 SendNotificationEmail bool `json:"send_notification_email,omitempty"`
208 Attrs map[string]interface{} `json:"attrs"`
211 type UserMergeOptions struct {
212 NewUserUUID string `json:"new_user_uuid,omitempty"`
213 OldUserUUID string `json:"old_user_uuid,omitempty"`
214 NewOwnerUUID string `json:"new_owner_uuid,omitempty"`
215 NewUserToken string `json:"new_user_token,omitempty"`
216 RedirectToNewUser bool `json:"redirect_to_new_user"`
219 type UserBatchUpdateOptions struct {
220 Updates map[string]map[string]interface{} `json:"updates"`
223 type UserBatchUpdateResponse struct{}
225 type DeleteOptions struct {
226 UUID string `json:"uuid"`
229 type LoginOptions struct {
230 ReturnTo string `json:"return_to"` // On success, redirect to this target with api_token=xxx query param
231 Remote string `json:"remote,omitempty"` // Salt token for remote Cluster ID
232 Code string `json:"code,omitempty"` // OAuth2 callback code
233 State string `json:"state,omitempty"` // OAuth2 callback state
236 type UserAuthenticateOptions struct {
237 Username string `json:"username,omitempty"` // PAM username
238 Password string `json:"password,omitempty"` // PAM password
241 type LogoutOptions struct {
242 ReturnTo string `json:"return_to"` // Redirect to this URL after logging out
245 type BlockReadOptions struct {
248 LocalLocator func(string)
251 type BlockWriteOptions struct {
254 Reader io.Reader // Must be set if Data is nil.
255 DataSize int // Must be set if Data is nil.
257 StorageClasses []string
262 type BlockWriteResponse struct {
265 StorageClasses map[string]int
268 type WebDAVOptions struct {
274 type ContainerLogOptions struct {
275 UUID string `json:"uuid"`
276 NoForward bool `json:"no_forward"`
281 ConfigGet(ctx context.Context) (json.RawMessage, error)
282 VocabularyGet(ctx context.Context) (Vocabulary, error)
283 Login(ctx context.Context, options LoginOptions) (LoginResponse, error)
284 Logout(ctx context.Context, options LogoutOptions) (LogoutResponse, error)
285 AuthorizedKeyCreate(ctx context.Context, options CreateOptions) (AuthorizedKey, error)
286 AuthorizedKeyUpdate(ctx context.Context, options UpdateOptions) (AuthorizedKey, error)
287 AuthorizedKeyGet(ctx context.Context, options GetOptions) (AuthorizedKey, error)
288 AuthorizedKeyList(ctx context.Context, options ListOptions) (AuthorizedKeyList, error)
289 AuthorizedKeyDelete(ctx context.Context, options DeleteOptions) (AuthorizedKey, error)
290 CollectionCreate(ctx context.Context, options CreateOptions) (Collection, error)
291 CollectionUpdate(ctx context.Context, options UpdateOptions) (Collection, error)
292 CollectionGet(ctx context.Context, options GetOptions) (Collection, error)
293 CollectionList(ctx context.Context, options ListOptions) (CollectionList, error)
294 CollectionProvenance(ctx context.Context, options GetOptions) (map[string]interface{}, error)
295 CollectionUsedBy(ctx context.Context, options GetOptions) (map[string]interface{}, error)
296 CollectionDelete(ctx context.Context, options DeleteOptions) (Collection, error)
297 CollectionTrash(ctx context.Context, options DeleteOptions) (Collection, error)
298 CollectionUntrash(ctx context.Context, options UntrashOptions) (Collection, error)
299 ContainerCreate(ctx context.Context, options CreateOptions) (Container, error)
300 ContainerUpdate(ctx context.Context, options UpdateOptions) (Container, error)
301 ContainerPriorityUpdate(ctx context.Context, options UpdateOptions) (Container, error)
302 ContainerGet(ctx context.Context, options GetOptions) (Container, error)
303 ContainerList(ctx context.Context, options ListOptions) (ContainerList, error)
304 ContainerDelete(ctx context.Context, options DeleteOptions) (Container, error)
305 ContainerLock(ctx context.Context, options GetOptions) (Container, error)
306 ContainerUnlock(ctx context.Context, options GetOptions) (Container, error)
307 ContainerSSH(ctx context.Context, options ContainerSSHOptions) (ConnectionResponse, error)
308 ContainerGatewayTunnel(ctx context.Context, options ContainerGatewayTunnelOptions) (ConnectionResponse, error)
309 ContainerRequestCreate(ctx context.Context, options CreateOptions) (ContainerRequest, error)
310 ContainerRequestUpdate(ctx context.Context, options UpdateOptions) (ContainerRequest, error)
311 ContainerRequestGet(ctx context.Context, options GetOptions) (ContainerRequest, error)
312 ContainerRequestList(ctx context.Context, options ListOptions) (ContainerRequestList, error)
313 ContainerRequestDelete(ctx context.Context, options DeleteOptions) (ContainerRequest, error)
314 ContainerRequestContainerStatus(ctx context.Context, options GetOptions) (ContainerStatus, error)
315 ContainerRequestLog(ctx context.Context, options ContainerLogOptions) (http.Handler, error)
316 GroupCreate(ctx context.Context, options CreateOptions) (Group, error)
317 GroupUpdate(ctx context.Context, options UpdateOptions) (Group, error)
318 GroupGet(ctx context.Context, options GetOptions) (Group, error)
319 GroupList(ctx context.Context, options ListOptions) (GroupList, error)
320 GroupContents(ctx context.Context, options GroupContentsOptions) (ObjectList, error)
321 GroupShared(ctx context.Context, options ListOptions) (GroupList, error)
322 GroupDelete(ctx context.Context, options DeleteOptions) (Group, error)
323 GroupTrash(ctx context.Context, options DeleteOptions) (Group, error)
324 GroupUntrash(ctx context.Context, options UntrashOptions) (Group, error)
325 LinkCreate(ctx context.Context, options CreateOptions) (Link, error)
326 LinkUpdate(ctx context.Context, options UpdateOptions) (Link, error)
327 LinkGet(ctx context.Context, options GetOptions) (Link, error)
328 LinkList(ctx context.Context, options ListOptions) (LinkList, error)
329 LinkDelete(ctx context.Context, options DeleteOptions) (Link, error)
330 LogCreate(ctx context.Context, options CreateOptions) (Log, error)
331 LogUpdate(ctx context.Context, options UpdateOptions) (Log, error)
332 LogGet(ctx context.Context, options GetOptions) (Log, error)
333 LogList(ctx context.Context, options ListOptions) (LogList, error)
334 LogDelete(ctx context.Context, options DeleteOptions) (Log, error)
335 SpecimenCreate(ctx context.Context, options CreateOptions) (Specimen, error)
336 SpecimenUpdate(ctx context.Context, options UpdateOptions) (Specimen, error)
337 SpecimenGet(ctx context.Context, options GetOptions) (Specimen, error)
338 SpecimenList(ctx context.Context, options ListOptions) (SpecimenList, error)
339 SpecimenDelete(ctx context.Context, options DeleteOptions) (Specimen, error)
340 SysTrashSweep(ctx context.Context, options struct{}) (struct{}, error)
341 UserCreate(ctx context.Context, options CreateOptions) (User, error)
342 UserUpdate(ctx context.Context, options UpdateOptions) (User, error)
343 UserMerge(ctx context.Context, options UserMergeOptions) (User, error)
344 UserActivate(ctx context.Context, options UserActivateOptions) (User, error)
345 UserSetup(ctx context.Context, options UserSetupOptions) (map[string]interface{}, error)
346 UserUnsetup(ctx context.Context, options GetOptions) (User, error)
347 UserGet(ctx context.Context, options GetOptions) (User, error)
348 UserGetCurrent(ctx context.Context, options GetOptions) (User, error)
349 UserGetSystem(ctx context.Context, options GetOptions) (User, error)
350 UserList(ctx context.Context, options ListOptions) (UserList, error)
351 UserDelete(ctx context.Context, options DeleteOptions) (User, error)
352 UserBatchUpdate(context.Context, UserBatchUpdateOptions) (UserList, error)
353 UserAuthenticate(ctx context.Context, options UserAuthenticateOptions) (APIClientAuthorization, error)
354 APIClientAuthorizationCurrent(ctx context.Context, options GetOptions) (APIClientAuthorization, error)
355 APIClientAuthorizationCreate(ctx context.Context, options CreateOptions) (APIClientAuthorization, error)
356 APIClientAuthorizationList(ctx context.Context, options ListOptions) (APIClientAuthorizationList, error)
357 APIClientAuthorizationDelete(ctx context.Context, options DeleteOptions) (APIClientAuthorization, error)
358 APIClientAuthorizationUpdate(ctx context.Context, options UpdateOptions) (APIClientAuthorization, error)
359 APIClientAuthorizationGet(ctx context.Context, options GetOptions) (APIClientAuthorization, error)
360 DiscoveryDocument(ctx context.Context) (DiscoveryDocument, error)