Qorus Integration Engine® Enterprise Edition 6.0.4_dev
Loading...
Searching...
No Matches
RemoteDevelopment::Client Class Reference

Remote development client class. More...

Public Member Methods

 constructor (string username, string password, *hash< auto > connection_options)
 Constructs RemoteDevelopment Client object. More...
 
 constructor (*hash< auto > connection_options)
 Constructs RemoteDevelopment Client object. More...
 
 setLog (code log)
 Sets log method that will be used in the RemoteDevelopment Client. More...
 
list< string > listFiles (string directory, bool truncate=False, int max_files=MAX_FILES, *string regex)
 Lists files from the given directory. More...
 
list< hash< auto > > createFileList (list< string > file_names, string directory="")
 Creates file list needed for deployment/release request from the list of file names. More...
 
list< hash< auto > > createFileListFromDirectory (string directory, bool truncate=False, int max_files=MAX_FILES, *string regex)
 Creates file list needed for deploy/release requests from the given directory. More...
 
string getUrlForRequest (Request request)
 Returns API URL of the given request. More...
 
*string obtainTokenIfNeeded (string username, string password)
 Returns a token using username and password if authentication is needed to connect to the Qorus. More...
 
hash< auto > waitUntilRequestIsFinished (Request request, timeout time, *reference< hash > info)
 Wait until remote development request is finished. Request must contain id. More...
 
hash< auto > post (Request request, timeout time=0s, *reference< hash > info)
 Post the given remote development request. WARN: the function will fill the id in the request. More...
 
hash< auto > del (Request request, *reference< hash > info)
 Delete the given remote development request. Request must contain id. More...
 
hash< auto > getStatus (Request request, *reference< hash > info)
 Gets status of the given remote development request. Request must contain id. More...
 

Detailed Description

Remote development client class.

Examples of how the class can be used: 1) Create Remote Development Client object:

RemoteDevelopment::Client client(); # use local qrest
# Use local qrest and token obtained using provided username and password:
RemoteDevelopment::Client client("username", "password");
# OR use custom URL
RemoteDevelopment::Client client({"url": "https://spongebob:8002"});
# OR use custom URL and token obtained using provided username and password:
RemoteDevelopment::Client client("username", "password", {"url": "https://spongebob:8002"});

2) Get the file list from directory:

list<auto> files = RemoteDevelopment::Client::createFileListFromDirectory(systemDir);
# OR providing list of file names (prefix with src/ directory)
list<auto> files = RemoteDevelopment::Client::createFileList(("foo.qfd", "bar.qfd"), "src/");
# OR providing list of file names (no prefix directory)
list<auto> files = RemoteDevelopment::Client::createFileList(("src/foo.qfd", "src/bar.qfd"));

3) Obtain token if needed (can be skipped):

string token = client.obtainTokenIfNeeded("admin", "admin");

3) Create the request:

DeployRequest request = new DeployRequest(files, "admin", token,
{"reload": True, "validate": True, "verbosity-level": 1});

4) Post the request asynchronously and wait:

hash<auto> post_response = client.post(request); # async
hash<auto> status_response = client.waitUntilRequestIsFinished(request, 10s); # wait
# OR post the request synchronously
hash<auto> status_response = client.post(request, 20s); # sync

Member Function Documentation

◆ constructor() [1/2]

RemoteDevelopment::Client::constructor ( *hash< auto >  connection_options)

Constructs RemoteDevelopment Client object.

Parameters
connection_optionsaccording to QorusSystemRestHelper constructor:
  • api_version: the REST API version (defaults to the latest version)
  • connect_timeout: the connect timeout value in milliseconds
  • timeout: the socket I/O timeout value in milliseconds
  • url: the target URL

◆ constructor() [2/2]

RemoteDevelopment::Client::constructor ( string  username,
string  password,
*hash< auto >  connection_options 
)

Constructs RemoteDevelopment Client object.

Parameters
username
password
connection_optionsaccording to QorusSystemRestHelper constructor:
  • api_version: the REST API version (defaults to the latest version)
  • connect_timeout: the connect timeout value in milliseconds
  • timeout: the socket I/O timeout value in milliseconds
  • url: the target URL

◆ createFileList()

list< hash< auto > > RemoteDevelopment::Client::createFileList ( list< string >  file_names,
string  directory = "" 
)

Creates file list needed for deployment/release request from the list of file names.

Parameters
file_nameslist of the file names.
directorycontaining needed files. Fill in case file names list doesn't contain path.
Returns
list of hashes containing file names and their content.

◆ createFileListFromDirectory()

list< hash< auto > > RemoteDevelopment::Client::createFileListFromDirectory ( string  directory,
bool  truncate = False,
int  max_files = MAX_FILES,
*string  regex 
)

Creates file list needed for deploy/release requests from the given directory.

Parameters
directorycontaining needed files.
truncateif True then truncate number of files to max_files param.
max_filesmaximum of files that should be taken from the directory (30 by default).
regexan optional regex for matching files.
Returns
list of hashes containing file names and their content.

◆ del()

hash< auto > RemoteDevelopment::Client::del ( Request  request,
*reference< hash >  info 
)

Delete the given remote development request. Request must contain id.

Parameters
requestobject reference to one of the supported types: DeployRequest, DeleteRequest, ReleaseRequest.
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "POST /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see DataSerializationOptions for possible values when used with the null REST schema validator
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see DataSerializationOptions for possible values when used with the null REST schema validator
Returns
hash containing cancel response.

◆ getStatus()

hash< auto > RemoteDevelopment::Client::getStatus ( Request  request,
*reference< hash >  info 
)

Gets status of the given remote development request. Request must contain id.

Parameters
requestobject reference to one of the supported types: DeployRequest, DeleteRequest, ReleaseRequest.
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "POST /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see DataSerializationOptions for possible values when used with the null REST schema validator
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see DataSerializationOptions for possible values when used with the null REST schema validator
Returns
hash containing the request status.

◆ getUrlForRequest()

string RemoteDevelopment::Client::getUrlForRequest ( Request  request)

Returns API URL of the given request.

Parameters
requestobject reference to one of the supported types: DeployRequest, DeleteRequest, ReleaseRequest, TestRequest.
Returns
string with a token if authentication is needed otherwise NOTHING.

◆ listFiles()

list< string > RemoteDevelopment::Client::listFiles ( string  directory,
bool  truncate = False,
int  max_files = MAX_FILES,
*string  regex 
)

Lists files from the given directory.

Parameters
directorycontaining needed files.
truncateif True then truncate number of files to max_files param.
max_filesmaximum number of files to be returned.
regexan optional regex for matching files.
Returns
list of file names.

◆ obtainTokenIfNeeded()

*string RemoteDevelopment::Client::obtainTokenIfNeeded ( string  username,
string  password 
)

Returns a token using username and password if authentication is needed to connect to the Qorus.

Parameters
username
password
Returns
string with a token if authentication is needed otherwise NOTHING

◆ post()

hash< auto > RemoteDevelopment::Client::post ( Request  request,
timeout  time = 0s,
*reference< hash >  info 
)

Post the given remote development request. WARN: the function will fill the id in the request.

Parameters
requestobject reference to one of the supported types: DeployRequest, DeleteRequest, ReleaseRequest.
timetimeout, = 0 by default. If time = 0 then the request is created asynchronously otherwise it will wait when request is finished or timeout expires.
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "POST /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see DataSerializationOptions for possible values when used with the null REST schema validator
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see DataSerializationOptions for possible values when used with the null REST schema validator
Returns
hash containing creation response from the Qorus in case time is set to 0, otherwise returns status of the finished request.
Exceptions
TIMEOUT-ERRORin case the request is not finished within the given timeout (only if timeout > 0).

◆ setLog()

RemoteDevelopment::Client::setLog ( code  log)

Sets log method that will be used in the RemoteDevelopment Client.

Parameters
logclosure that will be called when Client produces some logs

◆ waitUntilRequestIsFinished()

hash< auto > RemoteDevelopment::Client::waitUntilRequestIsFinished ( Request  request,
timeout  time,
*reference< hash >  info 
)

Wait until remote development request is finished. Request must contain id.

Parameters
requestobject reference to one of the supported types: DeployRequest, DeleteRequest, ReleaseRequest.
timein which the request should be finished if not exception is thrown.
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "POST /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see DataSerializationOptions for possible values when used with the null REST schema validator
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see DataSerializationOptions for possible values when used with the null REST schema validator
Returns
hash containing status of the finished request.
Exceptions
TIMEOUT-ERRORin case the request is not finished within the given timeout (only if timeout > 0).

The documentation for this class was generated from the following file: