Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Antfarm

Expose Antfarm.

Hierarchy

  • Antfarm

Index

Constructors

constructor

Properties

Protected e

Methods

createAutoFolderNest

  • Factory method which returns an AutoFolderNest. If the auto managed directory does not exist, it is created.

    Parameters

    • hierarchy: string | string[]

      Path of the folder as a string or an array of strings as _path segments.

    Returns AutoFolderNest

    Example

    af.createAutoFolderNest("outfolder")
    // /Users/dominick/My Automanaged Directory/outfolder
    

    Example

    af.createAutoFolderNest(["proofing", "others"])
    // /Users/dominick/My Automanaged Directory/proofing/others
    

createFolderNest

  • createFolderNest(path?: string, allowCreate?: boolean): FolderNest
  • Factory method which returns a FolderNest.

    Parameters

    • Optional path: string

      Path of the folder.

    • Default value allowCreate: boolean = false

      Optional boolean flag to allow creation of folder if it does not exist.

    Returns FolderNest

    Example

    var out_folder = af.createFolderNest("/Users/dominick/Desktop/My Folder/");
    

createFtpNest

  • createFtpNest(host: string, port?: number, username?: string, password?: string, checkEvery?: number): FtpNest
  • Factory method which returns an FtpNest.

    Parameters

    • host: string

      Hostname or IP address of the FTP server.

    • Default value port: number = 21

      Port number of the FTP server.

    • Default value username: string = ""

      FTP account username.

    • Default value password: string = ""

      FTP account password.

    • Default value checkEvery: number = 10

      Frequency of re-checking FTP in minutes.

    Returns FtpNest

    Example

    // Check FTP directory every 2 minutes
    var my_ftp = af.createFtpNest("ftp.example.com", 21, "", "", 2);
    

createS3Nest

  • createS3Nest(bucket: string, keyPrefix?: string, checkEvery?: number, allowCreation?: boolean): S3Nest
  • Factory method to create and return an S3 nest.

    Parameters

    • bucket: string
    • Optional keyPrefix: string
    • Default value checkEvery: number = 5
    • Default value allowCreation: boolean = false

    Returns S3Nest

    var bucket = af.createS3Nest("my-bucket-_name", "", 1, true);
    

createTunnel

  • createTunnel(name: any): Tunnel

createWebhookNest

  • createWebhookNest(path: string | string[], httpMethod?: string, handleRequest?: any): WebhookNest
  • Factory method which returns a WebhookNest.

    Parameters

    • path: string | string[]

      The _path which is generated in the webhook's route. You can supply a string or array of strings.

    • Default value httpMethod: string = "all"

      HTTP method for this webhook. Choose "all" for any HTTP method.

    • Optional handleRequest: any

      Optional callback function to handle the request, for sending a custom response.

    Returns WebhookNest

    Example

    var webhook = af.createWebhookNest(["proof", "create"], "post");
    

    Example returning custom response

    var webhook = af.createWebhookNest(["proof", "create"], "post", function(req, res, job, nest){
        res.setHeader("Content-Type", "application/json; charset=utf-8");
        res.end(JSON.stringify({
             job_name: job.getName(),
             job_id: job.getId(),
             message: "Proof created!"
        }));
    });
    

loadDir

  • loadDir(directory: string): void
  • Load an entire directory of workflow modules.

    Parameters

    • directory: string

      Path to the workflow modules.

      Example

      af.loadDir("./workflows");
      

    Returns void

log

  • log(type: number, message: string, actor?: any, instances?: Array<any>): void
  • Log messages into the antfarm logger.

    Parameters

    • type: number

      The log level. 0 = debug, 1 = info, 2 = warning, 3 = error

    • message: string

      Log message.

    • Optional actor: any

      Instance which triggers the action being logged.

    • Default value instances: Array<any> = []

      Array of of other involved instances.

      Example

      job.e.log(1, `Transferred to Tunnel "${tunnel.getName()}".`, job, [oldTunnel]);
      

    Returns void

version

  • version(): string

Generated using TypeDoc