Documentation
¶
Index ¶
- Constants
- Variables
- func CombinePath(name ...string) string
- func Critical(err error)
- func DateString(input time.Time) string
- func DefaultPleaseWait()
- func Dequote(input *string)
- func Err(input ...interface{})
- func ErrCount() uint32
- func HumanSize(bytes int64) string
- func IsAPIError(err error, code ...string) bool
- func IsBlank(input ...string) bool
- func KVLiteStore(input Database) *kvLiteStore
- func MD5Sum(filename string) (sum string, err error)
- func MkDir(name ...string) (err error)
- func RandBytes(sz int) []byte
- func ReadKWTime(input string) (time.Time, error)
- func Rename(oldpath, newpath string) error
- func SetParams(vars ...interface{}) (output []interface{})
- func SplitPath(path string) (folder_path []string)
- func StringDate(input string) (output time.Time, err error)
- func WriteKWTime(input time.Time) string
- type APIClient
- func (s APIClient) BackoffTimer(retry uint)
- func (s APIClient) Call(username string, api_req APIRequest) (err error)
- func (K *APIClient) Chunks(total_size int64) (total_chunks int64)
- func (K *APIClient) ClientSecret(client_secret_key string)
- func (K APIClient) DecodeJSON(resp *http.Response, output interface{}) (err error)
- func (s APIClient) Do(req *http.Request) (resp *http.Response, err error)
- func (S *APIClient) Download(req *http.Request, reqs ...*http.Request) ReadSeekCloser
- func (K APIClient) GetClientSecret() string
- func (K APIClient) GetSignature() string
- func (K *APIClient) GetTransferLimit() int
- func (C APIClient) NewAPIError() *apiError
- func (s APIClient) NewRequest(username, method, path string) (req *http.Request, err error)
- func (s APIClient) PageCall(username string, req APIRequest, offset, limit int) (err error)
- func (K *APIClient) SetLimiter(max_calls int)
- func (K *APIClient) SetTransferLimiter(max_transfers int)
- func (K *APIClient) Signature(signature_key string)
- type APIError
- type APIRequest
- type Auth
- type BitFlag
- type ConfigStore
- type DBase
- func (d DBase) Close()
- func (d DBase) CountKeys(table string) int
- func (d DBase) CryptSet(table, key string, value interface{})
- func (d DBase) Drop(table string)
- func (d DBase) Get(table, key string, output interface{}) bool
- func (d DBase) Keys(table string) []string
- func (d DBase) Set(table, key string, value interface{})
- func (d *DBase) Shared(table string) SubStore
- func (d *DBase) Sub(prefix string) SubStore
- func (d DBase) Table(table string) Table
- func (d DBase) Tables() []string
- func (d DBase) Unset(table, key string)
- type Database
- type Error
- type FileInfo
- type FlagSet
- type GetUsers
- type KWAPI
- type KWProfile
- type KWSession
- func (s KWSession) Admin() kw_rest_admin
- func (K KWSession) Call(api_req APIRequest) (err error)
- func (s KWSession) DataCall(req APIRequest, offset, limit int) (err error)
- func (s KWSession) File(file_id int) kw_rest_file
- func (s KWSession) FileDownload(file *KiteObject) (ReadSeekCloser, error)
- func (s KWSession) Folder(folder_id int) kw_rest_folder
- func (s KWSession) MyUser() (user KiteUser, err error)
- func (K KWSession) Profile(profile_id int) kw_profile
- func (T KWSession) RunTask(input Task, db Database, report *TaskReport, args ...map[string]interface{}) (err error)
- func (s KWSession) TopFolders(params ...interface{}) (folders []KiteObject, err error)
- func (s KWSession) Upload(filename string, upload_id int, source_reader ReadSeekCloser) (*KiteObject, error)
- type KiteBrokerTask
- func (T *KiteBrokerTask) KiteBrokerTask_report_summary(errors uint32)
- func (T *KiteBrokerTask) KiteBrokerTask_set_db(DB SubStore)
- func (T *KiteBrokerTask) KiteBrokerTask_set_flags(Flags FlagSet)
- func (T *KiteBrokerTask) KiteBrokerTask_set_report(input *TaskReport)
- func (T *KiteBrokerTask) KiteBrokerTask_set_session(user KWSession)
- type KiteLinks
- type KiteMember
- type KiteObject
- type KitePermission
- type KiteUser
- type LimitGroup
- type PostForm
- type PostJSON
- type Query
- type ReadSeekCloser
- type SubStore
- func (d SubStore) CountKeys(table string) int
- func (d SubStore) CryptSet(table, key string, value interface{})
- func (d SubStore) Drop(table string)
- func (d SubStore) Get(table, key string, output interface{}) bool
- func (d SubStore) Keys(table string) []string
- func (d SubStore) Set(table, key string, value interface{})
- func (d SubStore) Shared(table string) SubStore
- func (d SubStore) Sub(prefix string) SubStore
- func (d SubStore) Table(table string) Table
- func (d SubStore) Tables() []string
- func (d SubStore) Unset(table, key string)
- type Table
- type Tally
- type Task
- type TaskArgs
- type TaskReport
- type TokenStore
Constants ¶
const ( NONE = "" SLASH = string(os.PathSeparator) )
Variables ¶
var ( Log = nfo.Log Fatal = nfo.Fatal Notice = nfo.Notice Flash = nfo.Flash Stdout = nfo.Stdout Warn = nfo.Warn Defer = nfo.Defer Debug = nfo.Debug Exit = nfo.Exit PleaseWait = nfo.PleaseWait Stderr = nfo.Stderr ProgressBar = nfo.ProgressBar Path = filepath.Clean TransferCounter = nfo.TransferCounter NewLimitGroup = xsync.NewLimitGroup FormatPath = filepath.FromSlash GetPath = filepath.ToSlash Info = nfo.Aux )
Import from go-nfo.
var ErrNoUploadID = errors.New("Upload ID not found.")
var ErrNotFound = errors.New("Requested item not found.")
var ErrUploadNoResp = errors.New("Unexpected empty resposne from server.")
var SetPath = fmt.Sprintf
SetPath shortcut.
Functions ¶
func CombinePath ¶
func DateString ¶
Create standard date YY-MM-DD out of time.Time.
func DefaultPleaseWait ¶
func DefaultPleaseWait()
Returns please wait prompt back to default setting.
func IsAPIError ¶
Search for KWAPIErrorCode, if multiple codes are given return true if we find one.
func KVLiteStore ¶
func KVLiteStore(input Database) *kvLiteStore
Wraps KVLite Databse as a auth token store.
func SetParams ¶
func SetParams(vars ...interface{}) (output []interface{})
Creates Param for API post
func StringDate ¶
Converts string to date.
Types ¶
type APIClient ¶
type APIClient struct { Server string // kiteworks host name. ApplicationID string // Application ID set for kiteworks custom app. RedirectURI string // Redirect URI for kiteworks custom app. AgentString string // Agent-String header for calls to kiteworks. VerifySSL bool // Verify certificate for connections. ProxyURI string // Proxy for outgoing https requests. Snoop bool // Flag to snoop API calls RequestTimeout time.Duration // Timeout for request to be answered from kiteworks server. ConnectTimeout time.Duration // Timeout for TLS connection to kiteworks server. MaxChunkSize int64 // Max Upload Chunksize in bytes, min = 1M, max = 68M Retries uint // Max retries on a failed call TokenStore TokenStore // TokenStore for reading and writing auth tokens securely. NewToken func(username string) (*Auth, error) // Provides new access_token. ErrorScanner func(body []byte) APIError // Reads body of response and interprets any errors. RetryErrorCodes []string // Error codes ("ERR_INTERNAL_SERVER_ERROR"), that should induce a retry. (will automatically try TokenErrorCodes as well) TokenErrorCodes []string // Error codes ("ERR_INVALID_GRANT"), that should indicate a problem with the current access token. // contains filtered or unexported fields }
func (APIClient) BackoffTimer ¶
Backs off subsequent attempts generating a pause between requests.
func (APIClient) Call ¶
func (s APIClient) Call(username string, api_req APIRequest) (err error)
kiteworks API Call Wrapper
func (*APIClient) ClientSecret ¶
Sets client secret key.
func (APIClient) DecodeJSON ¶
Decodes JSON response body to provided interface.
func (APIClient) GetClientSecret ¶
func (APIClient) GetSignature ¶
func (*APIClient) GetTransferLimit ¶
func (APIClient) NewAPIError ¶
func (C APIClient) NewAPIError() *apiError
func (APIClient) NewRequest ¶
New API Client Request.
func (APIClient) PageCall ¶
func (s APIClient) PageCall(username string, req APIRequest, offset, limit int) (err error)
Call handler which allows for easier getting of multiple-object arrays. An offset of -1 will provide all results, any positive offset will only return the requested results.
func (*APIClient) SetLimiter ¶
Configures maximum number of simultaneous api calls.
func (*APIClient) SetTransferLimiter ¶
Configures maximum number of simultaneous file transfers.
type APIRequest ¶
type APIRequest struct { Version int Header http.Header Method string Path string Params []interface{} Output interface{} }
APIRequest model
type Auth ¶
type Auth struct { AccessToken string `json:"access_token"` Scope string `json:"scope"` RefreshToken string `json:"refresh_token"` Expires int64 `json:"expires_in"` }
Auth token.
type ConfigStore ¶
type DBase ¶
Wrapper around go-kvlite.
type Database ¶
type Database interface { Sub(prefix string) SubStore Drop(table string) CryptSet(table, key string, value interface{}) Set(table, key string, value interface{}) Unset(table, key string) Get(table, key string, output interface{}) bool Keys(table string) []string CountKeys(table string) int Tables() []string Table(table string) Table }
type KWAPI ¶
type KWAPI struct {
*APIClient
}
KWAPI Wrapper for kiteworks.
func (*KWAPI) Authenticate ¶
Authenticate with server.
type KWSession ¶
kiteworks Session.
func (KWSession) Call ¶
func (K KWSession) Call(api_req APIRequest) (err error)
Wrapper around Call to provide username.
func (KWSession) DataCall ¶
func (s KWSession) DataCall(req APIRequest, offset, limit int) (err error)
Call handler which allows for easier getting of multiple-object arrays. An offset of -1 will provide all results, any positive offset will only return the requested results.
func (KWSession) FileDownload ¶
func (s KWSession) FileDownload(file *KiteObject) (ReadSeekCloser, error)
Downloads a file to a specific path
func (KWSession) RunTask ¶
func (T KWSession) RunTask(input Task, db Database, report *TaskReport, args ...map[string]interface{}) (err error)
Allows a KitebrokerTask to launch another KiteBrokerTask.
func (KWSession) TopFolders ¶
func (s KWSession) TopFolders(params ...interface{}) (folders []KiteObject, err error)
Get list of all top folders
func (KWSession) Upload ¶
func (s KWSession) Upload(filename string, upload_id int, source_reader ReadSeekCloser) (*KiteObject, error)
Uploads file from specific local path, uploads in chunks, allows resume.
type KiteBrokerTask ¶
type KiteBrokerTask struct { Flags FlagSet DB SubStore Report *TaskReport KW KWSession }
Required for each task object.
func (*KiteBrokerTask) KiteBrokerTask_report_summary ¶
func (T *KiteBrokerTask) KiteBrokerTask_report_summary(errors uint32)
Provides summary of the task after completion.
func (*KiteBrokerTask) KiteBrokerTask_set_db ¶
func (T *KiteBrokerTask) KiteBrokerTask_set_db(DB SubStore)
Initializes the task's database
func (*KiteBrokerTask) KiteBrokerTask_set_flags ¶
func (T *KiteBrokerTask) KiteBrokerTask_set_flags(Flags FlagSet)
Sets the flags for the task.
func (*KiteBrokerTask) KiteBrokerTask_set_report ¶
func (T *KiteBrokerTask) KiteBrokerTask_set_report(input *TaskReport)
Sets a report for the task.
func (*KiteBrokerTask) KiteBrokerTask_set_session ¶
func (T *KiteBrokerTask) KiteBrokerTask_set_session(user KWSession)
Sets the kw api session for the task
type KiteLinks ¶
type KiteLinks struct { Relationship string `json:"rel"` Entity string `json:"entity"` ID int `json:"id"` URL string `json:"href"` }
Kiteworks Links Data
type KiteMember ¶
type KiteMember struct { ID int `json:"objectId"` RoleID int `json:"roleId` User KiteUser `json:"user"` Role KitePermission `json:"role"` }
type KiteObject ¶
type KiteObject struct { Type string `json:"type"` Status string `json:"status"` ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Created string `json:"created"` Modified string `json:"modified"` ClientCreated string `json:"clientCreated"` ClientModified string `json:"clientModified"` Deleted bool `json:"deleted"` PermDeleted bool `json:"permDeleted"` Expire interface{} `json:"expire"` Path string `json:"path"` ParentID int `json:"parentId"` UserID int `json:"userId"` Permalink string `json:"permalink"` Secure bool `json:"secure"` LockUser int `json:"lockUser"` Fingerprint string `json:"fingerprint"` ProfileID int `json:"typeID` Size int64 `json:"size"` Mime string `json:"mime"` AVStatus string `json:"avStatus"` DLPStatus string `json:"dlpStatus"` AdminQuarantineStatus string `json:"adminQuarantineStatus` Quarantined bool `json:"quarantined"` DLPLocked bool `json:"dlpLocked"` FileLifetime int `json:"fileLifetime"` MailID int `json:"mail_id"` Links []KiteLinks `json:"links"` CurrentUserRole KitePermission `json:"currentUserRole"` }
KiteFile/Folder/Attachment
func (*KiteObject) Expiry ¶
func (K *KiteObject) Expiry() time.Time
Returns the Expiration in time.Time.
type KitePermission ¶
type KitePermission struct { ID int `json:"id"` Name string `json:"name"` Rank int `json:"rank"` Modifiable bool `json:"modifiable"` Disabled bool `json:"disabled"` }
Permission information
type KiteUser ¶
type KiteUser struct { ID int `json:"id"` Active bool `json:"active"` Deactivated bool `json:"deactivated"` Suspended bool `json:"suspended"` BaseDirID int `json:"basedirId"` Deleted bool `json:"deleted"` Email string `json:"email"` MyDirID int `json:"mydirId"` Name string `json:"name"` SyncDirID int `json:"syncdirId"` UserTypeID int `json:"userTypeId"` Verified bool `json:"verified"` Internal bool `json:"internal"` }
Kiteworks User Data
type LimitGroup ¶
type LimitGroup = xsync.LimitGroup
type ReadSeekCloser ¶
type ReadSeekCloser = nfo.ReadSeekCloser
type SubStore ¶
type SubStore struct {
// contains filtered or unexported fields
}
SubStore is a TaskStore, a database with a prefix in the table.
type Task ¶
type Task interface { New() Task Name() string Desc() string Init() error Main() error KiteBrokerTask_set_flags(Flags FlagSet) KiteBrokerTask_set_db(DB SubStore) KiteBrokerTask_set_report(*TaskReport) KiteBrokerTask_set_session(user KWSession) KiteBrokerTask_report_summary(error uint32) }
Task Interface
type TaskReport ¶
type TaskReport struct {
// contains filtered or unexported fields
}
TraskReport
func NewTaskReport ¶
func NewTaskReport(name string, file string, flags *FlagSet) *TaskReport
Create New Task Report.