Flint provides out-of-the-box or ready to use workflows for File Operations. Here are the details of workflows/Flintbits for File operations -

Flintbox nameLocationSSH Flintbits
flint-utilhttps://github.com/getflint/flint-util.gitflint-util > file > operation

Available Flintbits

Perform all standard application operations available through the File, Some of them are listed below:

File available Flintbits

  • append.rb
  • read.rb
  • list.rb
  • delete.rb
  • write.rb

Append

To Append some content to the file.

Input and output JSON for the Append operation

This section illustrates the Flintbit Input and output for Append operation.

Sample Input JSON for the Append operation
{
 "connector_name" : "file",
 "file" : "/home/anurag/abhiiii.txt",  					             
 "data" : "exec"                                                          
}

Flintbit input elements for the Append operation
ParameterDescriptionrequired
connector_nameName of the File Connector to be configured.true
fileFull Path of a filetrue
dataData to be append in filetrue
Sample JSON output for the Append operations
{
  "meta": {
    "job-id": "job-49b7d065-e444-47c8-9c64-082e29b04093",
    "exit-code": 0,
    "context": "flint-util:file:operation:append.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469613497220,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "content": "Anurag",
    "file-path": "/home/anurag/abhiiii.txt"
  }
}

 

Read 

To Read a file from the system.

Input and output JSON for the Read operation

This section illustrates the Flintbit Input and output for Read operation.

Sample Input JSON for the  Read operation
{
 "connector_name" : "file",	
 "file": "/home/anurag/abhiiii.txt"
}

 

Flintbit input elements for the Read operation
ParameterDescriptionRequired
connector_nameName of the File Connector to be configured.true
fileFull Path of a filetrue
Sample JSON output for the Read operation
{
  "meta": {
    "job-id": "job-608dde36-1cf7-460d-8e50-6689c8518af7",
    "exit-code": 0,
    "context": "flint-util:file:operation:read.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469613410371,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "content": "execexec11111exec11111",
    "file-path": "/home/anurag/abhiiii.txt"
  }
}

 

List

To List files and folders in a directory

Input and output JSON for List operation

This section illustrates the Flintbit Input and output for List operation.

Sample Input JSON for the List operation
{
 "connector_name" : "file",	
 "file": "/home/anurag/Backup"
}
 
Flintbit input elements for the List operation
ParameterDescriptionRequired
connector_nameName of the File Connector to be configured.true
fileFull Path of a filetrue
Sample JSON output for the List operation
{
  "meta": {
    "job-id": "job-d515006f-2f1b-4d06-9a30-b38f91717498",
    "exit-code": 0,
    "context": "flint-util:file:operation:list.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469613726165,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "files": [
      "servicedeskplus~",
      "Pendrive.tar.gz",
      "Anu.class",
      "servicedeskplus",
      "flint-manageenginesdp-connector-0.31.0.0-all.jar",
      "flint-manageenginesdp-connector-1.1.0.0-all.jar",
      "Anu.java"
    ],
    "file-path": "/home/anurag/Backup"
  }
}

Delete

To Delete a file

Input and output JSON for Delete operation

This section illustrates the Flintbit Input and output for Delete operation.

Sample Input JSON for the Delete operation
{
 "connector_name" : "file",	
 "file": "/home/anurag/abhiiii.txt"
}
 
Flintbit input elements for the Delete operation
ParameterDescriptionRequired
connector_nameName of the File Connector to be configured.true
fileFull Path of a filetrue
Sample JSON output for the Delete operation
{
  "meta": {
    "job-id": "job-20c0112f-4ec9-4c08-bcda-2d7d6bb5b485",
    "exit-code": 0,
    "context": "flint-util:file:operation:delete.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469613832828,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "result": "success"
  }
}

Write

To Write/create new file

Input and output JSON for Write operation

This section illustrates the Flintbit Input and output for Write operation.

Sample Input JSON for the Write operation
 {
 "connector_name" : "file",
 "file" : "/home/anurag/abhiiii.txt",  					             
 "data" : "Creating New File"                                                          
}
 
Flintbit input elements for the Delete operation
ParameterDescriptionRequired
connector_nameName of the File Connector to be configured.true
fileFull Path of a filetrue
dataData to be insert in filefalse
Sample JSON output for the Write operation
{
  "meta": {
    "job-id": "job-c0abb93c-e59d-4702-ab89-aa56854accef",
    "exit-code": 0,
    "context": "flint-util:file:operation:write.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469613920904,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "content": "Creating New File",
    "file-path": "/home/anurag/abhiiii.txt"
  }
}

On this page: