14715: keepproxy.service checks for cluster config
[arvados.git] / sdk / go / arvados / api.go
index 874e9e517e867ae1ad7a79b17c9eb9f877baf14f..772f8da9719ae874d3f392782fb6388d3e74a488 100644 (file)
@@ -4,6 +4,11 @@
 
 package arvados
 
+import (
+       "context"
+       "encoding/json"
+)
+
 type APIEndpoint struct {
        Method string
        Path   string
@@ -12,6 +17,7 @@ type APIEndpoint struct {
 }
 
 var (
+       EndpointConfigGet                     = APIEndpoint{"GET", "arvados/v1/config", ""}
        EndpointCollectionCreate              = APIEndpoint{"POST", "arvados/v1/collections", "collection"}
        EndpointCollectionUpdate              = APIEndpoint{"PATCH", "arvados/v1/collections/:uuid", "collection"}
        EndpointCollectionGet                 = APIEndpoint{"GET", "arvados/v1/collections/:uuid", ""}
@@ -19,6 +25,8 @@ var (
        EndpointCollectionProvenance          = APIEndpoint{"GET", "arvados/v1/collections/:uuid/provenance", ""}
        EndpointCollectionUsedBy              = APIEndpoint{"GET", "arvados/v1/collections/:uuid/used_by", ""}
        EndpointCollectionDelete              = APIEndpoint{"DELETE", "arvados/v1/collections/:uuid", ""}
+       EndpointCollectionTrash               = APIEndpoint{"POST", "arvados/v1/collections/:uuid/trash", ""}
+       EndpointCollectionUntrash             = APIEndpoint{"POST", "arvados/v1/collections/:uuid/untrash", ""}
        EndpointSpecimenCreate                = APIEndpoint{"POST", "arvados/v1/specimens", "specimen"}
        EndpointSpecimenUpdate                = APIEndpoint{"PATCH", "arvados/v1/specimens/:uuid", "specimen"}
        EndpointSpecimenGet                   = APIEndpoint{"GET", "arvados/v1/specimens/:uuid", ""}
@@ -35,18 +43,28 @@ var (
 )
 
 type GetOptions struct {
-       UUID   string   `json:"uuid"`
-       Select []string `json:"select"`
+       UUID         string   `json:"uuid"`
+       Select       []string `json:"select"`
+       IncludeTrash bool     `json:"include_trash"`
+}
+
+type UntrashOptions struct {
+       UUID             string `json:"uuid"`
+       EnsureUniqueName bool   `json:"ensure_unique_name"`
 }
 
 type ListOptions struct {
-       Select  []string               `json:"select"`
-       Filters []Filter               `json:"filters"`
-       Where   map[string]interface{} `json:"where"`
-       Limit   int                    `json:"limit"`
-       Offset  int                    `json:"offset"`
-       Order   string                 `json:"order"`
-       Count   string                 `json:"count"`
+       ClusterID          string                 `json:"cluster_id"`
+       Select             []string               `json:"select"`
+       Filters            []Filter               `json:"filters"`
+       Where              map[string]interface{} `json:"where"`
+       Limit              int                    `json:"limit"`
+       Offset             int                    `json:"offset"`
+       Order              []string               `json:"order"`
+       Distinct           bool                   `json:"distinct"`
+       Count              string                 `json:"count"`
+       IncludeTrash       bool                   `json:"include_trash"`
+       IncludeOldVersions bool                   `json:"include_old_versions"`
 }
 
 type CreateOptions struct {
@@ -64,3 +82,29 @@ type UpdateOptions struct {
 type DeleteOptions struct {
        UUID string `json:"uuid"`
 }
+
+type API interface {
+       ConfigGet(ctx context.Context) (json.RawMessage, error)
+       CollectionCreate(ctx context.Context, options CreateOptions) (Collection, error)
+       CollectionUpdate(ctx context.Context, options UpdateOptions) (Collection, error)
+       CollectionGet(ctx context.Context, options GetOptions) (Collection, error)
+       CollectionList(ctx context.Context, options ListOptions) (CollectionList, error)
+       CollectionProvenance(ctx context.Context, options GetOptions) (map[string]interface{}, error)
+       CollectionUsedBy(ctx context.Context, options GetOptions) (map[string]interface{}, error)
+       CollectionDelete(ctx context.Context, options DeleteOptions) (Collection, error)
+       CollectionTrash(ctx context.Context, options DeleteOptions) (Collection, error)
+       CollectionUntrash(ctx context.Context, options UntrashOptions) (Collection, error)
+       ContainerCreate(ctx context.Context, options CreateOptions) (Container, error)
+       ContainerUpdate(ctx context.Context, options UpdateOptions) (Container, error)
+       ContainerGet(ctx context.Context, options GetOptions) (Container, error)
+       ContainerList(ctx context.Context, options ListOptions) (ContainerList, error)
+       ContainerDelete(ctx context.Context, options DeleteOptions) (Container, error)
+       ContainerLock(ctx context.Context, options GetOptions) (Container, error)
+       ContainerUnlock(ctx context.Context, options GetOptions) (Container, error)
+       SpecimenCreate(ctx context.Context, options CreateOptions) (Specimen, error)
+       SpecimenUpdate(ctx context.Context, options UpdateOptions) (Specimen, error)
+       SpecimenGet(ctx context.Context, options GetOptions) (Specimen, error)
+       SpecimenList(ctx context.Context, options ListOptions) (SpecimenList, error)
+       SpecimenDelete(ctx context.Context, options DeleteOptions) (Specimen, error)
+       APIClientAuthorizationCurrent(ctx context.Context, options GetOptions) (APIClientAuthorization, error)
+}