Documentation ¶
Overview ¶
Package arvados is a client library for Arvados.
The API is not stable: it should be considered experimental pre-release.
The intent is to offer model types and API call functions that can be generated automatically (or at least mostly automatically) from a discovery document. For the time being, there is a manually generated subset of those types and API calls with (approximately) the right signatures, plus client/authentication support and some convenience functions.
Index ¶
- Constants
- Variables
- func CollectionIDFromDNSName(s string) string
- func ContextWithAuthorization(ctx context.Context, value string) context.Context
- func ContextWithRequestID(ctx context.Context, reqid string) context.Context
- func FS(fs FileSystem) fs.FS
- func PortableDataHash(mt string) string
- func RandomUUID(clusterID, infix string) string
- func SignLocator(blobLocator, apiToken string, expiry time.Time, blobSignatureTTL time.Duration, ...) string
- func SignManifest(manifest string, apiToken string, expiry time.Time, ttl time.Duration, ...) string
- func Splice(fs FileSystem, target string, newsubtree *Subtree) error
- func VerifySignature(signedLocator, apiToken string, blobSignatureTTL time.Duration, ...) error
- type API
- type APIClientAuthorization
- type APIClientAuthorizationList
- type APIEndpoint
- type AuthorizedKey
- type AuthorizedKeyList
- type AzureVolumeDriverParameters
- type BlockReadOptions
- type BlockSegment
- type BlockWriteOptions
- type BlockWriteResponse
- type ByteSize
- type ByteSizeOrPercent
- type CUDAFeatures
- type CUDARuntimeConstraints
- type Client
- func (c *Client) CurrentUser() (User, error)
- func (c *Client) CustomFileSystem(kc keepClient) CustomFileSystem
- func (c *Client) DiscoveryDocument() (*DiscoveryDocument, error)
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) DoAndDecode(dst interface{}, req *http.Request) error
- func (c *Client) EachKeepService(f func(KeepService) error) error
- func (c *Client) KindForUUID(uuid string) (string, error)
- func (c *Client) Last503() time.Time
- func (c *Client) PathForUUID(method, uuid string) (string, error)
- func (c *Client) RequestAndDecode(dst interface{}, method, path string, body io.Reader, params interface{}) error
- func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, method, path string, body io.Reader, ...) error
- func (c *Client) SiteFileSystem(kc keepClient) CustomFileSystem
- func (c *Client) UpdateBody(rsc resource) io.Reader
- func (c *Client) WithRequestID(reqid string) *Client
- type CloudVMsConfig
- type Cluster
- type Collection
- type CollectionFileSystem
- type CollectionList
- type ComputedPermission
- type ComputedPermissionList
- type Config
- type ConnectionResponse
- type Container
- type ContainerGatewayTunnelOptions
- type ContainerList
- type ContainerLogOptions
- type ContainerRequest
- type ContainerRequestList
- type ContainerRequestState
- type ContainerSSHOptions
- type ContainerState
- type ContainerStatus
- type ContainersConfig
- type CreateOptions
- type CustomFileSystem
- type DeleteOptions
- type DirectoryVolumeDriverParameters
- type DiscoveryDocument
- type DiskCache
- type Duration
- type File
- type FileSystem
- type Filter
- type GetOptions
- type Group
- type GroupContentsOptions
- type GroupList
- type InstanceType
- type InstanceTypeMap
- type KeepGateway
- type KeepMount
- type KeepService
- func (s *KeepService) Index(ctx context.Context, c *Client, prefix string) ([]KeepServiceIndexEntry, error)
- func (s *KeepService) IndexMount(ctx context.Context, c *Client, mountUUID string, prefix string) ([]KeepServiceIndexEntry, error)
- func (s *KeepService) Mounts(c *Client) ([]KeepMount, error)
- func (s *KeepService) String() string
- func (s *KeepService) Touch(ctx context.Context, c *Client, blk string) error
- func (s *KeepService) Untrash(ctx context.Context, c *Client, blk string) error
- type KeepServiceIndexEntry
- type KeepServiceList
- type Link
- type LinkList
- type ListOptions
- type Log
- type LogList
- type LoginOptions
- type LoginResponse
- type LogoutOptions
- type LogoutResponse
- type ManagedProperties
- type MethodResponse
- type Mount
- type Node
- type NodeList
- type NodeProperties
- type NodePropertiesCloudNode
- type ObjectList
- type PostgreSQL
- type PostgreSQLConnection
- type RemoteCluster
- type Resource
- type ResourceListParams
- type ResourceMethod
- type RuntimeConstraints
- type S3VolumeDriverParameters
- type SchedulingParameters
- type Schema
- type Service
- type ServiceInstance
- type ServiceName
- type Services
- type SizedDigest
- type StorageClassConfig
- type StringSet
- type StubClient
- func (*StubClient) BlockWrite(context.Context, BlockWriteOptions) (BlockWriteResponse, error)
- func (*StubClient) LocalLocator(loc string) (string, error)
- func (*StubClient) ReadAt(string, []byte, int) (int, error)
- func (*StubClient) RequestAndDecode(_ interface{}, _, _ string, _ io.Reader, _ interface{}) error
- type Subtree
- type TLSVersion
- type TestUser
- type TransactionError
- type URL
- type UntrashOptions
- type UpdateOptions
- type UploadDownloadPermission
- type UploadDownloadRolePermissions
- type User
- type UserActivateOptions
- type UserAuthenticateOptions
- type UserBatchUpdateOptions
- type UserBatchUpdateResponse
- type UserList
- type UserMergeOptions
- type UserSetupOptions
- type VirtualMachine
- type VirtualMachineList
- type Vocabulary
- type VocabularyLabel
- type VocabularyTag
- type VocabularyTagValue
- type Volume
- type VolumeAccess
- type WebDAVCacheConfig
- type WebDAVOptions
- type Workflow
- type WorkflowList
Constants ¶
const ( ContainerStateQueued = ContainerState("Queued") ContainerStateLocked = ContainerState("Locked") ContainerStateRunning = ContainerState("Running") ContainerStateComplete = ContainerState("Complete") ContainerStateCancelled = ContainerState("Cancelled") )
const ( ContainerRequestStateUncomitted = ContainerRequestState("Uncommitted") ContainerRequestStateCommitted = ContainerRequestState("Committed") ContainerRequestStateFinal = ContainerRequestState("Final") )
Variables ¶
var ( EndpointConfigGet = APIEndpoint{"GET", "arvados/v1/config", ""} EndpointVocabularyGet = APIEndpoint{"GET", "arvados/v1/vocabulary", ""} EndpointDiscoveryDocument = APIEndpoint{"GET", "discovery/v1/apis/arvados/v1/rest", ""} EndpointLogin = APIEndpoint{"GET", "login", ""} EndpointLogout = APIEndpoint{"GET", "logout", ""} EndpointAuthorizedKeyCreate = APIEndpoint{"POST", "arvados/v1/authorized_keys", "authorized_key"} EndpointAuthorizedKeyUpdate = APIEndpoint{"PATCH", "arvados/v1/authorized_keys/{uuid}", "authorized_key"} EndpointAuthorizedKeyGet = APIEndpoint{"GET", "arvados/v1/authorized_keys/{uuid}", ""} EndpointAuthorizedKeyList = APIEndpoint{"GET", "arvados/v1/authorized_keys", ""} EndpointAuthorizedKeyDelete = APIEndpoint{"DELETE", "arvados/v1/authorized_keys/{uuid}", ""} EndpointCollectionCreate = APIEndpoint{"POST", "arvados/v1/collections", "collection"} EndpointCollectionUpdate = APIEndpoint{"PATCH", "arvados/v1/collections/{uuid}", "collection"} EndpointCollectionGet = APIEndpoint{"GET", "arvados/v1/collections/{uuid}", ""} EndpointCollectionList = APIEndpoint{"GET", "arvados/v1/collections", ""} EndpointCollectionProvenance = APIEndpoint{"GET", "arvados/v1/collections/{uuid}/provenance", ""} EndpointCollectionUsedBy = APIEndpoint{"GET", "arvados/v1/collections/{uuid}/used_by", ""} EndpointCollectionDelete = APIEndpoint{"DELETE", "arvados/v1/collections/{uuid}", ""} EndpointCollectionTrash = APIEndpoint{"POST", "arvados/v1/collections/{uuid}/trash", ""} EndpointCollectionUntrash = APIEndpoint{"POST", "arvados/v1/collections/{uuid}/untrash", ""} EndpointComputedPermissionList = APIEndpoint{"GET", "arvados/v1/computed_permissions", ""} EndpointContainerCreate = APIEndpoint{"POST", "arvados/v1/containers", "container"} EndpointContainerUpdate = APIEndpoint{"PATCH", "arvados/v1/containers/{uuid}", "container"} EndpointContainerPriorityUpdate = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/update_priority", "container"} EndpointContainerGet = APIEndpoint{"GET", "arvados/v1/containers/{uuid}", ""} EndpointContainerList = APIEndpoint{"GET", "arvados/v1/containers", ""} 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{"POST", "arvados/v1/containers/{uuid}/ssh", ""} EndpointContainerSSHCompat = APIEndpoint{"POST", "arvados/v1/connect/{uuid}/ssh", ""} // for compatibility with arvados <2.7 EndpointContainerGatewayTunnel = APIEndpoint{"POST", "arvados/v1/containers/{uuid}/gateway_tunnel", ""} EndpointContainerGatewayTunnelCompat = APIEndpoint{"POST", "arvados/v1/connect/{uuid}/gateway_tunnel", ""} // for compatibility with arvados <2.7 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}", ""} EndpointContainerRequestContainerStatus = APIEndpoint{"GET", "arvados/v1/container_requests/{uuid}/container_status", ""} EndpointContainerRequestLog = APIEndpoint{"GET", "arvados/v1/container_requests/{uuid}/log{path:|/.*}", ""} EndpointGroupCreate = APIEndpoint{"POST", "arvados/v1/groups", "group"} 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/contents", ""} EndpointGroupContentsUUIDInPath = APIEndpoint{"GET", "arvados/v1/groups/{uuid}/contents", ""} // Alternative HTTP route; client-side code should always use EndpointGroupContents instead EndpointGroupDelete = APIEndpoint{"DELETE", "arvados/v1/groups/{uuid}", ""} EndpointGroupTrash = APIEndpoint{"POST", "arvados/v1/groups/{uuid}/trash", ""} EndpointGroupUntrash = APIEndpoint{"POST", "arvados/v1/groups/{uuid}/untrash", ""} EndpointLinkCreate = APIEndpoint{"POST", "arvados/v1/links", "link"} EndpointLinkUpdate = APIEndpoint{"PATCH", "arvados/v1/links/{uuid}", "link"} EndpointLinkGet = APIEndpoint{"GET", "arvados/v1/links/{uuid}", ""} EndpointLinkList = APIEndpoint{"GET", "arvados/v1/links", ""} EndpointLinkDelete = APIEndpoint{"DELETE", "arvados/v1/links/{uuid}", ""} EndpointLogCreate = APIEndpoint{"POST", "arvados/v1/logs", "log"} EndpointLogUpdate = APIEndpoint{"PATCH", "arvados/v1/logs/{uuid}", "log"} EndpointLogGet = APIEndpoint{"GET", "arvados/v1/logs/{uuid}", ""} EndpointLogList = APIEndpoint{"GET", "arvados/v1/logs", ""} EndpointLogDelete = APIEndpoint{"DELETE", "arvados/v1/logs/{uuid}", ""} EndpointSysTrashSweep = APIEndpoint{"POST", "sys/trash_sweep", ""} EndpointUserActivate = APIEndpoint{"POST", "arvados/v1/users/{uuid}/activate", ""} EndpointUserCreate = APIEndpoint{"POST", "arvados/v1/users", "user"} EndpointUserCurrent = APIEndpoint{"GET", "arvados/v1/users/current", ""} EndpointUserDelete = APIEndpoint{"DELETE", "arvados/v1/users/{uuid}", ""} EndpointUserGet = APIEndpoint{"GET", "arvados/v1/users/{uuid}", ""} EndpointUserGetCurrent = APIEndpoint{"GET", "arvados/v1/users/current", ""} 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", "user"} EndpointUserSystem = APIEndpoint{"GET", "arvados/v1/users/system", ""} EndpointUserUnsetup = APIEndpoint{"POST", "arvados/v1/users/{uuid}/unsetup", ""} EndpointUserUpdate = APIEndpoint{"PATCH", "arvados/v1/users/{uuid}", "user"} EndpointUserBatchUpdate = APIEndpoint{"PATCH", "arvados/v1/users/batch_update", ""} EndpointUserAuthenticate = APIEndpoint{"POST", "arvados/v1/users/authenticate", ""} EndpointAPIClientAuthorizationCurrent = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/current", ""} EndpointAPIClientAuthorizationCreate = APIEndpoint{"POST", "arvados/v1/api_client_authorizations", "api_client_authorization"} EndpointAPIClientAuthorizationUpdate = APIEndpoint{"PUT", "arvados/v1/api_client_authorizations/{uuid}", "api_client_authorization"} EndpointAPIClientAuthorizationList = APIEndpoint{"GET", "arvados/v1/api_client_authorizations", ""} EndpointAPIClientAuthorizationDelete = APIEndpoint{"DELETE", "arvados/v1/api_client_authorizations/{uuid}", ""} EndpointAPIClientAuthorizationGet = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/{uuid}", ""} )
var ( // ErrSignatureExpired - a signature was rejected because the // expiry time has passed. ErrSignatureExpired = errors.New("Signature expired") // ErrSignatureInvalid - a signature was rejected because it // was badly formatted or did not match the given secret key. ErrSignatureInvalid = errors.New("Invalid signature") // ErrSignatureMissing - the given locator does not have a // signature hint. ErrSignatureMissing = errors.New("Missing signature") )
var ( UUIDMatch = regexp.MustCompile(`^[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}$`).MatchString PDHMatch = regexp.MustCompile(`^[0-9a-f]{32}\+\d+$`).MatchString )
var ( ErrReadOnlyFile = errors.New("read-only file") ErrNegativeOffset = errors.New("cannot seek to negative offset") ErrInvalidOperation = errors.New("invalid operation") ErrInvalidArgument = errors.New("invalid argument") ErrDirectoryNotEmpty = errors.New("directory not empty") ErrWriteOnlyMode = errors.New("file is O_WRONLY") ErrSyncNotSupported = errors.New("O_SYNC flag is not supported") ErrIsDirectory = errors.New("cannot rename file to overwrite existing directory") ErrNotADirectory = errors.New("not a directory") ErrPermission = os.ErrPermission DebugLocksPanicMode = false )
var DefaultConfigFile = func() string { if path := os.Getenv("ARVADOS_CONFIG"); path != "" { return path } return "/etc/arvados/config.yml" }()
DefaultSecureClient is the default http.Client used by a Client otherwise.
var InsecureHTTPClient = &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true}}}
InsecureHTTPClient is the default http.Client used by a Client with Insecure==true and Client==nil.
var SignedLocatorRe = regexp.MustCompile(
`^([[:xdigit:]]{32})(\+[0-9]+)?((\+[B-Z][A-Za-z0-9@_-]*)*)(\+A([[:xdigit:]]{40})@([[:xdigit:]]{8}))((\+[B-Z][A-Za-z0-9@_-]*)*)$`)
Functions ¶
func CollectionIDFromDNSName ¶
CollectionIDFromDNSName returns a UUID or PDH if s begins with a UUID or URL-encoded PDH; otherwise "".
func ContextWithAuthorization ¶
ContextWithAuthorization returns a child context that (when used with (*Client)RequestAndDecodeContext) sends the given Authorization header value instead of the Client's default AuthToken.
func ContextWithRequestID ¶
func FS ¶
func FS(fs FileSystem) fs.FS
FS returns an fs.FS interface to the given FileSystem, to enable the use of fs.WalkDir, etc.
func PortableDataHash ¶
PortableDataHash computes the portable data hash of the given manifest.
func SignLocator ¶
func SignLocator(blobLocator, apiToken string, expiry time.Time, blobSignatureTTL time.Duration, permissionSecret []byte) string
SignLocator returns blobLocator with a permission signature added. If either permissionSecret or apiToken is empty, blobLocator is returned untouched.
This function is intended to be used by system components and admin utilities: userland programs do not know the permissionSecret.
func SignManifest ¶
func SignManifest(manifest string, apiToken string, expiry time.Time, ttl time.Duration, permissionSecret []byte) string
SignManifest signs all locators in the given manifest, discarding any existing signatures.
func Splice ¶
func Splice(fs FileSystem, target string, newsubtree *Subtree) error
Splice inserts newsubtree at the indicated target path.
Splice returns an error if target is not inside a collection.
Splice returns an error if target is the root of a collection and newsubtree is a snapshot of a file.
func VerifySignature ¶
func VerifySignature(signedLocator, apiToken string, blobSignatureTTL time.Duration, permissionSecret []byte) error
VerifySignature returns nil if the signature on the signedLocator can be verified using the given apiToken. Otherwise it returns ErrSignatureExpired (if the signature's expiry time has passed, which is something the client could have figured out independently), ErrSignatureMissing (if there is no signature hint at all), or ErrSignatureInvalid (if the signature is present but badly formatted or incorrect).
This function is intended to be used by system components and admin utilities: userland programs do not know the permissionSecret.
Types ¶
type API ¶
type API interface { ConfigGet(ctx context.Context) (json.RawMessage, error) VocabularyGet(ctx context.Context) (Vocabulary, error) Login(ctx context.Context, options LoginOptions) (LoginResponse, error) Logout(ctx context.Context, options LogoutOptions) (LogoutResponse, error) AuthorizedKeyCreate(ctx context.Context, options CreateOptions) (AuthorizedKey, error) AuthorizedKeyUpdate(ctx context.Context, options UpdateOptions) (AuthorizedKey, error) AuthorizedKeyGet(ctx context.Context, options GetOptions) (AuthorizedKey, error) AuthorizedKeyList(ctx context.Context, options ListOptions) (AuthorizedKeyList, error) AuthorizedKeyDelete(ctx context.Context, options DeleteOptions) (AuthorizedKey, 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) CollectionList(ctx context.Context, options ListOptions) (CollectionList, error) CollectionProvenance(ctx context.Context, options GetOptions) (map[string]interface{}, error) CollectionUsedBy(ctx context.Context, options GetOptions) (map[string]interface{}, error) CollectionDelete(ctx context.Context, options DeleteOptions) (Collection, error) CollectionTrash(ctx context.Context, options DeleteOptions) (Collection, error) CollectionUntrash(ctx context.Context, options UntrashOptions) (Collection, error) ComputedPermissionList(ctx context.Context, options ListOptions) (ComputedPermissionList, error) ContainerCreate(ctx context.Context, options CreateOptions) (Container, error) ContainerUpdate(ctx context.Context, options UpdateOptions) (Container, error) ContainerPriorityUpdate(ctx context.Context, options UpdateOptions) (Container, error) ContainerGet(ctx context.Context, options GetOptions) (Container, error) ContainerList(ctx context.Context, options ListOptions) (ContainerList, error) 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) (ConnectionResponse, error) ContainerGatewayTunnel(ctx context.Context, options ContainerGatewayTunnelOptions) (ConnectionResponse, 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) ContainerRequestContainerStatus(ctx context.Context, options GetOptions) (ContainerStatus, error) ContainerRequestLog(ctx context.Context, options ContainerLogOptions) (http.Handler, error) GroupCreate(ctx context.Context, options CreateOptions) (Group, 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 GroupContentsOptions) (ObjectList, error) GroupDelete(ctx context.Context, options DeleteOptions) (Group, error) GroupTrash(ctx context.Context, options DeleteOptions) (Group, error) GroupUntrash(ctx context.Context, options UntrashOptions) (Group, error) LinkCreate(ctx context.Context, options CreateOptions) (Link, error) LinkUpdate(ctx context.Context, options UpdateOptions) (Link, error) LinkGet(ctx context.Context, options GetOptions) (Link, error) LinkList(ctx context.Context, options ListOptions) (LinkList, error) LinkDelete(ctx context.Context, options DeleteOptions) (Link, error) LogCreate(ctx context.Context, options CreateOptions) (Log, error) LogUpdate(ctx context.Context, options UpdateOptions) (Log, error) LogGet(ctx context.Context, options GetOptions) (Log, error) LogList(ctx context.Context, options ListOptions) (LogList, error) LogDelete(ctx context.Context, options DeleteOptions) (Log, error) SysTrashSweep(ctx context.Context, options struct{}) (struct{}, error) UserCreate(ctx context.Context, options CreateOptions) (User, error) UserUpdate(ctx context.Context, options UpdateOptions) (User, error) UserMerge(ctx context.Context, options UserMergeOptions) (User, error) UserActivate(ctx context.Context, options UserActivateOptions) (User, error) UserSetup(ctx context.Context, options UserSetupOptions) (map[string]interface{}, error) UserUnsetup(ctx context.Context, options GetOptions) (User, error) UserGet(ctx context.Context, options GetOptions) (User, error) UserGetCurrent(ctx context.Context, options GetOptions) (User, error) 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) UserAuthenticate(ctx context.Context, options UserAuthenticateOptions) (APIClientAuthorization, error) APIClientAuthorizationCurrent(ctx context.Context, options GetOptions) (APIClientAuthorization, error) APIClientAuthorizationCreate(ctx context.Context, options CreateOptions) (APIClientAuthorization, error) APIClientAuthorizationList(ctx context.Context, options ListOptions) (APIClientAuthorizationList, error) APIClientAuthorizationDelete(ctx context.Context, options DeleteOptions) (APIClientAuthorization, error) APIClientAuthorizationUpdate(ctx context.Context, options UpdateOptions) (APIClientAuthorization, error) APIClientAuthorizationGet(ctx context.Context, options GetOptions) (APIClientAuthorization, error) DiscoveryDocument(ctx context.Context) (DiscoveryDocument, error) }
type APIClientAuthorization ¶
type APIClientAuthorization struct { UUID string `json:"uuid"` APIToken string `json:"api_token"` CreatedAt time.Time `json:"created_at"` CreatedByIPAddress string `json:"created_by_ip_address"` Etag string `json:"etag"` ExpiresAt time.Time `json:"expires_at"` LastUsedAt time.Time `json:"last_used_at"` LastUsedByIPAddress string `json:"last_used_by_ip_address"` ModifiedAt time.Time `json:"modified_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` OwnerUUID string `json:"owner_uuid"` Scopes []string `json:"scopes"` }
APIClientAuthorization is an arvados#apiClientAuthorization resource.
func (APIClientAuthorization) TokenV2 ¶
func (aca APIClientAuthorization) TokenV2() string
type APIClientAuthorizationList ¶
type APIClientAuthorizationList struct {
Items []APIClientAuthorization `json:"items"`
}
APIClientAuthorizationList is an arvados#apiClientAuthorizationList resource.
type APIEndpoint ¶
type AuthorizedKey ¶
type AuthorizedKey struct { UUID string `json:"uuid"` Etag string `json:"etag"` OwnerUUID string `json:"owner_uuid"` CreatedAt time.Time `json:"created_at"` ModifiedAt time.Time `json:"modified_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` Name string `json:"name"` AuthorizedUserUUID string `json:"authorized_user_uuid"` PublicKey string `json:"public_key"` KeyType string `json:"key_type"` ExpiresAt time.Time `json:"expires_at"` }
AuthorizedKey is an arvados#authorizedKey resource.
type AuthorizedKeyList ¶
type AuthorizedKeyList struct { Items []AuthorizedKey `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
AuthorizedKeyList is an arvados#authorizedKeyList resource.
type AzureVolumeDriverParameters ¶
type BlockReadOptions ¶
type BlockSegment ¶
BlockSegment is a portion of a block stored in Keep. It is used in the replace_segments API.
func (BlockSegment) MarshalText ¶
func (bs BlockSegment) MarshalText() ([]byte, error)
MarshalText enables encoding/json to use BlockSegment as a map key.
func (*BlockSegment) UnmarshalJSON ¶
func (bs *BlockSegment) UnmarshalJSON(data []byte) error
type BlockWriteOptions ¶
type BlockWriteResponse ¶
type ByteSizeOrPercent ¶
type ByteSizeOrPercent ByteSize
ByteSizeOrPercent indicates either a number of bytes or a percentage from 1 to 100.
func (ByteSizeOrPercent) ByteSize ¶
func (n ByteSizeOrPercent) ByteSize() ByteSize
ByteSize returns the absolute byte size specified by n, or 0 if n specifies a percent.
func (ByteSizeOrPercent) MarshalJSON ¶
func (n ByteSizeOrPercent) MarshalJSON() ([]byte, error)
func (ByteSizeOrPercent) Percent ¶
func (n ByteSizeOrPercent) Percent() int64
ByteSize returns the percentage specified by n, or 0 if n specifies an absolute byte size.
func (*ByteSizeOrPercent) UnmarshalJSON ¶
func (n *ByteSizeOrPercent) UnmarshalJSON(data []byte) error
type CUDAFeatures ¶
type CUDARuntimeConstraints ¶
type Client ¶
type Client struct { // HTTP client used to make requests. If nil, // DefaultSecureClient or InsecureHTTPClient will be used. Client *http.Client `json:"-"` // Protocol scheme: "http", "https", or "" (https) Scheme string // Hostname (or host:port) of Arvados API server. APIHost string // User authentication token. AuthToken string // Accept unverified certificates. This works only if the // Client field is nil: otherwise, it has no effect. Insecure bool // Override keep service discovery with a list of base // URIs. (Currently there are no Client methods for // discovering keep services so this is just a convenience for // callers who use a Client to initialize an // arvadosclient.ArvadosClient.) KeepServiceURIs []string `json:",omitempty"` // HTTP headers to add/override in outgoing requests. SendHeader http.Header // Timeout for requests. NewClientFromConfig and // NewClientFromEnv return a Client with a default 5 minute // timeout. Within this time, retryable errors are // automatically retried with exponential backoff. // // To disable automatic retries, set Timeout to zero and use a // context deadline to establish a maximum request time. Timeout time.Duration // Maximum disk cache size in bytes or percent of total // filesystem size. If zero, use default, currently 10% of // filesystem size. DiskCacheSize ByteSizeOrPercent // Where to write debug logs. May be nil. Logger logrus.FieldLogger // The cluster config, if the Client was initialized via // NewClientFromConfig. Otherwise nil. Cluster *Cluster // contains filtered or unexported fields }
A Client is an HTTP client with an API endpoint and a set of Arvados credentials.
It offers methods for accessing individual Arvados APIs, and methods that implement common patterns like fetching multiple pages of results using List APIs.
func NewClientFromConfig ¶
NewClientFromConfig creates a new Client that uses the endpoints in the given cluster.
AuthToken is left empty for the caller to populate.
func NewClientFromEnv ¶
func NewClientFromEnv() *Client
NewClientFromEnv creates a new Client that uses the default HTTP client, and loads API endpoint and credentials from ARVADOS_* environment variables (if set) and $HOME/.config/arvados/settings.conf (if readable).
If a config exists in both locations, the environment variable is used.
If there is an error (other than ENOENT) reading settings.conf, NewClientFromEnv logs the error to log.Default(), then proceeds as if settings.conf did not exist.
Space characters are trimmed when reading the settings file, so these are equivalent:
ARVADOS_API_HOST=localhost\n ARVADOS_API_HOST=localhost\r\n ARVADOS_API_HOST = localhost \n \tARVADOS_API_HOST = localhost\n
func (*Client) CurrentUser ¶
CurrentUser calls arvados.v1.users.current, and returns the User record corresponding to this client's credentials.
func (*Client) CustomFileSystem ¶
func (c *Client) CustomFileSystem(kc keepClient) CustomFileSystem
func (*Client) DiscoveryDocument ¶
func (c *Client) DiscoveryDocument() (*DiscoveryDocument, error)
DiscoveryDocument returns a *DiscoveryDocument. The returned object should not be modified: the same object may be returned by subsequent calls.
func (*Client) Do ¶
Do augments (*http.Client)Do(): adds Authorization and X-Request-Id headers, delays in order to comply with rate-limiting restrictions, and retries failed requests when appropriate.
func (*Client) DoAndDecode ¶
DoAndDecode performs req and unmarshals the response (which must be JSON) into dst. Use this instead of RequestAndDecode if you need more control of the http.Request object.
If the response status indicates an HTTP redirect, the Location header value is unmarshalled to dst as a RedirectLocation key/field.
func (*Client) EachKeepService ¶
func (c *Client) EachKeepService(f func(KeepService) error) error
EachKeepService calls f once for every readable KeepService. EachKeepService stops if it encounters an error, such as f returning a non-nil error.
func (*Client) Last503 ¶
Last503 returns the time of the most recent HTTP 503 (Service Unavailable) response. Zero time indicates never.
func (*Client) RequestAndDecode ¶
func (c *Client) RequestAndDecode(dst interface{}, method, path string, body io.Reader, params interface{}) error
RequestAndDecode performs an API request and unmarshals the response (which must be JSON) into dst. Method and body arguments are the same as for http.NewRequest(). The given path is added to the server's scheme/host/port to form the request URL. The given params are passed via POST form or query string.
path must not contain a query string.
func (*Client) RequestAndDecodeContext ¶
func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, method, path string, body io.Reader, params interface{}) error
RequestAndDecodeContext does the same as RequestAndDecode, but with a context
func (*Client) SiteFileSystem ¶
func (c *Client) SiteFileSystem(kc keepClient) CustomFileSystem
SiteFileSystem returns a FileSystem that maps collections and other Arvados objects onto a filesystem layout.
This is experimental: the filesystem layout is not stable, and there are significant known bugs and shortcomings. For example, writes are not persisted until Sync() is called.
func (*Client) UpdateBody ¶
UpdateBody returns an io.Reader suitable for use as an http.Request Body for a create or update API call.
type CloudVMsConfig ¶
type CloudVMsConfig struct { Enable bool BootProbeCommand string InstanceInitCommand string DeployRunnerBinary string DeployRunnerDirectory string DeployPublicKey bool ImageID string MaxCloudOpsPerSecond int MaxProbesPerSecond int MaxConcurrentInstanceCreateOps int MaxInstances int InitialQuotaEstimate int SupervisorFraction float64 PollInterval Duration ProbeInterval Duration SSHPort string SyncInterval Duration TimeoutBooting Duration TimeoutIdle Duration TimeoutProbe Duration TimeoutShutdown Duration TimeoutSignal Duration TimeoutStaleRunLock Duration TimeoutTERM Duration ResourceTags map[string]string TagKeyPrefix string Driver string DriverParameters json.RawMessage }
type Cluster ¶
type Cluster struct { ClusterID string `json:"-"` ManagementToken string SystemRootToken string Services Services InstanceTypes InstanceTypeMap Containers ContainersConfig RemoteClusters map[string]RemoteCluster PostgreSQL PostgreSQL API struct { AsyncPermissionsUpdateInterval Duration DisabledAPIs StringSet MaxIndexDatabaseRead int MaxItemsPerResponse int MaxConcurrentRailsRequests int MaxConcurrentRequests int MaxQueuedRequests int MaxGatewayTunnels int MaxQueueTimeForLockRequests Duration MaxKeepBlobBuffers int MaxRequestAmplification int MaxRequestSize int MaxTokenLifetime Duration RequestTimeout Duration SendTimeout Duration WebsocketClientEventQueue int WebsocketServerEventQueue int KeepServiceRequestTimeout Duration VocabularyPath string FreezeProjectRequiresDescription bool FreezeProjectRequiresProperties StringSet UnfreezeProjectRequiresAdmin bool LockBeforeUpdate bool } AuditLogs struct { MaxAge Duration MaxDeleteBatch int UnloggedAttributes StringSet } Collections struct { BlobSigning bool BlobSigningKey string BlobSigningTTL Duration BlobTrash bool BlobTrashLifetime Duration BlobTrashCheckInterval Duration BlobTrashConcurrency int BlobDeleteConcurrency int BlobReplicateConcurrency int CollectionVersioning bool DefaultTrashLifetime Duration DefaultReplication int ManagedProperties ManagedProperties PreserveVersionIfIdle Duration TrashSweepInterval Duration TrustAllContent bool ForwardSlashNameSubstitution string S3FolderObjects bool BlobMissingReport string BalancePeriod Duration BalanceCollectionBatch int BalanceCollectionBuffers int BalanceTimeout Duration BalanceUpdateLimit int BalancePullLimit int BalanceTrashLimit int WebDAVCache WebDAVCacheConfig KeepproxyPermission UploadDownloadRolePermissions WebDAVPermission UploadDownloadRolePermissions WebDAVLogEvents bool WebDAVLogDownloadInterval Duration WebDAVOutputBuffer ByteSize } Login struct { LDAP struct { Enable bool URL URL StartTLS bool InsecureTLS bool MinTLSVersion TLSVersion StripDomain string AppendDomain string SearchAttribute string SearchBindUser string SearchBindPassword string SearchBase string SearchFilters string EmailAttribute string UsernameAttribute string } Google struct { Enable bool ClientID string ClientSecret string AlternateEmailAddresses bool AuthenticationRequestParameters map[string]string } OpenIDConnect struct { Enable bool Issuer string ClientID string ClientSecret string EmailClaim string EmailVerifiedClaim string UsernameClaim string AcceptAccessToken bool AcceptAccessTokenScope string AuthenticationRequestParameters map[string]string } PAM struct { Enable bool Service string DefaultEmailDomain string } Test struct { Enable bool Users map[string]TestUser } LoginCluster string RemoteTokenRefresh Duration TokenLifetime Duration TrustedClients map[URL]struct{} TrustPrivateNetworks bool IssueTrustedTokens bool } SystemLogs struct { LogLevel string Format string MaxRequestLogParamsSize int RequestQueueDumpDirectory string } TLS struct { Certificate string Key string Insecure bool ACME struct { Server string } } Users struct { ActivatedUsersAreVisibleToOthers bool AnonymousUserToken string AdminNotifierEmailFrom string AutoAdminFirstUser bool AutoAdminUserWithEmail string AutoSetupNewUsers bool AutoSetupNewUsersWithVmUUID string AutoSetupUsernameBlacklist StringSet EmailSubjectPrefix string NewInactiveUserNotificationRecipients StringSet NewUserNotificationRecipients StringSet NewUsersAreActive bool SendUserSetupNotificationEmail bool SupportEmailAddress string UserNotifierEmailFrom string UserNotifierEmailBcc StringSet UserProfileNotificationAddress string PreferDomainForUsername string UserSetupMailText string RoleGroupsVisibleToAll bool CanCreateRoleGroups bool ActivityLoggingPeriod Duration SyncIgnoredGroups []string SyncRequiredGroups []string SyncUserAccounts bool SyncUserAPITokens bool SyncUserGroups bool SyncUserSSHKeys bool } StorageClasses map[string]StorageClassConfig Volumes map[string]Volume Workbench struct { ActivationContactLink string ArvadosDocsite string ArvadosPublicDataDocURL string DisableSharingURLsUI bool FileViewersConfigURL string ShowUserAgreementInline bool SiteName string Theme string UserProfileFormFields map[string]struct { Type string FormFieldTitle string FormFieldDescription string Required bool Position int Options map[string]struct{} } UserProfileFormMessage string WelcomePageHTML string InactivePageHTML string SSHHelpPageHTML string SSHHelpHostSuffix string IdleTimeout Duration BannerUUID string } }
type Collection ¶
type Collection struct { UUID string `json:"uuid"` Etag string `json:"etag"` OwnerUUID string `json:"owner_uuid"` TrashAt *time.Time `json:"trash_at"` ManifestText string `json:"manifest_text"` UnsignedManifestText string `json:"unsigned_manifest_text"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` ModifiedAt time.Time `json:"modified_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` PortableDataHash string `json:"portable_data_hash"` ReplicationConfirmed *int `json:"replication_confirmed"` ReplicationConfirmedAt *time.Time `json:"replication_confirmed_at"` ReplicationDesired *int `json:"replication_desired"` StorageClassesDesired []string `json:"storage_classes_desired"` StorageClassesConfirmed []string `json:"storage_classes_confirmed"` StorageClassesConfirmedAt *time.Time `json:"storage_classes_confirmed_at"` DeleteAt *time.Time `json:"delete_at"` IsTrashed bool `json:"is_trashed"` Properties map[string]interface{} `json:"properties"` WritableBy []string `json:"writable_by,omitempty"` FileCount int `json:"file_count"` FileSizeTotal int64 `json:"file_size_total"` Version int `json:"version"` PreserveVersion bool `json:"preserve_version"` CurrentVersionUUID string `json:"current_version_uuid"` Description string `json:"description"` }
Collection is an arvados#collection resource.
func (*Collection) FileSystem ¶
func (c *Collection) FileSystem(client apiClient, kc keepClient) (CollectionFileSystem, error)
FileSystem returns a CollectionFileSystem for the collection.
func (*Collection) SizedDigests ¶
func (c *Collection) SizedDigests() ([]SizedDigest, error)
SizedDigests returns the hash+size part of each data block referenced by the collection.
Zero-length blocks are not included.
type CollectionFileSystem ¶
type CollectionFileSystem interface { FileSystem // Flush all file data to Keep and return a snapshot of the // filesystem suitable for saving as (Collection)ManifestText. // Prefix (normally ".") is a top level directory, effectively // prepended to all paths in the returned manifest. MarshalManifest(prefix string) (string, error) // Given map {x->y}, replace each occurrence of x with y. // Except: If segment x is not referenced anywhere in the // collection, do not make any replacements that reference the // same locator as y. The first return value is true if any // substitutions were made. ReplaceSegments(map[BlockSegment]BlockSegment) (bool, error) // Total data bytes in all files. Size() int64 }
A CollectionFileSystem is a FileSystem that can be serialized as a manifest and stored as a collection.
type CollectionList ¶
type CollectionList struct { Items []Collection `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
type ComputedPermission ¶
type ComputedPermissionList ¶
type ComputedPermissionList struct { Items []ComputedPermission `json:"items"` ItemsAvailable int `json:"items_available"` Limit int `json:"limit"` }
type Config ¶
type Config struct { Clusters map[string]Cluster AutoReloadConfig bool SourceTimestamp time.Time SourceSHA256 string }
func GetConfig ¶
GetConfig returns the current system config, loading it from configFile if needed.
type ConnectionResponse ¶
type ConnectionResponse struct { Conn net.Conn `json:"-"` Bufrw *bufio.ReadWriter `json:"-"` Logger logrus.FieldLogger `json:"-"` Header http.Header `json:"-"` }
func (ConnectionResponse) ServeHTTP ¶
func (cresp ConnectionResponse) ServeHTTP(w http.ResponseWriter, req *http.Request)
type Container ¶
type Container struct { UUID string `json:"uuid"` Etag string `json:"etag"` CreatedAt time.Time `json:"created_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` ModifiedAt time.Time `json:"modified_at"` Command []string `json:"command"` ContainerImage string `json:"container_image"` Cwd string `json:"cwd"` Environment map[string]string `json:"environment"` LockedByUUID string `json:"locked_by_uuid"` LockCount int `json:"lock_count"` Mounts map[string]Mount `json:"mounts"` Output string `json:"output"` OutputPath string `json:"output_path"` OutputGlob []string `json:"output_glob"` Priority int64 `json:"priority"` RuntimeConstraints RuntimeConstraints `json:"runtime_constraints"` State ContainerState `json:"state"` SchedulingParameters SchedulingParameters `json:"scheduling_parameters"` ExitCode int `json:"exit_code"` RuntimeStatus map[string]interface{} `json:"runtime_status"` StartedAt *time.Time `json:"started_at"` // nil if not yet started FinishedAt *time.Time `json:"finished_at"` // nil if not yet finished GatewayAddress string `json:"gateway_address"` InteractiveSessionStarted bool `json:"interactive_session_started"` OutputStorageClasses []string `json:"output_storage_classes"` RuntimeUserUUID string `json:"runtime_user_uuid"` RuntimeAuthScopes []string `json:"runtime_auth_scopes"` RuntimeToken string `json:"runtime_token"` AuthUUID string `json:"auth_uuid"` Log string `json:"log"` Cost float64 `json:"cost"` SubrequestsCost float64 `json:"subrequests_cost"` }
Container is an arvados#container resource.
type ContainerGatewayTunnelOptions ¶
type ContainerList ¶
type ContainerList struct { Items []Container `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
ContainerList is an arvados#containerList resource.
type ContainerLogOptions ¶
type ContainerLogOptions struct { UUID string `json:"uuid"` NoForward bool `json:"no_forward"` WebDAVOptions }
type ContainerRequest ¶
type ContainerRequest struct { UUID string `json:"uuid"` OwnerUUID string `json:"owner_uuid"` CreatedAt time.Time `json:"created_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` ModifiedAt time.Time `json:"modified_at"` Etag string `json:"etag"` Name string `json:"name"` Description string `json:"description"` Properties map[string]interface{} `json:"properties"` State ContainerRequestState `json:"state"` RequestingContainerUUID string `json:"requesting_container_uuid"` ContainerUUID string `json:"container_uuid"` ContainerCountMax int `json:"container_count_max"` Mounts map[string]Mount `json:"mounts"` RuntimeConstraints RuntimeConstraints `json:"runtime_constraints"` SchedulingParameters SchedulingParameters `json:"scheduling_parameters"` ContainerImage string `json:"container_image"` Environment map[string]string `json:"environment"` Cwd string `json:"cwd"` Command []string `json:"command"` OutputPath string `json:"output_path"` OutputGlob []string `json:"output_glob"` OutputName string `json:"output_name"` OutputTTL int `json:"output_ttl"` Priority int `json:"priority"` UseExisting bool `json:"use_existing"` LogUUID string `json:"log_uuid"` OutputUUID string `json:"output_uuid"` RuntimeToken string `json:"runtime_token"` ExpiresAt time.Time `json:"expires_at"` Filters []Filter `json:"filters"` ContainerCount int `json:"container_count"` OutputStorageClasses []string `json:"output_storage_classes"` OutputProperties map[string]interface{} `json:"output_properties"` CumulativeCost float64 `json:"cumulative_cost"` }
ContainerRequest is an arvados#container_request resource.
type ContainerRequestList ¶
type ContainerRequestList struct { Items []ContainerRequest `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
ContainerRequestList is an arvados#containerRequestList resource.
type ContainerRequestState ¶
type ContainerRequestState string
ContainerRequestState is a string corresponding to a valid Container Request state.
type ContainerSSHOptions ¶
type ContainerState ¶
type ContainerState string
ContainerState is a string corresponding to a valid Container state.
type ContainerStatus ¶
type ContainerStatus struct { UUID string `json:"uuid"` State ContainerState `json:"container_state"` SchedulingStatus string `json:"scheduling_status"` }
type ContainersConfig ¶
type ContainersConfig struct { CloudVMs CloudVMsConfig CrunchRunCommand string CrunchRunArgumentsList []string DefaultKeepCacheRAM ByteSize DispatchPrivateKey string LogReuseDecisions bool MaxDispatchAttempts int MaxRetryAttempts int MinRetryPeriod Duration ReserveExtraRAM ByteSize StaleLockTimeout Duration SupportedDockerImageFormats StringSet AlwaysUsePreemptibleInstances bool PreemptiblePriceFactor float64 MaximumPriceFactor float64 RuntimeEngine string LocalKeepBlobBuffersPerVCPU int LocalKeepLogsToContainerLog string Logging struct { LogUpdatePeriod Duration LogUpdateSize ByteSize } ShellAccess struct { Admin bool User bool } SLURM struct { PrioritySpread int64 SbatchArgumentsList []string SbatchEnvironmentVariables map[string]string } LSF struct { BsubSudoUser string BsubArgumentsList []string BsubCUDAArguments []string MaxRunTimeOverhead Duration MaxRunTimeDefault Duration } }
type CreateOptions ¶
type CreateOptions struct { ClusterID string `json:"cluster_id"` EnsureUniqueName bool `json:"ensure_unique_name"` Select []string `json:"select"` Attrs map[string]interface{} `json:"attrs"` // ReplaceFiles and ReplaceSegments only apply when creating a // collection. ReplaceFiles map[string]string `json:"replace_files"` ReplaceSegments map[BlockSegment]BlockSegment `json:"replace_segments"` }
type CustomFileSystem ¶
type CustomFileSystem interface { FileSystem MountByID(mount string) MountProject(mount, uuid string) MountUsers(mount string) ForwardSlashNameSubstitution(string) }
type DirectoryVolumeDriverParameters ¶
type DiscoveryDocument ¶
type DiscoveryDocument struct { BasePath string `json:"basePath"` DefaultCollectionReplication int `json:"defaultCollectionReplication"` BlobSignatureTTL int64 `json:"blobSignatureTtl"` GitURL string `json:"gitUrl"` Schemas map[string]Schema `json:"schemas"` Resources map[string]Resource `json:"resources"` Revision string `json:"revision"` }
DiscoveryDocument is the Arvados server's description of itself.
type DiskCache ¶
type DiskCache struct { KeepGateway Dir string MaxSize ByteSizeOrPercent Logger logrus.FieldLogger // contains filtered or unexported fields }
DiskCache wraps KeepGateway, adding a disk-based cache layer.
A DiskCache is automatically incorporated into the backend stack of each keepclient.KeepClient. Most programs do not need to use DiskCache directly.
func (*DiskCache) BlockRead ¶
BlockRead reads an entire block using a 128 KiB buffer.
func (*DiskCache) BlockWrite ¶
func (cache *DiskCache) BlockWrite(ctx context.Context, opts BlockWriteOptions) (BlockWriteResponse, error)
BlockWrite writes through to the wrapped KeepGateway, and (if possible) retains a copy of the written block in the cache.
func (*DiskCache) ReadAt ¶
ReadAt reads the entire block from the wrapped KeepGateway into the cache if needed, and copies the requested portion into the provided slice.
ReadAt returns as soon as the requested portion is available in the cache. The remainder of the block may continue to be copied into the cache in the background.
type Duration ¶
Duration is time.Duration but looks like "12s" in JSON, rather than a number of nanoseconds.
func (Duration) Duration ¶
Duration returns a time.Duration.
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Duration) Set ¶
Set implements the flag.Value interface and sets the duration value by using time.ParseDuration to parse the string.
func (Duration) String ¶
String returns a format similar to (time.Duration)String() but with "0m" and "0s" removed: e.g., "1h" instead of "1h0m0s".
type File ¶
type File interface { io.Reader io.Writer io.Closer io.Seeker Size() int64 Readdir(int) ([]os.FileInfo, error) Stat() (os.FileInfo, error) Truncate(int64) error Sync() error // Create a snapshot of a file or directory tree, which can // then be spliced onto a different path or a different // collection. Snapshot() (*Subtree, error) // Replace this file or directory with the given snapshot. // The target must be inside a collection: Splice returns an // error if the File is a virtual file or directory like // by_id, a project directory, .arvados#collection, // etc. Splice can replace directories with regular files and // vice versa, except it cannot replace the root directory of // a collection with a regular file. Splice(snapshot *Subtree) error }
A File is an *os.File-like interface for reading and writing files in a FileSystem.
type FileSystem ¶
type FileSystem interface { http.FileSystem // analogous to os.Stat() Stat(name string) (os.FileInfo, error) // analogous to os.Create(): create/truncate a file and open it O_RDWR. Create(name string) (File, error) // Like os.OpenFile(): create or open a file or directory. // // If flag&os.O_EXCL==0, it opens an existing file or // directory if one exists. If flag&os.O_CREATE!=0, it creates // a new empty file or directory if one does not already // exist. // // When creating a new item, perm&os.ModeDir determines // whether it is a file or a directory. // // A file can be opened multiple times and used concurrently // from multiple goroutines. However, each File object should // be used by only one goroutine at a time. OpenFile(name string, flag int, perm os.FileMode) (File, error) Mkdir(name string, perm os.FileMode) error Remove(name string) error RemoveAll(name string) error Rename(oldname, newname string) error // Write buffered data from memory to storage, returning when // all updates have been saved to persistent storage. Sync() error // Write buffered data from memory to storage, but don't wait // for all writes to finish before returning. If shortBlocks // is true, flush everything; otherwise, if there's less than // a full block of buffered data at the end of a stream, leave // it buffered in memory in case more data can be appended. If // path is "", flush all dirs/streams; otherwise, flush only // the specified dir/stream. Flush(path string, shortBlocks bool) error // Estimate current memory usage. MemorySize() int64 // contains filtered or unexported methods }
A FileSystem is an http.Filesystem plus Stat() and support for opening writable files. All methods are safe to call from multiple goroutines.
type Filter ¶
A Filter restricts the set of records returned by a list/index API.
func (*Filter) MarshalJSON ¶
MarshalJSON encodes a Filter to a JSON array.
type GetOptions ¶
type Group ¶
type Group struct { UUID string `json:"uuid"` Name string `json:"name"` OwnerUUID string `json:"owner_uuid"` GroupClass string `json:"group_class"` Etag string `json:"etag"` TrashAt *time.Time `json:"trash_at"` CreatedAt time.Time `json:"created_at"` ModifiedAt time.Time `json:"modified_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` DeleteAt *time.Time `json:"delete_at"` IsTrashed bool `json:"is_trashed"` Properties map[string]interface{} `json:"properties"` WritableBy []string `json:"writable_by,omitempty"` Description string `json:"description"` FrozenByUUID string `json:"frozen_by_uuid"` CanWrite bool `json:"can_write"` CanManage bool `json:"can_manage"` }
Group is an arvados#group record
type GroupContentsOptions ¶
type GroupContentsOptions struct { ClusterID string `json:"cluster_id"` UUID string `json:"uuid,omitempty"` Select []string `json:"select"` Filters []Filter `json:"filters"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Order []string `json:"order"` Distinct bool `json:"distinct"` Count string `json:"count"` Include []string `json:"include"` Recursive bool `json:"recursive"` IncludeTrash bool `json:"include_trash"` IncludeOldVersions bool `json:"include_old_versions"` ExcludeHomeProject bool `json:"exclude_home_project"` }
type GroupList ¶
type GroupList struct { Items []Group `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` Included []interface{} `json:"included"` }
GroupList is an arvados#groupList resource.
type InstanceType ¶
type InstanceTypeMap ¶
type InstanceTypeMap map[string]InstanceType
func (*InstanceTypeMap) UnmarshalJSON ¶
func (it *InstanceTypeMap) UnmarshalJSON(data []byte) error
UnmarshalJSON does special handling of InstanceTypes:
- populate computed fields (Name and Scratch)
- error out if InstancesTypes are populated as an array, which was deprecated in Arvados 1.2.0
type KeepGateway ¶
type KeepMount ¶
type KeepService ¶
type KeepService struct { UUID string `json:"uuid"` ServiceHost string `json:"service_host"` ServicePort int `json:"service_port"` ServiceSSLFlag bool `json:"service_ssl_flag"` ServiceType string `json:"service_type"` ReadOnly bool `json:"read_only"` CreatedAt time.Time `json:"created_at"` ModifiedAt time.Time `json:"modified_at"` }
KeepService is an arvados#keepService record
func (*KeepService) Index ¶
func (s *KeepService) Index(ctx context.Context, c *Client, prefix string) ([]KeepServiceIndexEntry, error)
Index returns an unsorted list of blocks that can be retrieved from this server.
func (*KeepService) IndexMount ¶
func (s *KeepService) IndexMount(ctx context.Context, c *Client, mountUUID string, prefix string) ([]KeepServiceIndexEntry, error)
IndexMount returns an unsorted list of blocks at the given mount point.
func (*KeepService) Mounts ¶
func (s *KeepService) Mounts(c *Client) ([]KeepMount, error)
func (*KeepService) Touch ¶
Touch updates the timestamp on the given block.
type KeepServiceIndexEntry ¶
type KeepServiceIndexEntry struct { SizedDigest // Time of last write, in nanoseconds since Unix epoch Mtime int64 }
KeepServiceIndexEntry is what a keep service's index response tells us about a stored block.
type KeepServiceList ¶
type KeepServiceList struct { Items []KeepService `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
KeepServiceList is an arvados#keepServiceList record
type Link ¶
type Link struct { UUID string `json:"uuid,omitempty"` Etag string `json:"etag"` OwnerUUID string `json:"owner_uuid"` Name string `json:"name"` LinkClass string `json:"link_class"` CreatedAt time.Time `json:"created_at"` ModifiedAt time.Time `json:"modified_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` HeadUUID string `json:"head_uuid"` HeadKind string `json:"head_kind"` TailUUID string `json:"tail_uuid"` TailKind string `json:"tail_kind"` Properties map[string]interface{} `json:"properties"` }
Link is an arvados#link record
type LinkList ¶
type LinkList struct { Items []Link `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
LinkList is an arvados#linkList resource.
type ListOptions ¶
type ListOptions struct { ClusterID string `json:"cluster_id"` Select []string `json:"select"` Filters []Filter `json:"filters"` Where map[string]interface{} `json:"where"` 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"` BypassFederation bool `json:"bypass_federation"` ForwardedFor string `json:"forwarded_for,omitempty"` Include []string `json:"include"` }
type Log ¶
type Log struct { ID int64 `json:"id"` UUID string `json:"uuid"` OwnerUUID string `json:"owner_uuid"` ObjectUUID string `json:"object_uuid"` ObjectOwnerUUID string `json:"object_owner_uuid"` EventType string `json:"event_type"` EventAt time.Time `json:"event"` Summary string `json:"summary"` Properties map[string]interface{} `json:"properties"` CreatedAt time.Time `json:"created_at"` ModifiedAt time.Time `json:"modified_at"` }
Log is an arvados#log record
type LogList ¶
type LogList struct { Items []Log `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
LogList is an arvados#logList resource.
type LoginOptions ¶
type LoginOptions struct { ReturnTo string `json:"return_to"` // On success, redirect to this target with api_token=xxx query param Remote string `json:"remote,omitempty"` // Salt token for remote Cluster ID Code string `json:"code,omitempty"` // OAuth2 callback code State string `json:"state,omitempty"` // OAuth2 callback state }
type LoginResponse ¶
type LoginResponse struct { RedirectLocation string `json:"redirect_location,omitempty"` HTML bytes.Buffer `json:"-"` }
func (LoginResponse) ServeHTTP ¶
func (resp LoginResponse) ServeHTTP(w http.ResponseWriter, req *http.Request)
type LogoutOptions ¶
type LogoutOptions struct {
ReturnTo string `json:"return_to"` // Redirect to this URL after logging out
}
type LogoutResponse ¶
type LogoutResponse struct {
RedirectLocation string `json:"redirect_location,omitempty"`
}
func (LogoutResponse) ServeHTTP ¶
func (resp LogoutResponse) ServeHTTP(w http.ResponseWriter, req *http.Request)
type ManagedProperties ¶
type Mount ¶
type Mount struct { Kind string `json:"kind"` Writable bool `json:"writable"` PortableDataHash string `json:"portable_data_hash"` UUID string `json:"uuid"` DeviceType string `json:"device_type"` Path string `json:"path"` Content interface{} `json:"content"` ExcludeFromOutput bool `json:"exclude_from_output"` Capacity int64 `json:"capacity"` }
Mount is special behavior to attach to a filesystem path or device.
type Node ¶
type Node struct { UUID string `json:"uuid"` Domain string `json:"domain"` Hostname string `json:"hostname"` IPAddress string `json:"ip_address"` LastPingAt *time.Time `json:"last_ping_at"` SlotNumber int `json:"slot_number"` Status string `json:"status"` JobUUID string `json:"job_uuid"` Properties NodeProperties `json:"properties"` }
Node is an arvados#node resource.
type NodeList ¶
type NodeList struct { Items []Node `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
NodeList is an arvados#nodeList resource.
type NodeProperties ¶
type NodeProperties struct { CloudNode NodePropertiesCloudNode `json:"cloud_node"` TotalCPUCores int `json:"total_cpu_cores,omitempty"` TotalScratchMB int64 `json:"total_scratch_mb,omitempty"` TotalRAMMB int64 `json:"total_ram_mb,omitempty"` }
type NodePropertiesCloudNode ¶
type ObjectList ¶
type ObjectList struct { Included []interface{} `json:"included"` Items []interface{} `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
ObjectList is an arvados#objectList resource.
type PostgreSQL ¶
type PostgreSQL struct { Connection PostgreSQLConnection ConnectionPool int }
type PostgreSQLConnection ¶
func (PostgreSQLConnection) String ¶
func (c PostgreSQLConnection) String() string
type RemoteCluster ¶
type Resource ¶
type Resource struct {
Methods map[string]ResourceMethod `json:"methods"`
}
type ResourceListParams ¶
type ResourceListParams struct { Select []string `json:"select,omitempty"` Filters []Filter `json:"filters,omitempty"` IncludeTrash bool `json:"include_trash,omitempty"` IncludeOldVersions bool `json:"include_old_versions,omitempty"` Limit *int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` Order string `json:"order,omitempty"` Distinct bool `json:"distinct,omitempty"` Count string `json:"count,omitempty"` }
ResourceListParams expresses which results are requested in a list/index API.
type ResourceMethod ¶
type ResourceMethod struct { HTTPMethod string `json:"httpMethod"` Path string `json:"path"` Response MethodResponse `json:"response"` }
type RuntimeConstraints ¶
type RuntimeConstraints struct { API bool `json:"API"` RAM int64 `json:"ram"` VCPUs int `json:"vcpus"` KeepCacheRAM int64 `json:"keep_cache_ram"` KeepCacheDisk int64 `json:"keep_cache_disk"` CUDA CUDARuntimeConstraints `json:"cuda"` }
RuntimeConstraints specify a container's compute resources (RAM, CPU) and network connectivity.
type S3VolumeDriverParameters ¶
type S3VolumeDriverParameters struct { AccessKeyID string SecretAccessKey string Endpoint string Region string Bucket string LocationConstraint bool V2Signature bool IndexPageSize int ConnectTimeout Duration ReadTimeout Duration RaceWindow Duration UnsafeDelete bool PrefixLength int UsePathStyle bool }
type SchedulingParameters ¶
type SchedulingParameters struct { Partitions []string `json:"partitions"` Preemptible bool `json:"preemptible"` MaxRunTime int `json:"max_run_time"` Supervisor bool `json:"supervisor"` }
SchedulingParameters specify a container's scheduling parameters such as Partitions
type Service ¶
type Service struct { InternalURLs map[URL]ServiceInstance ExternalURL URL }
type ServiceInstance ¶
type ServiceName ¶
type ServiceName string
const ( ServiceNameController ServiceName = "arvados-controller" ServiceNameDispatchCloud ServiceName = "arvados-dispatch-cloud" ServiceNameDispatchLSF ServiceName = "arvados-dispatch-lsf" ServiceNameDispatchSLURM ServiceName = "crunch-dispatch-slurm" ServiceNameHealth ServiceName = "arvados-health" ServiceNameKeepbalance ServiceName = "keep-balance" ServiceNameKeepproxy ServiceName = "keepproxy" ServiceNameKeepstore ServiceName = "keepstore" ServiceNameKeepweb ServiceName = "keep-web" ServiceNameRailsAPI ServiceName = "arvados-api-server" ServiceNameWebsocket ServiceName = "arvados-ws" ServiceNameWorkbench1 ServiceName = "arvados-workbench1" ServiceNameWorkbench2 ServiceName = "arvados-workbench2" )
type Services ¶
type Services struct { Composer Service Controller Service DispatchCloud Service DispatchLSF Service DispatchSLURM Service Health Service Keepbalance Service Keepproxy Service Keepstore Service RailsAPI Service WebDAVDownload Service WebDAV Service WebShell Service Websocket Service Workbench1 Service Workbench2 Service }
func (Services) Map ¶
func (svcs Services) Map() map[ServiceName]Service
Map returns all services as a map, suitable for iterating over all services or looking up a service by name.
type SizedDigest ¶
type SizedDigest string
SizedDigest is a minimal Keep block locator: hash+size
func (SizedDigest) Size ¶
func (sd SizedDigest) Size() int64
Size returns the size of the data block, in bytes.
type StubClient ¶
type StubClient struct{}
func (*StubClient) BlockWrite ¶
func (*StubClient) BlockWrite(context.Context, BlockWriteOptions) (BlockWriteResponse, error)
func (*StubClient) LocalLocator ¶
func (*StubClient) LocalLocator(loc string) (string, error)
type Subtree ¶
type Subtree struct {
// contains filtered or unexported fields
}
A Subtree is a detached part of a filesystem tree that can be spliced into a filesystem via (File)Splice().
func Snapshot ¶
func Snapshot(fs FileSystem, path string) (*Subtree, error)
Snapshot returns a Subtree that's a copy of the given path. It returns an error if the path is not inside a collection.
type TLSVersion ¶
type TLSVersion uint16
func (TLSVersion) MarshalText ¶
func (v TLSVersion) MarshalText() ([]byte, error)
func (*TLSVersion) UnmarshalJSON ¶
func (v *TLSVersion) UnmarshalJSON(text []byte) error
type TransactionError ¶
type TransactionError struct { Method string URL url.URL StatusCode int Status string Errors []string }
func (TransactionError) Error ¶
func (e TransactionError) Error() (s string)
func (TransactionError) HTTPStatus ¶
func (e TransactionError) HTTPStatus() int
type URL ¶
URL is a url.URL that is also usable as a JSON key/value.
type UntrashOptions ¶
type UpdateOptions ¶
type UpdateOptions struct { UUID string `json:"uuid"` Attrs map[string]interface{} `json:"attrs"` Select []string `json:"select"` BypassFederation bool `json:"bypass_federation"` // ReplaceFiles and ReplaceSegments only apply when updating a // collection. ReplaceFiles map[string]string `json:"replace_files"` ReplaceSegments map[BlockSegment]BlockSegment `json:"replace_segments"` }
type UploadDownloadRolePermissions ¶
type UploadDownloadRolePermissions struct { User UploadDownloadPermission Admin UploadDownloadPermission }
type User ¶
type User struct { UUID string `json:"uuid"` Etag string `json:"etag"` IsActive bool `json:"is_active"` IsAdmin bool `json:"is_admin"` Username string `json:"username"` Email string `json:"email"` FullName string `json:"full_name"` FirstName string `json:"first_name"` LastName string `json:"last_name"` IdentityURL string `json:"identity_url"` IsInvited bool `json:"is_invited"` OwnerUUID string `json:"owner_uuid"` CreatedAt time.Time `json:"created_at"` ModifiedAt time.Time `json:"modified_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` Prefs map[string]interface{} `json:"prefs"` WritableBy []string `json:"writable_by,omitempty"` CanWrite bool `json:"can_write"` CanManage bool `json:"can_manage"` }
User is an arvados#user record
type UserAuthenticateOptions ¶
type UserBatchUpdateOptions ¶
type UserBatchUpdateResponse ¶
type UserBatchUpdateResponse struct{}
type UserList ¶
type UserList struct { Items []User `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
UserList is an arvados#userList resource.
type UserMergeOptions ¶
type UserSetupOptions ¶
type UserSetupOptions struct { 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 VirtualMachine ¶
type VirtualMachine struct { UUID string `json:"uuid"` OwnerUUID string `json:"owner_uuid"` Hostname string `json:"hostname"` CreatedAt *time.Time `json:"created_at"` ModifiedAt *time.Time `json:"modified_at"` ModifiedByUserUUID string `json:"modified_by_user_uuid"` }
VirtualMachine is an arvados#virtualMachine resource.
type VirtualMachineList ¶
type VirtualMachineList struct { Items []VirtualMachine `json:"items"` ItemsAvailable int `json:"items_available"` Offset int `json:"offset"` Limit int `json:"limit"` }
VirtualMachineList is an arvados#virtualMachineList resource.
type Vocabulary ¶
type Vocabulary struct { StrictTags bool `json:"strict_tags"` Tags map[string]VocabularyTag `json:"tags"` // contains filtered or unexported fields }
func NewVocabulary ¶
func NewVocabulary(data []byte, managedTagKeys []string) (voc *Vocabulary, err error)
NewVocabulary creates a new Vocabulary from a JSON definition and a list of reserved tag keys that will get special treatment when strict mode is enabled.
func (*Vocabulary) Check ¶
func (v *Vocabulary) Check(data map[string]interface{}) error
Check validates the given data against the vocabulary.
type VocabularyTag ¶
type VocabularyTag struct { Strict bool `json:"strict"` Labels []VocabularyLabel `json:"labels"` Values map[string]VocabularyTagValue `json:"values"` }
type VocabularyTagValue ¶
type VocabularyTagValue struct {
Labels []VocabularyLabel `json:"labels"`
}
type Volume ¶
type Volume struct { AccessViaHosts map[URL]VolumeAccess ReadOnly bool AllowTrashWhenReadOnly bool Replication int StorageClasses map[string]bool Driver string DriverParameters json.RawMessage }
type WebDAVCacheConfig ¶
type WebDAVCacheConfig struct { TTL Duration DiskCacheSize ByteSizeOrPercent MaxCollectionBytes ByteSize MaxSessions int }
type Workflow ¶
type Workflow struct { UUID string `json:"uuid"` OwnerUUID string `json:"owner_uuid"` Name string `json:"name"` Description string `json:"description"` Definition string `json:"definition"` CreatedAt *time.Time `json:"created_at"` ModifiedAt *time.Time `json:"modified_at"` }
Workflow is an arvados#workflow resource.
Source Files ¶
- api.go
- api_client_authorization.go
- authorized_key.go
- blob_signature.go
- block_segment.go
- byte_size.go
- client.go
- collection.go
- config.go
- container.go
- container_gateway.go
- context.go
- contextgroup.go
- doc.go
- duration.go
- error.go
- fs_backend.go
- fs_base.go
- fs_collection.go
- fs_deferred.go
- fs_filehandle.go
- fs_getternode.go
- fs_lookup.go
- fs_project.go
- fs_site.go
- fs_users.go
- group.go
- integration_test_cluster.go
- keep_block.go
- keep_cache.go
- keep_service.go
- limiter.go
- link.go
- log.go
- login.go
- node.go
- postgresql.go
- resource_list.go
- throttle.go
- tls_certs.go
- user.go
- virtual_machine.go
- vocabulary.go
- workflow.go