16263: Generalize "local_user_list" flag to "no_federation"
[arvados.git] / sdk / go / arvados / api.go
index d86df9ef33272a89dae345dd8a14c12c78676397..a30da62425883988f52f71aa9b48d5495df54f72 100644 (file)
@@ -19,6 +19,7 @@ type APIEndpoint struct {
 var (
        EndpointConfigGet                     = APIEndpoint{"GET", "arvados/v1/config", ""}
        EndpointLogin                         = APIEndpoint{"GET", "login", ""}
+       EndpointLogout                        = APIEndpoint{"GET", "logout", ""}
        EndpointCollectionCreate              = APIEndpoint{"POST", "arvados/v1/collections", "collection"}
        EndpointCollectionUpdate              = APIEndpoint{"PATCH", "arvados/v1/collections/{uuid}", "collection"}
        EndpointCollectionGet                 = APIEndpoint{"GET", "arvados/v1/collections/{uuid}", ""}
@@ -49,18 +50,21 @@ var (
        EndpointUserGetSystem                 = APIEndpoint{"GET", "arvados/v1/users/system", ""}
        EndpointUserList                      = APIEndpoint{"GET", "arvados/v1/users", ""}
        EndpointUserMerge                     = APIEndpoint{"POST", "arvados/v1/users/merge", ""}
-       EndpointUserSetup                     = APIEndpoint{"POST", "arvados/v1/users/setup", ""}
+       EndpointUserSetup                     = APIEndpoint{"POST", "arvados/v1/users/setup", "user"}
        EndpointUserSystem                    = APIEndpoint{"GET", "arvados/v1/users/system", ""}
        EndpointUserUnsetup                   = APIEndpoint{"POST", "arvados/v1/users/{uuid}/unsetup", ""}
        EndpointUserUpdate                    = APIEndpoint{"PATCH", "arvados/v1/users/{uuid}", "user"}
        EndpointUserUpdateUUID                = APIEndpoint{"POST", "arvados/v1/users/{uuid}/update_uuid", ""}
+       EndpointUserBatchUpdate               = APIEndpoint{"PATCH", "arvados/v1/users/batch", ""}
        EndpointAPIClientAuthorizationCurrent = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/current", ""}
 )
 
 type GetOptions struct {
-       UUID         string   `json:"uuid"`
+       UUID         string   `json:"uuid,omitempty"`
        Select       []string `json:"select"`
        IncludeTrash bool     `json:"include_trash"`
+       ForwardedFor string   `json:"forwarded_for,omitempty"`
+       Remote       string   `json:"remote,omitempty"`
 }
 
 type UntrashOptions struct {
@@ -73,13 +77,14 @@ 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"`
+       Limit              int64                  `json:"limit"`
+       Offset             int64                  `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"`
+       NoFederation       bool                   `json:"no_federation"`
 }
 
 type CreateOptions struct {
@@ -104,21 +109,29 @@ type UserActivateOptions struct {
 }
 
 type UserSetupOptions struct {
-       UUID                  string                 `json:"uuid"`
-       Email                 string                 `json:"email"`
-       OpenIDPrefix          string                 `json:"openid_prefix"`
-       RepoName              string                 `json:"repo_name"`
-       VMUUID                string                 `json:"vm_uuid"`
-       SendNotificationEmail bool                   `json:"send_notification_email"`
+       UUID                  string                 `json:"uuid,omitempty"`
+       Email                 string                 `json:"email,omitempty"`
+       OpenIDPrefix          string                 `json:"openid_prefix,omitempty"`
+       RepoName              string                 `json:"repo_name,omitempty"`
+       VMUUID                string                 `json:"vm_uuid,omitempty"`
+       SendNotificationEmail bool                   `json:"send_notification_email,omitempty"`
        Attrs                 map[string]interface{} `json:"attrs"`
 }
 
 type UserMergeOptions struct {
-       NewUserUUID  string `json:"new_user_uuid,omitempty"`
-       OldUserUUID  string `json:"old_user_uuid,omitempty"`
-       NewUserToken string `json:"new_user_token,omitempty"`
+       NewUserUUID       string `json:"new_user_uuid,omitempty"`
+       OldUserUUID       string `json:"old_user_uuid,omitempty"`
+       NewOwnerUUID      string `json:"new_owner_uuid,omitempty"`
+       NewUserToken      string `json:"new_user_token,omitempty"`
+       RedirectToNewUser bool   `json:"redirect_to_new_user"`
 }
 
+type UserBatchUpdateOptions struct {
+       Updates map[string]map[string]interface{} `json:"updates"`
+}
+
+type UserBatchUpdateResponse struct{}
+
 type DeleteOptions struct {
        UUID string `json:"uuid"`
 }
@@ -130,9 +143,14 @@ type LoginOptions struct {
        State    string `json:"state,omitempty"`  // OAuth2 callback state
 }
 
+type LogoutOptions struct {
+       ReturnTo string `json:"return_to"` // Redirect to this URL after logging out
+}
+
 type API interface {
        ConfigGet(ctx context.Context) (json.RawMessage, error)
        Login(ctx context.Context, options LoginOptions) (LoginResponse, error)
+       Logout(ctx context.Context, options LogoutOptions) (LogoutResponse, 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)
@@ -166,5 +184,6 @@ type API interface {
        UserGetSystem(ctx context.Context, options GetOptions) (User, error)
        UserList(ctx context.Context, options ListOptions) (UserList, error)
        UserDelete(ctx context.Context, options DeleteOptions) (User, error)
+       UserBatchUpdate(context.Context, UserBatchUpdateOptions) (UserList, error)
        APIClientAuthorizationCurrent(ctx context.Context, options GetOptions) (APIClientAuthorization, error)
 }