Shellbox
Library and server for containerized shell execution
Loading...
Searching...
No Matches
Shellbox\Client Class Reference

A generic client which executes actions on the Shellbox server. More...

+ Inheritance diagram for Shellbox\Client:

Public Member Functions

 __construct (ClientInterface $httpClient, UriInterface $uri, $key)
 
 setLogger (LoggerInterface $logger)
 
 call ( $routeName, $functionName, $params=[], $options=[])
 
 sendRequest ( $path, $parts, $outputFiles=[], $outputGlobs=[])
 Send an arbitrary request to the server.
 

Detailed Description

A generic client which executes actions on the Shellbox server.

Constructor & Destructor Documentation

◆ __construct()

Shellbox\Client::__construct ( ClientInterface $httpClient,
UriInterface $uri,
$key )
Parameters
ClientInterface$httpClientAn object which requests an HTTP resource. It is permissible to throw an exception for propagation back to the caller. However, a successfully received response with a status code of >=400 should ideally be returned to Shellbox as a ResponseInterface, so that Shellbox can parse and rethrow its own error messages. With Guzzle this could be achieved by passing setting RequestOptions::HTTP_ERROR option to false when creating the client.
UriInterface$uriThe base URI of the server
string$keyThe key for HMAC authentication

Member Function Documentation

◆ sendRequest()

Shellbox\Client::sendRequest ( $path,
$parts,
$outputFiles = [],
$outputGlobs = [] )

Send an arbitrary request to the server.

Parameters
string$pathThe URL path relative to the server's base URL
array$partsAn array of multipart parts to send, in the format specified by MultipartStream. Each part is an associative array which for our purposes may contain:
  • "name": The part name. Required but ignored when there is a Content-Disposition header.
  • "contents": Here always a StreamInterface or string
  • "headers": An associative array of part headers.
OutputFile[]$outputFilesOutput files. The objects will have their contents populated with data received from the server.
OutputGlob[]$outputGlobsOutput globs. The objects will have be populated with data received from the server.
Returns
array An associative array of output data
Exceptions
ShellboxError

◆ setLogger()

Shellbox\Client::setLogger ( LoggerInterface $logger)
Parameters
LoggerInterface$logger

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