From 6d7139a0e133bdbf780a358db198b14a2ded4b7c Mon Sep 17 00:00:00 2001 From: Ward Vandewege Date: Mon, 22 Feb 2021 15:32:28 -0500 Subject: [PATCH] 17119: merge SharedGroupList into GroupList, which now gets an 'Included' field (will be null unless used for shared groups). Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- lib/controller/federation/conn.go | 5 +++-- lib/controller/router/response.go | 8 +++++--- lib/controller/rpc/conn.go | 4 ++-- sdk/go/arvados/api.go | 2 +- sdk/go/arvados/group.go | 17 +++++------------ sdk/go/arvadostest/api.go | 4 ++-- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/lib/controller/federation/conn.go b/lib/controller/federation/conn.go index 63a05eb270..88648fbb19 100644 --- a/lib/controller/federation/conn.go +++ b/lib/controller/federation/conn.go @@ -422,8 +422,9 @@ func (conn *Conn) GroupContents(ctx context.Context, options arvados.ContentsOpt return conn.chooseBackend(options.UUID).GroupContents(ctx, options) } -func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.SharedGroupList, error) { - return conn.chooseBackend(options.UUID).GroupShared(ctx, options) +func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.GroupList, error) { + // FIXME is this right?? We don't have options.UUID to cue the chooseBackend off + return conn.chooseBackend(conn.cluster.ClusterID).GroupShared(ctx, options) } func (conn *Conn) GroupDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) { diff --git a/lib/controller/router/response.go b/lib/controller/router/response.go index 2a7bd9e674..309ed48f64 100644 --- a/lib/controller/router/response.go +++ b/lib/controller/router/response.go @@ -71,11 +71,13 @@ func (rtr *router) sendResponse(w http.ResponseWriter, req *http.Request, resp i } respKind := kind(resp) - if respKind == "arvados#sharedGroupList" { - tmp["kind"] = "arvados#groupList" - } else if respKind != "" { + if respKind != "" { tmp["kind"] = respKind } + if included, ok := tmp["included"]; ok && included == nil { + tmp["included"] = make([]interface{}, 0) + } + defaultItemKind := "" if strings.HasSuffix(respKind, "List") { defaultItemKind = strings.TrimSuffix(respKind, "List") diff --git a/lib/controller/rpc/conn.go b/lib/controller/rpc/conn.go index fc2ca3c5a1..e44a8e2d3d 100644 --- a/lib/controller/rpc/conn.go +++ b/lib/controller/rpc/conn.go @@ -451,9 +451,9 @@ func (conn *Conn) GroupContents(ctx context.Context, options arvados.ContentsOpt return resp, err } -func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.SharedGroupList, error) { +func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.GroupList, error) { ep := arvados.EndpointGroupShared - var resp arvados.SharedGroupList + var resp arvados.GroupList err := conn.requestAndDecode(ctx, &resp, ep, nil, options) return resp, err } diff --git a/sdk/go/arvados/api.go b/sdk/go/arvados/api.go index 9aaa3205b7..107d2b3926 100644 --- a/sdk/go/arvados/api.go +++ b/sdk/go/arvados/api.go @@ -240,7 +240,7 @@ type API interface { GroupGet(ctx context.Context, options GetOptions) (Group, error) GroupList(ctx context.Context, options ListOptions) (GroupList, error) GroupContents(ctx context.Context, options ContentsOptions) (ObjectList, error) - GroupShared(ctx context.Context, options SharedOptions) (SharedGroupList, error) + GroupShared(ctx context.Context, options SharedOptions) (GroupList, error) GroupDelete(ctx context.Context, options DeleteOptions) (Group, error) GroupUntrash(ctx context.Context, options UntrashOptions) (Group, error) SpecimenCreate(ctx context.Context, options CreateOptions) (Specimen, error) diff --git a/sdk/go/arvados/group.go b/sdk/go/arvados/group.go index b46b596f4f..07632059e1 100644 --- a/sdk/go/arvados/group.go +++ b/sdk/go/arvados/group.go @@ -31,18 +31,11 @@ type Group struct { // GroupList is an arvados#groupList resource. type GroupList struct { - Items []Group `json:"items"` - ItemsAvailable int `json:"items_available"` - Offset int `json:"offset"` - Limit int `json:"limit"` -} - -// SharedGroupList is an arvados#groupList resource. -type SharedGroupList struct { - Included []interface{} `json:"included"` - Items []Group `json:"items"` - Offset int `json:"offset"` - Limit int `json:"limit"` + Items []Group `json:"items"` + ItemsAvailable int `json:"items_available"` + Offset int `json:"offset"` + Limit int `json:"limit"` + Included []interface{} `json:"included"` } // ObjectList is an arvados#objectList resource. diff --git a/sdk/go/arvadostest/api.go b/sdk/go/arvadostest/api.go index 781ede1d5d..c90933bc1e 100644 --- a/sdk/go/arvadostest/api.go +++ b/sdk/go/arvadostest/api.go @@ -149,9 +149,9 @@ func (as *APIStub) GroupContents(ctx context.Context, options arvados.ContentsOp as.appendCall(ctx, as.GroupContents, options) return arvados.ObjectList{}, as.Error } -func (as *APIStub) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.SharedGroupList, error) { +func (as *APIStub) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.GroupList, error) { as.appendCall(ctx, as.GroupShared, options) - return arvados.SharedGroupList{}, as.Error + return arvados.GroupList{}, as.Error } func (as *APIStub) GroupDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) { as.appendCall(ctx, as.GroupDelete, options) -- 2.30.2