17119: tweaks for groups endpoints.
authorWard Vandewege <ward@curii.com>
Wed, 10 Feb 2021 21:19:40 +0000 (16:19 -0500)
committerWard Vandewege <ward@curii.com>
Thu, 11 Feb 2021 20:47:39 +0000 (15:47 -0500)
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

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

index b43e79c3ff56c761ac749be1ad134e6ffade7ef9..31faa04b81fe7d38061486c4bc2f840127aaace0 100644 (file)
@@ -418,11 +418,11 @@ func (conn *Conn) GroupList(ctx context.Context, options arvados.ListOptions) (a
        return conn.generated_GroupList(ctx, options)
 }
 
        return conn.generated_GroupList(ctx, options)
 }
 
-func (conn *Conn) GroupContents(ctx context.Context, options arvados.ContentsOptions) (arvados.GroupList, error) {
+func (conn *Conn) GroupContents(ctx context.Context, options arvados.ContentsOptions) (arvados.ObjectList, error) {
        return conn.chooseBackend(options.UUID).GroupContents(ctx, options)
 }
 
        return conn.chooseBackend(options.UUID).GroupContents(ctx, options)
 }
 
-func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.GroupList, error) {
+func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.ObjectList, error) {
        return conn.chooseBackend(options.UUID).GroupShared(ctx, options)
 }
 
        return conn.chooseBackend(options.UUID).GroupShared(ctx, options)
 }
 
index 977a15f3abbbff431cd800d0c87cb1b9ad310714..eae9e0a8cebc974dca813bba3dfa8f03381bbf2e 100644 (file)
@@ -170,6 +170,8 @@ var boolParams = map[string]bool{
        "redirect_to_new_user":    true,
        "send_notification_email": true,
        "bypass_federation":       true,
        "redirect_to_new_user":    true,
        "send_notification_email": true,
        "bypass_federation":       true,
+       "recursive":               true,
+       "exclude_home_project":    true,
 }
 
 func stringToBool(s string) bool {
 }
 
 func stringToBool(s string) bool {
index f5db9426b82f0ca63b1e9b1dfd49e5dc49534e0c..3f4a7e30b1cb61337b90cd103adcdc3f368e055f 100644 (file)
@@ -242,13 +242,6 @@ func (rtr *router) addRoutes() {
                                return rtr.backend.GroupUpdate(ctx, *opts.(*arvados.UpdateOptions))
                        },
                },
                                return rtr.backend.GroupUpdate(ctx, *opts.(*arvados.UpdateOptions))
                        },
                },
