14287: Remove zero/missing values when req uses select or count=none.
[arvados.git] / sdk / go / arvados / api.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 type APIEndpoint struct {
8         Method string
9         Path   string
10         // "new attributes" key for create/update requests
11         AttrsKey string
12 }
13
14 var (
15         EndpointCollectionCreate              = APIEndpoint{"POST", "arvados/v1/collections", "collection"}
16         EndpointCollectionUpdate              = APIEndpoint{"PATCH", "arvados/v1/collections/:uuid", "collection"}
17         EndpointCollectionGet                 = APIEndpoint{"GET", "arvados/v1/collections/:uuid", ""}
18         EndpointCollectionList                = APIEndpoint{"GET", "arvados/v1/collections", ""}
19         EndpointCollectionDelete              = APIEndpoint{"DELETE", "arvados/v1/collections/:uuid", ""}
20         EndpointSpecimenCreate                = APIEndpoint{"POST", "arvados/v1/specimens", "specimen"}
21         EndpointSpecimenUpdate                = APIEndpoint{"PATCH", "arvados/v1/specimens/:uuid", "specimen"}
22         EndpointSpecimenGet                   = APIEndpoint{"GET", "arvados/v1/specimens/:uuid", ""}
23         EndpointSpecimenList                  = APIEndpoint{"GET", "arvados/v1/specimens", ""}
24         EndpointSpecimenDelete                = APIEndpoint{"DELETE", "arvados/v1/specimens/:uuid", ""}
25         EndpointContainerCreate               = APIEndpoint{"POST", "arvados/v1/containers", "container"}
26         EndpointContainerUpdate               = APIEndpoint{"PATCH", "arvados/v1/containers/:uuid", "container"}
27         EndpointContainerGet                  = APIEndpoint{"GET", "arvados/v1/containers/:uuid", ""}
28         EndpointContainerList                 = APIEndpoint{"GET", "arvados/v1/containers", ""}
29         EndpointContainerDelete               = APIEndpoint{"DELETE", "arvados/v1/containers/:uuid", ""}
30         EndpointContainerLock                 = APIEndpoint{"POST", "arvados/v1/containers/:uuid/lock", ""}
31         EndpointContainerUnlock               = APIEndpoint{"POST", "arvados/v1/containers/:uuid/unlock", ""}
32         EndpointAPIClientAuthorizationCurrent = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/current", ""}
33 )
34
35 type GetOptions struct {
36         UUID   string   `json:"uuid"`
37         Select []string `json:"select"`
38 }
39
40 type ListOptions struct {
41         Select  []string `json:"select"`
42         Filters []Filter `json:"filters"`
43         Limit   int      `json:"limit"`
44         Offset  int      `json:"offset"`
45         Order   string   `json:"order"`
46         Count   string   `json:"count"`
47 }
48
49 type CreateOptions struct {
50         ClusterID        string                 `json:"cluster_id"`
51         EnsureUniqueName bool                   `json:"ensure_unique_name"`
52         Select           []string               `json:"select"`
53         Attrs            map[string]interface{} `json:"attrs"`
54 }
55
56 type UpdateOptions struct {
57         UUID  string                 `json:"uuid"`
58         Attrs map[string]interface{} `json:"attrs"`
59 }
60
61 type DeleteOptions struct {
62         UUID string `json:"uuid"`
63 }