17119: fix options and response type of the groups/shared and
authorWard Vandewege <ward@curii.com>
Thu, 11 Feb 2021 16:34:35 +0000 (11:34 -0500)
committerWard Vandewege <ward@curii.com>
Thu, 11 Feb 2021 22:20:07 +0000 (17:20 -0500)
       groups/content endpoints.

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

lib/controller/federation/conn.go
lib/controller/router/response.go
lib/controller/rpc/conn.go
sdk/go/arvados/api.go
sdk/go/arvados/group.go
sdk/go/arvados/user.go
sdk/go/arvadostest/api.go

index 31faa04b81fe7d38061486c4bc2f840127aaace0..63a05eb270b1611bc2c73208cea3aba0c87ed7a9 100644 (file)
@@ -422,7 +422,7 @@ 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.ObjectList, error) {
+func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.SharedGroupList, error) {
        return conn.chooseBackend(options.UUID).GroupShared(ctx, options)
 }
 
@@ -464,6 +464,7 @@ var userAttrsCachedFromLoginCluster = map[string]bool{
        "modified_at": true,
        "prefs":       true,
        "username":    true,
+       "kind":        true,
 
        "etag":                    false,
        "full_name":               false,
index d554ab930f30ce54b5405466c596a58843d237f2..656e731701a47d815a27b8537c78860ce2f08bf2 100644 (file)
@@ -71,7 +71,9 @@ func (rtr *router) sendResponse(w http.ResponseWriter, req *http.Request, resp i
        }
 
        respKind := kind(resp)
-       if respKind != "" {
+       if respKind == "arvados#sharedGroupList" {
+               tmp["kind"] = "arvados#groupList"
+       } else if respKind != "" {
                tmp["kind"] = respKind
        }
        defaultItemKind := ""
index 36411adfa8f46e624782e4315427b835f5568016..fc2ca3c5a140385cd103e106bc90be1f8d565fb4 100644 (file)
@@ -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.ObjectList, error) {
+func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.SharedGroupList, error) {
        ep := arvados.EndpointGroupShared
-       var resp arvados.ObjectList
+       var resp arvados.SharedGroupList
        err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
        return resp, err
 }
index d17f8735b8b33e148b7ac94a177e0cca1a71f74e..9aaa3205b7d0515960b90da8b09d7e64b197c778 100644 (file)
@@ -140,6 +140,7 @@ type ContentsOptions struct {
        Limit              int64    `json:"limit"`
        Offset             int64    `json:"offset"`
        Order              []string `json:"order"`
+       Include            string   `json:"include"`
        Recursive          bool     `json:"recursive"`
        ExcludeHomeProject bool     `json:"exclude_home_project"`
 }
@@ -239,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) (ObjectList, error)
+       GroupShared(ctx context.Context, options SharedOptions) (SharedGroupList, 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)
index 53809881532b75370c38ac9dab78d3d8e9335b73..b46b596f4f5fceaceb01a143ac8f5b3a1fcf45a1 100644 (file)
@@ -16,6 +16,7 @@ type Group struct {
        GroupClass           string                 `json:"group_class"`
        Etag                 string                 `json:"etag"`
        Href                 string                 `json:"href"`
+       Kind                 string                 `json:"kind"`
        TrashAt              *time.Time             `json:"trash_at"`
        CreatedAt            time.Time              `json:"created_at"`
        ModifiedAt           time.Time              `json:"modified_at"`
@@ -36,8 +37,17 @@ type GroupList struct {
        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"`
+}
+
 // ObjectList is an arvados#objectList resource.
 type ObjectList struct {
+       Included       []interface{} `json:"included"`
        Items          []interface{} `json:"items"`
        ItemsAvailable int           `json:"items_available"`
        Offset         int           `json:"offset"`
index 68960144a8a3dae092c604bfa4a256efcc8a669b..7693c8442be69feb40f7712c470d0c3e3791c27e 100644 (file)
@@ -16,6 +16,7 @@ type User struct {
        Email                string                 `json:"email"`
        FullName             string                 `json:"full_name"`
        FirstName            string                 `json:"first_name"`
+       Kind                 string                 `json:"kind"`
        LastName             string                 `json:"last_name"`
        IdentityURL          string                 `json:"identity_url"`
        IsInvited            bool                   `json:"is_invited"`
index f4e725f7e4179c9f53a7f55e72a7a7a9e8d4163a..781ede1d5d3a84aa0409488e67a74a82ce99f11b 100644 (file)
@@ -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.ObjectList, error) {
+func (as *APIStub) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.SharedGroupList, error) {
        as.appendCall(ctx, as.GroupShared, options)
-       return arvados.ObjectList{}, as.Error
+       return arvados.SharedGroupList{}, as.Error
 }
 func (as *APIStub) GroupDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) {
        as.appendCall(ctx, as.GroupDelete, options)