-               {
-                       arvados.EndpointGroupGet,
-                       func() interface{} { return &arvados.GetOptions{} },
-                       func(ctx context.Context, opts interface{}) (interface{}, error) {
-                               return rtr.backend.GroupGet(ctx, *opts.(*arvados.GetOptions))
-                       },
-               },
                {
                        arvados.EndpointGroupList,
                        func() interface{} { return &arvados.ListOptions{Limit: -1} },
                {
                        arvados.EndpointGroupList,
                        func() interface{} { return &arvados.ListOptions{Limit: -1} },
@@ -258,18 +251,32 @@ func (rtr *router) addRoutes() {
                },
                {
                        arvados.EndpointGroupContents,
                },
                {
                        arvados.EndpointGroupContents,
-                       func() interface{} { return &arvados.ListOptions{Limit: -1} },
+                       func() interface{} { return &arvados.ContentsOptions{Limit: -1} },
+                       func(ctx context.Context, opts interface{}) (interface{}, error) {
+                               return rtr.backend.GroupContents(ctx, *opts.(*arvados.ContentsOptions))
+                       },
+               },
+               {
+                       arvados.EndpointGroupContents2,
+                       func() interface{} { return &arvados.ContentsOptions{Limit: -1} },
                        func(ctx context.Context, opts interface{}) (interface{}, error) {
                                return rtr.backend.GroupContents(ctx, *opts.(*arvados.ContentsOptions))
                        },
                },
                {
                        arvados.EndpointGroupShared,
                        func(ctx context.Context, opts interface{}) (interface{}, error) {
                                return rtr.backend.GroupContents(ctx, *opts.(*arvados.ContentsOptions))
                        },
                },
                {
                        arvados.EndpointGroupShared,
-                       func() interface{} { return &arvados.ListOptions{Limit: -1} },
+                       func() interface{} { return &arvados.SharedOptions{Limit: -1} },
                        func(ctx context.Context, opts interface{}) (interface{}, error) {
                                return rtr.backend.GroupShared(ctx, *opts.(*arvados.SharedOptions))
                        },
                },
                        func(ctx context.Context, opts interface{}) (interface{}, error) {
                                return rtr.backend.GroupShared(ctx, *opts.(*arvados.SharedOptions))
                        },
                },
+               {
+                       arvados.EndpointGroupGet,
+                       func() interface{} { return &arvados.GetOptions{} },
+                       func(ctx context.Context, opts interface{}) (interface{}, error) {
+                               return rtr.backend.GroupGet(ctx, *opts.(*arvados.GetOptions))
+                       },
+               },
                {
                        arvados.EndpointGroupDelete,
                        func() interface{} { return &arvados.DeleteOptions{} },
                {
                        arvados.EndpointGroupDelete,
                        func() interface{} { return &arvados.DeleteOptions{} },
index 69bb06c0fd83116a5cc4285d0c448a6ed4b16e3f..36411adfa8f46e624782e4315427b835f5568016 100644 (file)
@@ -444,16 +444,16 @@ func (conn *Conn) GroupList(ctx context.Context, options arvados.ListOptions) (a
        return resp, err
 }
 
        return resp, err
 }
 
-func (conn *Conn) GroupContents(ctx context.Context, options arvados.ContentsOptions) (arvados.GroupList, error) {
+func (conn *Conn) GroupContents(ctx context.Context, options arvados.ContentsOptions) (arvados.ObjectList, error) {
        ep := arvados.EndpointGroupContents
        ep := arvados.EndpointGroupContents
-       var resp arvados.GroupList
+       var resp arvados.ObjectList
        err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
        return resp, err
 }
 
        err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
        return resp, err
 }
 
-func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.GroupList, error) {
+func (conn *Conn) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.ObjectList, error) {
        ep := arvados.EndpointGroupShared
        ep := arvados.EndpointGroupShared
-       var resp arvados.GroupList
+       var resp arvados.ObjectList
        err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
        return resp, err
 }
        err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
        return resp, err
 }
index 3331be58d5cd0f38e880a5435625e5cd85b26f4c..d17f8735b8b33e148b7ac94a177e0cca1a71f74e 100644 (file)
@@ -55,8 +55,9 @@ var (
        EndpointGroupUpdate                   = APIEndpoint{"PATCH", "arvados/v1/groups/{uuid}", "group"}
        EndpointGroupGet                      = APIEndpoint{"GET", "arvados/v1/groups/{uuid}", ""}
        EndpointGroupList                     = APIEndpoint{"GET", "arvados/v1/groups", ""}
        EndpointGroupUpdate                   = APIEndpoint{"PATCH", "arvados/v1/groups/{uuid}", "group"}
        EndpointGroupGet                      = APIEndpoint{"GET", "arvados/v1/groups/{uuid}", ""}
        EndpointGroupList                     = APIEndpoint{"GET", "arvados/v1/groups", ""}
-       EndpointGroupContents                 = APIEndpoint{"GET", "arvados/v1/groups/{uuid}/contents", ""}
-       EndpointGroupShared                   = APIEndpoint{"GET", "arvados/v1/groups/{uuid}/shared", ""}
+       EndpointGroupContents                 = APIEndpoint{"GET", "arvados/v1/groups/contents", ""}
+       EndpointGroupContents2                = APIEndpoint{"GET", "arvados/v1/groups/{uuid}/contents", ""}
+       EndpointGroupShared                   = APIEndpoint{"GET", "arvados/v1/groups/shared", ""}
        EndpointGroupDelete                   = APIEndpoint{"DELETE", "arvados/v1/groups/{uuid}", ""}
        EndpointGroupUntrash                  = APIEndpoint{"POST", "arvados/v1/groups/{uuid}/untrash", ""}
        EndpointUserActivate                  = APIEndpoint{"POST", "arvados/v1/users/{uuid}/activate", ""}
        EndpointGroupDelete                   = APIEndpoint{"DELETE", "arvados/v1/groups/{uuid}", ""}
        EndpointGroupUntrash                  = APIEndpoint{"POST", "arvados/v1/groups/{uuid}/untrash", ""}
        EndpointUserActivate                  = APIEndpoint{"POST", "arvados/v1/users/{uuid}/activate", ""}
@@ -149,6 +150,7 @@ type SharedOptions struct {
        Filters []Filter `json:"filters"`
        Limit   int64    `json:"limit"`
        Offset  int64    `json:"offset"`
        Filters []Filter `json:"filters"`
        Limit   int64    `json:"limit"`
        Offset  int64    `json:"offset"`
+       Count   string   `json:"count"`
        Order   []string `json:"order"`
        Include string   `json:"include"`
 }
        Order   []string `json:"order"`
        Include string   `json:"include"`
 }
