helpers

package
v0.0.0-...-3b14662 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallCallback

func CallCallback(request Request, err string)

CallCallback notifies an external service that the FTP file transfer is complete

func SendFile

func SendFile(request Request)

SendFile actually sends a file via FTP

Types

type Request

type Request struct {
	// Required fields
	DestinationAddress   string `json:"destinationAddress"`   // Hostname to be sent the file
	DestinationDirectory string `json:"destinationDirectory"` // Path indicates where to store the file on the server
	FileURL              string `json:"fileURL"`              // The remote URL of the file to be downloaded and sent
	CallbackAddress      string `json:"callbackAddress"`      // Complete address to send the notification that the file transfer is complete

	// Optional Fields
	CallbackIdentifier string `json:"callbackIdentifier,omitempty"` // Optional value to be passed in so the requester can identify the host when it's sent back
	Timeout            int    `json:"timeout,omitempty"`            // Time in seconds to wait for timeout when trying to open an FTP connection (defaults to 30)
	UsernameFTP        string `json:"usernameFTP,omitempty"`        // Username to authenticate with the device (defaults to anonymous)
	PasswordFTP        string `json:"passwordFTP,omitempty"`        // Password to authenticate with the device (defaults to anonymous)

	// Fields not expected in request, will be filled by the service
	Filename       string
	SubmissionTime time.Time // Will be filled by the service to indicate when the file transfer began
	CompletionTime time.Time // Will be filled by the service to indicate when the file transfer ended or timed out
	Status         string    // "Timeout" or "Success"
	Error          string
}

Request represents an incoming request body passed via a RESTful POST

func DownloadFile

func DownloadFile(request Request) (Request, error)

DownloadFile downloads the file reference in the POST body and then sends the file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL