X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/59a972c831bc8f7cd4e896ed8e1c71277b97f04e..77c8223f5ddd64cff2b08d0857749644c474946f:/sdk/go/arvados/api.go diff --git a/sdk/go/arvados/api.go b/sdk/go/arvados/api.go index e601083351..37a3e007b1 100644 --- a/sdk/go/arvados/api.go +++ b/sdk/go/arvados/api.go @@ -5,8 +5,12 @@ package arvados import ( + "bufio" "context" "encoding/json" + "net" + + "github.com/sirupsen/logrus" ) type APIEndpoint struct { @@ -41,6 +45,12 @@ var ( EndpointContainerDelete = APIEndpoint{"DELETE", "arvados/v1/containers/{uuid}", ""} EndpointContainerLock = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/lock", ""} EndpointContainerUnlock = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/unlock", ""} + EndpointContainerSSH = APIEndpoint{"GET", "arvados/v1/connect/{uuid}/ssh", ""} // move to /containers after #17014 fixes routing + EndpointContainerRequestCreate = APIEndpoint{"POST", "arvados/v1/container_requests", "container_request"} + EndpointContainerRequestUpdate = APIEndpoint{"PATCH", "arvados/v1/container_requests/{uuid}", "container_request"} + EndpointContainerRequestGet = APIEndpoint{"GET", "arvados/v1/container_requests/{uuid}", ""} + EndpointContainerRequestList = APIEndpoint{"GET", "arvados/v1/container_requests", ""} + EndpointContainerRequestDelete = APIEndpoint{"DELETE", "arvados/v1/container_requests/{uuid}", ""} EndpointUserActivate = APIEndpoint{"POST", "arvados/v1/users/{uuid}/activate", ""} EndpointUserCreate = APIEndpoint{"POST", "arvados/v1/users", "user"} EndpointUserCurrent = APIEndpoint{"GET", "arvados/v1/users/current", ""} @@ -55,10 +65,23 @@ var ( 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", ""} + EndpointUserBatchUpdate = APIEndpoint{"PATCH", "arvados/v1/users/batch_update", ""} + EndpointUserAuthenticate = APIEndpoint{"POST", "arvados/v1/users/authenticate", ""} EndpointAPIClientAuthorizationCurrent = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/current", ""} ) +type ContainerSSHOptions struct { + UUID string `json:"uuid"` + DetachKeys string `json:"detach_keys"` + LoginUsername string `json:"login_username"` +} + +type ContainerSSHConnection struct { + Conn net.Conn `json:"-"` + Bufrw *bufio.ReadWriter `json:"-"` + Logger logrus.FieldLogger `json:"-"` +} + type GetOptions struct { UUID string `json:"uuid,omitempty"` Select []string `json:"select"` @@ -85,6 +108,7 @@ type ListOptions struct { IncludeTrash bool `json:"include_trash"` IncludeOldVersions bool `json:"include_old_versions"` BypassFederation bool `json:"bypass_federation"` + ForwardedFor string `json:"forwarded_for,omitempty"` } type CreateOptions struct { @@ -144,6 +168,11 @@ type LoginOptions struct { State string `json:"state,omitempty"` // OAuth2 callback state } +type UserAuthenticateOptions struct { + Username string `json:"username,omitempty"` // PAM username + Password string `json:"password,omitempty"` // PAM password +} + type LogoutOptions struct { ReturnTo string `json:"return_to"` // Redirect to this URL after logging out } @@ -168,6 +197,12 @@ type API interface { ContainerDelete(ctx context.Context, options DeleteOptions) (Container, error) ContainerLock(ctx context.Context, options GetOptions) (Container, error) ContainerUnlock(ctx context.Context, options GetOptions) (Container, error) + ContainerSSH(ctx context.Context, options ContainerSSHOptions) (ContainerSSHConnection, error) + ContainerRequestCreate(ctx context.Context, options CreateOptions) (ContainerRequest, error) + ContainerRequestUpdate(ctx context.Context, options UpdateOptions) (ContainerRequest, error) + ContainerRequestGet(ctx context.Context, options GetOptions) (ContainerRequest, error) + ContainerRequestList(ctx context.Context, options ListOptions) (ContainerRequestList, error) + ContainerRequestDelete(ctx context.Context, options DeleteOptions) (ContainerRequest, 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) @@ -186,5 +221,6 @@ type API interface { UserList(ctx context.Context, options ListOptions) (UserList, error) UserDelete(ctx context.Context, options DeleteOptions) (User, error) UserBatchUpdate(context.Context, UserBatchUpdateOptions) (UserList, error) + UserAuthenticate(ctx context.Context, options UserAuthenticateOptions) (APIClientAuthorization, error) APIClientAuthorizationCurrent(ctx context.Context, options GetOptions) (APIClientAuthorization, error) }