Documentation
¶
Overview ¶
Package link is the client core, it initialises all the targets to be search from the config and sets ups all the workers
Index ¶
Constants ¶
const ( UploadCommand = "Upload" StartCommand = "Start" AutoCommand = "Auto" HelpCommand = "help" TestCommand = "Test" SetConfigCommand = "SetConfig" GetConfigCommand = "GetConfig" Usage = `` /* 2416-byte string literal not displayed */ )
Commands
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInterface ¶
type ClientInterface interface {
// Start method will search the configured targets for files extracting the appropriate metadata before uploading
// them to TrueConnect
Start() string
// GetExitCode gets the exit code to report out to the operating system on completion of execution 0 = ok
GetExitCode() int
//used to do the final clean up after everything is done
Dispose()
}
ClientInterface is an interface that defines the publicly accessible methods of the true connect client
type Configuration ¶
type Configuration struct {
// when set to true the client will run as a service, this is overridden when the client is executed with the
// command AUTO
RunAsService bool `json:"runasservice"`
// This is the client id, this is also present in the file name (user name)
ClientID string `json:"clientid"`
// password
Secret string `json:"secret"`
// The URL for the OAUTH =2 service that provides the bearer token
TokenURL string `json:"tokenurl"`
// The TrueConnect endpoint url to connect to
Endpoint string `json:"endpoint"`
// The collection of targets to search for files to upload
Targets []Target `json:"targets"`
// The maximum number of concurrent uploads allowed
ConcurrentUploads int `json:"concurrentuploads"`
// contains filtered or unexported fields
}
Configuration is the root element of the configuration for the TrueConnect client each client_id (user) must use there own configuration. This configuration controls what files are looked for and to which tenant they should be uploaded against
type PathEncodedMetaDataTag ¶
type PathEncodedMetaDataTag struct {
// the name of the metadata tag
Tag string `json:"tag"`
// The regular expression used to define a group that will contain the value of the metadata tag
Match string `json:"match"`
}
PathEncodedMetaDataTag configuration used to describe a metadata tag whose value can be found in the file path
type StaticMetaData ¶
type StaticMetaData struct {
// the name of the metadata tag
Tag string `json:"tag"`
// the vale to assign this tag
Value string `json:"value"`
}
StaticMetaData that will accompany all uploads on associated target
type StatusRecordEntry ¶
type StatusRecordEntry struct {
// The time at which the state changed
Time time.Time
// The system whose state changed
System string
// The operation or action that caused the change
Operation string
// The effect of the change
Status string
// Individual item or instance of operation that was changed
ContextID string
// extra information relating to the change
Comments string
}
StatusRecordEntry is used to record the change in state in the application and is used to record such things as the completion of a file upload
func StatusRecordEntryFromLine ¶
func StatusRecordEntryFromLine(parts []string) StatusRecordEntry
StatusRecordEntryFromLine will take the parts of a line of text produced by a CSV reader that parses status entries from TrueConnect-Link and turn them into a StatusRecordEntry structure
func (*StatusRecordEntry) StatusRecordToLine ¶
func (recordEntry *StatusRecordEntry) StatusRecordToLine() []string
StatusRecordToLine will take a StatusRecordEntry and turn it to a CSV line
type Target ¶
type Target struct {
// The name of the target, this is allow the target to be referred to by name from the command line
Name string `json:"name"`
// This value set whether the target will be searched whilst in Auto mode
Active bool `json:"active,bool"`
// The tenant to assign any files uploaded from this target location
Tenant string `json:"tenant"`
// The path to search for files in
Location string `json:"location"`
// When set the location directory and all sub directories will be set
Recursive bool `json:"recursive"`
// A regular expression used to describe which file to include for upload
Match string `json:"match"`
// The data type of the file that match the regular expression in this target location
DataType string `json:"datatype"`
// The data format of the file that match the regular expression in this target location
DataFormat string `json:"dataformat"`
// A list of metadata tag that can be extracted from the file path
PathEncodedMetaDataTags []PathEncodedMetaDataTag `json:"pathencodedmetadatatags"`
// a list of static meta data values
StaticTags []StaticMetaData `json:"statictags"`
// The number of seconds between the time the last file found was uploaded and the next time we should check for
// files that haven't been uploaded yet
PollInterval int `json:"pollinterval"`
// Command or script to be run on successful upload of the file, the full path of the file uploaded will be added to the
// command as the first argument after the command wrapped in double quoates. The file storage reference will be
// added as the second argument.
OnSuccess string `json:"onsuccess"`
}
Target is the configuration used to specify a location to search and what data to find there