@@ -236,8 +238,8 @@ type API interface {
        GroupUpdate(ctx context.Context, options UpdateOptions) (Group, error)
        GroupGet(ctx context.Context, options GetOptions) (Group, error)
        GroupList(ctx context.Context, options ListOptions) (GroupList, error)
        GroupUpdate(ctx context.Context, options UpdateOptions) (Group, error)
        GroupGet(ctx context.Context, options GetOptions) (Group, error)
        GroupList(ctx context.Context, options ListOptions) (GroupList, error)
-       GroupContents(ctx context.Context, options ContentsOptions) (GroupList, error)
-       GroupShared(ctx context.Context, options SharedOptions) (GroupList, error)
+       GroupContents(ctx context.Context, options ContentsOptions) (ObjectList, error)
+       GroupShared(ctx context.Context, options SharedOptions) (ObjectList, 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)
        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 26bd6e1874a6ac592c3bdfc5ef010cee199db1ac..53809881532b75370c38ac9dab78d3d8e9335b73 100644 (file)
@@ -36,6 +36,14 @@ type GroupList struct {
        Limit          int     `json:"limit"`
 }
 
        Limit          int     `json:"limit"`
 }
 
+// ObjectList is an arvados#objectList resource.
+type ObjectList struct {
+       Items          []interface{} `json:"items"`
+       ItemsAvailable int           `json:"items_available"`
+       Offset         int           `json:"offset"`
+       Limit          int           `json:"limit"`
+}
+
 func (g Group) resourceName() string {
        return "group"
 }
 func (g Group) resourceName() string {
        return "group"
 }
index fe8c324660107960314f9f73a9843ca68ec37d61..f4e725f7e4179c9f53a7f55e72a7a7a9e8d4163a 100644 (file)
@@ -145,18 +145,22 @@ func (as *APIStub) GroupList(ctx context.Context, options arvados.ListOptions) (
        as.appendCall(ctx, as.GroupList, options)
        return arvados.GroupList{}, as.Error
 }
        as.appendCall(ctx, as.GroupList, options)
        return arvados.GroupList{}, as.Error
 }
-func (as *APIStub) GroupContents(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
+func (as *APIStub) GroupContents(ctx context.Context, options arvados.ContentsOptions) (arvados.ObjectList, error) {
        as.appendCall(ctx, as.GroupContents, options)
        as.appendCall(ctx, as.GroupContents, options)
-       return nil, as.Error
+       return arvados.ObjectList{}, as.Error
 }
 }
-func (as *APIStub) GroupShared(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
+func (as *APIStub) GroupShared(ctx context.Context, options arvados.SharedOptions) (arvados.ObjectList, error) {
        as.appendCall(ctx, as.GroupShared, options)
        as.appendCall(ctx, as.GroupShared, options)
-       return nil, as.Error
+       return arvados.ObjectList{}, as.Error
 }
 func (as *APIStub) GroupDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) {
        as.appendCall(ctx, as.GroupDelete, options)
        return arvados.Group{}, as.Error
 }
 }
 func (as *APIStub) GroupDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) {
        as.appendCall(ctx, as.GroupDelete, options)
        return arvados.Group{}, as.Error
 }
+func (as *APIStub) GroupUntrash(ctx context.Context, options arvados.UntrashOptions) (arvados.Group, error) {
+       as.appendCall(ctx, as.GroupUntrash, options)
+       return arvados.Group{}, as.Error
+}
 func (as *APIStub) SpecimenCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Specimen, error) {
        as.appendCall(ctx, as.SpecimenCreate, options)
        return arvados.Specimen{}, as.Error
 func (as *APIStub) SpecimenCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Specimen, error) {
        as.appendCall(ctx, as.SpecimenCreate, options)
        return arvados.Specimen{}, as.Error