Documentation
¶
Index ¶
- func AuthGenerateOauthClientConfig(ctx context.Context, clientID string, clientSecret string, redirectURL string, ...) (conf oauth2.Config)
- func TransferDataAccessScopeCreator(collectionIDs []string) (scopes []string)
- type CommonTransfer
- type ConsentRequired
- type Delete
- type DeleteItem
- type Event
- type EventList
- type FatalError
- type FilterRule
- type GlobusClient
- func (g GlobusClient) IsClientSet() bool
- func (g GlobusClient) TransferCancelTaskByID(taskID string) (result Result, err error)
- func (c GlobusClient) TransferCopyFile(client *http.Client, sourceEndpoint string, sourceFile string, ...) (TransferResult, error)
- func (c GlobusClient) TransferFileList(sourceEndpoint string, sourcePath string, destEndpoint string, destPath string, ...) (TransferResult, error)
- func (c GlobusClient) TransferFolderSync(sourceEndpoint string, sourcePath string, destEndpoint string, destPath string, ...) (TransferResult, error)
- func (g GlobusClient) TransferGetTaskByID(taskID string) (task Task, err error)
- func (g GlobusClient) TransferGetTaskEventList(taskID string, offset uint, limit uint) (eventList EventList, err error)
- func (g GlobusClient) TransferGetTaskList(offset uint, limit uint) (taskList TaskList, err error)
- func (g GlobusClient) TransferGetTaskPauseInfo(taskID string) (info PauseInfoLimited, err error)
- func (g GlobusClient) TransferGetTaskSkippedErrors(taskID string, marker uint) (skips SkippedErrors, err error)
- func (g GlobusClient) TransferGetTaskSuccessfulTransfers(taskID string, marker uint) (transfers SuccessfulTransfers, err error)
- func (c GlobusClient) TransferPostTask(transfer Transfer) (result TransferResult, err error)
- func (g GlobusClient) TransferRemoveTaskByID(taskID string) (result Result, err error)
- type MarkerPaging
- type PauseInfoLimited
- type PauseRuleLimited
- type Result
- type SkippedError
- type SkippedErrors
- type SubmissionId
- type SuccessfulTransfer
- type SuccessfulTransfers
- type Task
- type TaskList
- type Transfer
- type TransferItem
- type TransferResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthGenerateOauthClientConfig ¶
func AuthGenerateOauthClientConfig(ctx context.Context, clientID string, clientSecret string, redirectURL string, scopes []string) (conf oauth2.Config)
This is a very basic function that returns an oauth2 config with the token url hard-coded to the one provided by Globus.
func TransferDataAccessScopeCreator ¶
creates a list of scopes to access data on the specified Globus endpoints
Types ¶
type CommonTransfer ¶
type CommonTransfer struct {
DataType string `json:"DATA_TYPE"` // = transfer OR delete
SubmissionId string `json:"submission_id"`
// optional fields
Label *string `json:"label,omitempty"`
NotifyOnSucceeded *bool `json:"notify_on_succeeded,omitempty"`
NotifyOnFailed *bool `json:"notify_on_failed,omitempty"`
NotifyOnInactive *bool `json:"notify_on_inactive,omitempty"`
SkipActivationCheck *bool `json:"skip_activation_check,omitempty"`
Deadline *string `json:"deadline,omitempty"`
StoreBasePathInfo *bool `json:"store_base_path_info,omitempty"`
}
type ConsentRequired ¶
type Delete ¶
type Delete struct {
CommonTransfer
Endpoint string `json:"endpoint"`
Data []DeleteItem
// optionals
Recursive *bool `json:"recursive,omitempty"` // default: false, required if any item is a directory
IgnoreMissing *bool `json:"ignore_missing,omitempty"` // default: false
InterpretGlobs *bool `json:"interpret_globs,omitempty"` // default: false
LocalUser *string `json:"local_user,omitempty"`
}
type DeleteItem ¶
type FatalError ¶
type FilterRule ¶
type GlobusClient ¶
type GlobusClient struct {
// contains filtered or unexported fields
}
func AuthCreateServiceClient ¶
func AuthCreateServiceClient(ctx context.Context, clientID string, clientSecret string, scopes []string) (client GlobusClient, err error)
Returns a two-legged (client credental) http client with oauth2 authentication. The function can fail if the token acquisition check fails.
func HttpClientToGlobusClient ¶
func HttpClientToGlobusClient(client *http.Client) GlobusClient
func (GlobusClient) IsClientSet ¶
func (g GlobusClient) IsClientSet() bool
func (GlobusClient) TransferCancelTaskByID ¶
func (g GlobusClient) TransferCancelTaskByID(taskID string) (result Result, err error)
cancels a task using its id
func (GlobusClient) TransferCopyFile ¶
func (c GlobusClient) TransferCopyFile(client *http.Client, sourceEndpoint string, sourceFile string, destEndpoint string, destFile string) (TransferResult, error)
func (GlobusClient) TransferFileList ¶
func (c GlobusClient) TransferFileList(sourceEndpoint string, sourcePath string, destEndpoint string, destPath string, fileList []string, isSymlink []bool, storeBasePath bool) (TransferResult, error)
func (GlobusClient) TransferFolderSync ¶
func (c GlobusClient) TransferFolderSync(sourceEndpoint string, sourcePath string, destEndpoint string, destPath string, storeBasePath bool) (TransferResult, error)
submits a transfer task to copy a folder recursively. NOTE: the transfer follows all default params (aside from recursivity)
func (GlobusClient) TransferGetTaskByID ¶
func (g GlobusClient) TransferGetTaskByID(taskID string) (task Task, err error)
fetches a specific transfer task from Globus Transfer API by its ID
func (GlobusClient) TransferGetTaskEventList ¶
func (g GlobusClient) TransferGetTaskEventList(taskID string, offset uint, limit uint) (eventList EventList, err error)
lists task's events NOTE: the history gets deleted after 30 days
func (GlobusClient) TransferGetTaskList ¶
func (g GlobusClient) TransferGetTaskList(offset uint, limit uint) (taskList TaskList, err error)
fetches a list of transfer tasks from Globus Transfer API NOTE: the results are paginated using "offset" and "limit"
func (GlobusClient) TransferGetTaskPauseInfo ¶
func (g GlobusClient) TransferGetTaskPauseInfo(taskID string) (info PauseInfoLimited, err error)
provides details about why a task is paused - includes pause rules on source and destination collections and per-task pause flags set by collection activity managers
func (GlobusClient) TransferGetTaskSkippedErrors ¶
func (g GlobusClient) TransferGetTaskSkippedErrors(taskID string, marker uint) (skips SkippedErrors, err error)
retrieve the list of paths that were skipped because of the skip_source_errors flag being set to true
func (GlobusClient) TransferGetTaskSuccessfulTransfers ¶
func (g GlobusClient) TransferGetTaskSuccessfulTransfers(taskID string, marker uint) (transfers SuccessfulTransfers, err error)
retrieve the list of successfully transfered files of a task
func (GlobusClient) TransferPostTask ¶
func (c GlobusClient) TransferPostTask(transfer Transfer) (result TransferResult, err error)
Submits a generic transfer request using a Transfer struct. This function doesn't check whether the transfer struct is valid. You don't need to set the submission id of the transfer, this function does that for you.
func (GlobusClient) TransferRemoveTaskByID ¶
func (g GlobusClient) TransferRemoveTaskByID(taskID string) (result Result, err error)
removes a globus task NOTE: this can be only used under specific conditions: task must be associated with a a high assurance collection, must be either SUCCEEDED or FAILED.
type MarkerPaging ¶
type PauseInfoLimited ¶
type PauseInfoLimited struct {
DataType string `json:"DATA_TYPE"`
PauseRules []PauseRuleLimited `json:"pause_rules"`
SourcePauseMessage *string `json:"source_pause_message,omitempty"`
DestinationPauseMessage *string `json:"destination_pause_message,omitempty"`
}
type PauseRuleLimited ¶
type PauseRuleLimited struct {
DataType string `json:"DATA_TYPE"`
Id string `json:"id"`
Message string `json:"message"`
StartTime string `json:"start_time"`
EndpointId string `json:"endpoint_id"`
EndpointDisplayName string `json:"endpoint_display_name"`
IdentityId *string `json:"identity_id,omitempty"`
ModifiedTime string `json:"modified_time"`
PauseLs bool `json:"pause_ls"`
PauseMkdir bool `json:"pause_mkdir"`
PauseSymlink bool `json:"pause_symlink"`
PauseRename bool `json:"pause_rename"`
PauseTaskDelete bool `json:"pause_task_delete"`
PauseTaskTransferWrite bool `json:"pause_task_transfer_write"`
PauseTaskTransferRead bool `json:"pause_task_transfer_read"`
}
func (*PauseRuleLimited) UnmarshalJSON ¶
func (pauseRule *PauseRuleLimited) UnmarshalJSON(data []byte) error
type SkippedError ¶
type SkippedError struct {
TransferItem // Recursive will always be null
ErrorCode string `json:"error_code"`
ErrorDetails string `json:"error_details"`
IsDirectory bool `json:"is_directory"`
IsSymlink bool `json:"is_symlink"`
IsDeleteDestinationExtra *bool `json:"is_delete_destination_extra,omitempty"`
}
type SkippedErrors ¶
type SkippedErrors struct {
DataType string `json:"DATA_TYPE"`
MarkerPaging
Data []SkippedError `json:"DATA"`
}
type SubmissionId ¶
type SuccessfulTransfer ¶
type SuccessfulTransfer struct {
DataType string `json:"DATA_TYPE"`
SourcePath string `json:"source_path"`
DestinationPath string `json:"destination_path"`
}
this could be represented by a TransferItem too, technically
type SuccessfulTransfers ¶
type SuccessfulTransfers struct {
DataType string `json:"DATA_TYPE"`
MarkerPaging
Data []SuccessfulTransfer `json:"DATA"`
}
type Task ¶
type Task struct {
DataType string `json:"DATA_TYPE"`
TaskId string `json:"task_id"`
Type string `json:"type"`
Status string `json:"status"`
FatalError *FatalError `json:"fatal_error,omitempty"`
Label string `json:"label"`
OwnerId string `json:"owner_id"`
RequestTime string `json:"request_time"` // ISO8601
CompletionTime *string `json:"completion_time,omitempty"` // null if hasn't finished
Deadline string `json:"deadline"`
SourceEndpointId string `json:"source_endpoint_id"`
SourceEndpointDisplayName string `json:"source_endpoint_display_name"`
DestinationEndpointId *string `json:"destination_endpoint_id,omitempty"` // null for delete tasks
DestinationEndpointDisplayName *string `json:"destination_endpoint_display_name,omitempty"`
SyncLevel *int `json:"sync_level,omitempty"`
EncryptData bool `json:"encrypt_data"`
VerifyChecksum bool `json:"verify_checksum"`
DeleteDestinationExtra bool `json:"delete_destination_extra"`
RecursiveSymlinks *string `json:"recursive_symlinks,omitempty"` // always null for delete tasks
PreserveTimestamp bool `json:"preserve_timestamp"`
SkipSourceErrors bool `json:"skip_source_errors"`
FailOnQuotaErrors bool `json:"fail_on_quota_errors"`
Command string `json:"command"`
HistoryDeleted bool `json:"history_deleted"`
Faults int `json:"faults"`
Files int `json:"files"` // no. of files affected by task (can grow w/ recursion)
Directories int `json:"directories"` // no. of directories affected by task (can grow w/ recursion)
Symlinks int `json:"symlinks"` // no. of *kept* symlinks
FilesSkipped *int `json:"files_skipped,omitempty"`
FilesTransferred int `json:"files_transferred"`
SubtasksTotal int `json:"subtasks_total"`
SubtasksPending int `json:"subtasks_pending"`
SubtasksRetrying int `json:"subtasks_retrying"`
SubtasksSucceeded int `json:"subtasks_succeeded"`
SubtasksExpired int `json:"subtasks_expired"`
SubtasksCanceled int `json:"subtasks_canceled"`
SubtasksFailed int `json:"subtasks_failed"`
SubtasksSkippedErrors int `json:"subtasks_skipped_errors"`
BytesTransferred int `json:"bytes_transferred"`
BytesChecksummed int `json:"bytes_checksummed"`
EffectiveBytesPerSecond int `json:"effective_bytes_per_second"`
NiceStatus *string `json:"nice_status,omitempty"` // "OK" or "Queued" -> task is fine, otherwise some error
NiceStatusShortDescription string `json:"nice_status_short_description"`
NiceStatusExpiresIn int `json:"nice_status_expires_in"`
CanceledByAdmin *string `json:"canceled_by_admin,omitempty"` // if the task was canceled by either collection's activity manager, otherwise null
CanceledByAdminMessage string `json:"canceled_by_admin_message"` // contains the message of cancelation set by activity manager
IsPaused bool `json:"is_paused"`
FilterRules *[]FilterRule `json:"filter_rules,omitempty"` // can be null
SourceLocalUser *string `json:"source_local_user,omitempty"`
SourceLocalUserStatus string `json:"source_local_user_status"`
DestinationLocalUser *string `json:"destination_local_user,omitempty"`
DestinationLocalUserStatus string `json:"destination_local_user_status"`
SourceBasePath *string `json:"source_base_path,omitempty"`
DestinationBasePath *string `json:"destination_base_path,omitempty"`
}
TODO: confirm that this works correctly with replies
type Transfer ¶
type Transfer struct {
CommonTransfer
SourceEndpoint string `json:"source_endpoint"`
DestinationEndpoint string `json:"destination_endpoint"`
Data []TransferItem `json:"DATA"`
// optionals
FilterRules *[]FilterRule `json:"filter_rules,omitempty"`
EncryptData *bool `json:"encrypt_data,omitempty"` // default: false
SyncLevel *int `json:"sync_level,omitempty"` //
VerifyChecksum *bool `json:"verify_checksum,omitempty"` // default: false
PreserveTimestamp *bool `json:"preserve_timestamp,omitempty"` // default: false
DeleteDestinationExtra *bool `json:"delete_destination_extra,omitempty"` // default: false
SkipSourceErrors *bool `json:"skip_source_errors,omitempty"` // default: ?
FailOnQuotaErrors *bool `json:"fail_on_quota_errors,omitempty"` // default: ?
SourceLocalUser *string `json:"source_local_user,omitempty"`
DestinationLocalUser *string `json:"destination_local_user,omitempty"`
}
type TransferItem ¶
type TransferItem struct {
DataType string `json:"DATA_TYPE"` // = "tranfer_item" OR "transfer_symlink_item"
SourcePath string `json:"source_path"`
DestinationPath string `json:"destination_path"`
// optionals (they don't apply to transfer_symlink_item!)
Recursive *bool `json:"recursive,omitempty"`
ExternalChecksum *string `json:"external_checksum,omitempty"`
ChecksumAlgorithm *string `json:"checksum_algorithm,omitempty"`
}