libschauer  0.0.1
Qt based library to access the Docker HTTP API.
Properties | Public Member Functions | Signals | List of all members
Schauer::CreateExecInstanceJob Class Reference

Create an execution instance. More...

#include <Schauer/CreateExecInstanceJob>

Inheritance diagram for Schauer::CreateExecInstanceJob:
Inheritance graph
[legend]

Properties

bool attachStderr
 Set this to true to attach to stderr of the exec command. More...
 
bool attachStdin
 Set this to true to attach to stdin of the exec command. More...
 
bool attachStdout
 Set this to true to attach to stdout of the exec command. More...
 
QStringList cmd
 Sets the command and its arguments to execute. More...
 
QString detachKeys
 This property overrides the key sequence for detaching a container. More...
 
QStringList env
 Sets the environment variabels used when executing the command. More...
 
QString id
 ID or name of the container to exectue the command in. More...
 
bool privileged
 Set this to true to run the exec process with exended privileges. More...
 
bool tty
 This property holds whether a pseudo-TTY should be allocated. More...
 
QString user
 This property holds the user, and optionally, group to run the exec process inside the container. More...
 
QString workingDir
 This property holds the working directoy for the exec process inside the container. More...
 
- Properties inherited from Schauer::Job
Schauer::AbstractConfiguration configuration
 Pointer to an object providing configuration data. More...
 
- Properties inherited from Schauer::SJob
Schauer::SJob::Capabilities capabilities
 Capabilities of this job. More...
 
int error
 Error code. More...
 
QString errorString
 Human-readable error message. More...
 
QString errorText
 Additional error text. More...
 
ulong percent
 Overall progress of the job. More...
 

Public Member Functions

 CreateExecInstanceJob (QObject *parent=nullptr)
 Constructs a new CreateExecInstanceJob with the given parent. More...
 
 ~CreateExecInstanceJob () override
 
void addEnv (const QString &env)
 Adds a single key-value-pair to the list of environment variables. More...
 
void addEnv (const QString &key, const QString &value)
 Adds key and value as pair to the list of environment variables. More...
 
bool attachStderr () const
 Getter function for the attachStderr property. More...
 
bool attachStdin () const
 Getter function for the attachStdin property. More...
 
bool attachStdout () const
 Getter function for the attachStdout property. More...
 
QStringList cmd () const
 Getter function for the cmd property. More...
 
QString detachKeys () const
 Getter function for the detachKeys property. More...
 
QStringList env () const
 Getter function for the tty property. More...
 
QString id () const
 Getter function for the id property. More...
 
bool privileged () const
 Getter function for the privileged property. More...
 
void removeEnv (const QString &env)
 Removes env from the list of environment variables. More...
 
void setAttachStderr (bool attachStderr)
 Setter function for the attachStderr property. More...
 
void setAttachStdin (bool attachStdin)
 Setter function for the attachStdin property. More...
 
void setAttachStdout (bool attachStdout)
 Setter function for the attachStdout property. More...
 
void setCmd (const QStringList &cmd)
 Setter function for the cmd property. More...
 
void setDetachKeys (const QString &detachKeys)
 Setter function for the detachKeys property. More...
 
void setEnv (const QStringList &env)
 Setter function for the tty property. More...
 
void setId (const QString &id)
 Setter function for the id property. More...
 
void setPrivileged (bool privileged)
 Setter function for the privileged property. More...
 
void setTty (bool tty)
 Setter function for the tty property. More...
 
void setUser (const QString &user)
 Setter function for the user property. More...
 
void setWorkingDir (const QString &workingDir)
 Setter function for the workingDir property. More...
 
void start () override
 Start creating an execution instance asynchronously. More...
 
bool tty () const
 Getter function for the tty property. More...
 
QString user () const
 Getter function for the user property. More...
 
QString workingDir () const
 Getter function for the workingDir property. More...
 
- Public Member Functions inherited from Schauer::Job
 ~Job () override
 Destroys the Job object. More...
 
AbstractConfigurationconfiguration () const
 Getter function for the configuraion property. More...
 
QString errorString () const override
 Returns a human readable and translated error string. More...
 
QJsonDocument replyData () const
 Returns the API reply data after successful request. More...
 
void setConfiguration (AbstractConfiguration *configuration)
 Setter function for the configuration property. More...
 
- Public Member Functions inherited from Schauer::SJob
 SJob (QObject *parent=nullptr)
 Stores a combination of Capability values. More...
 
 ~SJob () override
 Desconstructs the SJob obejct. More...
 
Capabilities capabilities () const
 Returns the capabilities of this job. More...
 
int error () const
 Returns the error code, if there has been an error. More...
 
QString errorText () const
 Returns the error text if there has been an error. More...
 
bool exec ()
 Executes the job synchronously. More...
 
bool isAutoDelete () const
 Returns true if this job automatically deletes itself once the job is finished. More...
 
bool isFinishedNotificationHidden () const
 
bool isSuspended () const
 Returns true if the job was suspended with the suspend() call. More...
 
unsigned long percent () const
 Returns the overall progress of this job. More...
 
Q_SCRIPTABLE qulonglong processedAmount (Unit unit) const
 Returns the processed amount of a given unit for this job. More...
 
void setAutoDelete (bool autodelete)
 Sets the auto-delete property of the job. More...
 
void setFinishedNotificationHidden (bool hide=true)
 
Q_SCRIPTABLE qulonglong totalAmount (Unit unit) const
 Returns the total amount of a given unit for this job. More...
 

Signals

void attachStderrChanged (bool attachStderr)
 Notifier signal for the attachStderr property. More...
 
void attachStdinChanged (bool attachStdin)
 Notifier signal for the attachStdin property. More...
 
void attachStdoutChanged (bool attachStdout)
 Notifier signal for the attachStdout property. More...
 
void cmdChanged (const QStringList &cmd)
 Notifier signal for the cmd property. More...
 
void detachKeysChanged (const QString &detachKeys)
 Notifier signal for the detachKeys property. More...
 
void envChanged (const QStringList &env)
 Notifier signal for the env property. More...
 
void idChanged (const QString &id)
 Notifier signal for the id property. More...
 
void privilegedChanged (bool privileged)
 Notifier signal for the privileged property. More...
 
void ttyChanged (bool tty)
 Notifier signal for the tty property. More...
 
void userChanged (const QString &user)
 Notifier signal for the user property. More...
 
void workingDirChanged (const QString &workingDir)
 Notifier signal for the workingDir property. More...
 
- Signals inherited from Schauer::Job
void configurationChanged (Schauer::AbstractConfiguration *configuration)
 Notifier signal for the configuration property. More...
 
void failed (int errorCode, const QString &errorString)
 Emitted when the API request has been failed. More...
 
void succeeded (const QJsonDocument &json)
 Emitted when the API request ha been successfully finished. More...
 
- Signals inherited from Schauer::SJob
void description (Schauer::SJob *job, const QString &title, const QPair< QString, QString > &field1=QPair< QString, QString >(), const QPair< QString, QString > &field2=QPair< QString, QString >())
 Emitted to display general description of this job. More...
 
void finished (Schauer::SJob *job)
 Emitted when the job is finished, in any case. More...
 
void infoMessage (Schauer::SJob *job, const QString &plain, const QString &rich=QString())
 Emitted to display state information about this job. More...
 
void percent (Schauer::SJob *job, unsigned long percent)
 Progress signal showing the overall progress of the job This is valid for any kind of job, and allows using a a progress bar very easily. More...
 
void percentChanged (Schauer::SJob *job, unsigned long percent)
 Progress signal showing the overall progress of the job This is valid for any kind of job, and allows using a a progress bar very easily. More...
 
void processedAmount (Schauer::SJob *job, SJob::Unit unit, qulonglong amount)
 Regularly emitted to show the progress of this job by giving the current amount. More...
 
void processedAmountChanged (Schauer::SJob *job, SJob::Unit unit, qulonglong amount)
 Regularly emitted to show the progress of this job by giving the current amount. More...
 
void processedSize (Schauer::SJob *job, qulonglong size)
 Regularly emitted to show the progress of this job (current data size in bytes for transfers, entries listed, etc.). More...
 
void result (Schauer::SJob *job)
 Emitted when the job is finished (except when killed with SJob::Quietly). More...
 
void resumed (Schauer::SJob *job)
 Emitted when the job is resumed. More...
 
void speed (Schauer::SJob *job, unsigned long speed)
 Emitted to display information about the speed of this job. More...
 
void suspended (Schauer::SJob *job)
 Emitted when the job is suspended. More...
 
void totalAmount (Schauer::SJob *job, SJob::Unit unit, qulonglong amount)
 Emitted when we know the amount the job will have to process. More...
 
void totalAmountChanged (Schauer::SJob *job, SJob::Unit unit, qulonglong amount)
 Emitted when we know the amount the job will have to process. More...
 
void totalSize (Schauer::SJob *job, qulonglong size)
 Emitted when we know the size of this job (data size in bytes for transfers, number of entries for listings, etc). More...
 
void warning (Schauer::SJob *job, const QString &plain, const QString &rich=QString())
 Emitted to display a warning about this job. More...
 

Additional Inherited Members

- Public Types inherited from Schauer::SJob
enum  { NoError = 0, KilledJobError = 1, UserDefinedError = 100 }
 Error codes. More...
 
enum  Capability { NoCapabilities = 0x0000, Killable = 0x0001, Suspendable = 0x0002 }
 Job capabilities. More...
 
enum  Unit { Bytes = 0, Files, Directories, Items }
 Describes the unit used in the methods that handle reporting the job progress info. More...
 
- Public Slots inherited from Schauer::SJob
bool kill (Schauer::SJob::KillVerbosity verbosity=Quietly)
 Aborts this job. More...
 
bool resume ()
 Resumes this job. More...
 
bool suspend ()
 Suspends this job. More...
 
- Protected Member Functions inherited from Schauer::Job
 Job (QObject *parent=nullptr)
 Constructs a new Job object with the given parent. More...
 
void sendRequest ()
 Performs basic checks, sets up and sends the request. More...
 
- Protected Member Functions inherited from Schauer::SJob
virtual bool doKill ()
 Aborts this job quietly. More...
 
virtual bool doResume ()
 Resumes this job. More...
 
virtual bool doSuspend ()
 Suspends this job. More...
 
void emitPercent (qulonglong processedAmount, qulonglong totalAmount)
 Utility function for inherited jobs. More...
 
void emitResult ()
 Utility function to emit the result signal, and suicide this job. More...
 
void emitSpeed (unsigned long speed)
 Utility function for inherited jobs. More...
 
bool isFinished () const
 Returns true if the job has been finished and has emitted the finished() signal. More...
 
void setCapabilities (Capabilities capabilities)
 Sets the capabilities for this job. More...
 
void setError (int errorCode)
 Sets the error code. More...
 
void setErrorText (const QString &errorText)
 Sets the error text. More...
 
void setPercent (unsigned long percentage)
 Sets the overall progress of the job. More...
 
void setProcessedAmount (Unit unit, qulonglong amount)
 Sets the processed size. More...
 
void setProgressUnit (Unit unit)
 Sets the unit that will be used internally to calculate the progress percentage. More...
 
void setTotalAmount (Unit unit, qulonglong amount)
 Sets the total size. More...
 

Detailed Description

Create an execution instance.

After creating an execution instance, use the returned Id to start the execution instance with the StartExecInstanceJob.

Have a look at the description of the Job class to learn how to use Job classes.

Example
// performing instance creation and start in a synchronous way
auto createExec = new CreateExecInstanceJob();
createExec->setId(QStringLiteral("my-container"));
createExec->setCmd(QStringList({QStringLiteral("mkdir"), QStringLiteral("-p"), QStringLiteral("/my/new/directory")}));
createExec->exec();
const QString execId = createExec->replyData().object().value(QLatin1String("Id)).toString();
auto startExec = new StartExecInstanceJob();
startExec->setId(execId);
startExec->exec();
API route
/container/{id}/exec
API method
POST
Docker API Documentation
ContainerExec

Property Documentation

◆ attachStderr

bool CreateExecInstanceJob::attachStderr
readwrite

Set this to true to attach to stderr of the exec command.

The default value is false.

Access functions
Notifier signal

◆ attachStdin

bool CreateExecInstanceJob::attachStdin
readwrite

Set this to true to attach to stdin of the exec command.

The default value is false.

Access functions
Notifier signal

◆ attachStdout

bool CreateExecInstanceJob::attachStdout
readwrite

Set this to true to attach to stdout of the exec command.

The default value is false.

Access functions
Notifier signal

◆ cmd

QStringList CreateExecInstanceJob::cmd
readwrite

Sets the command and its arguments to execute.

The command is set as list of command and arguments. The default value is an empty list and the job will not execute with an empty list.

Example
auto job = new CreateExecInstanceJob();
job->setCmd(QStringList({QStringLiteral("mkdir"), QStringLiteral("-p"), QStringLiteral("/my/new/directory")}));
Access functions
Notifier signal

◆ detachKeys

QString CreateExecInstanceJob::detachKeys
readwrite

This property overrides the key sequence for detaching a container.

Format is a singla character a-Z or ctrl-‹value› where ‹value› is one of: a-z, @, ^, [, _ or , . It can set multiple sequences by concatenating them separated by comm. By default this property holds an empty string.

Example
auto job = new CreateExecInstanceJob();
job->setDetachKeys(QStringLiteral("ctrl-p,ctrl-q"));
Access functions
Notifier signal

◆ env

QStringList CreateExecInstanceJob::env
readwrite

Sets the environment variabels used when executing the command.

The default value is an empty list. Set the list of environment variables in the form QStringList({QStringLiteral("VAR=value"), …}).

Access functions
Notifier signal

◆ id

QString CreateExecInstanceJob::id
readwrite

ID or name of the container to exectue the command in.

By default this property holds an empty string. This property must be set to a valid container ID or name to execute the job.

Access functions
Notifier signal

◆ privileged

bool CreateExecInstanceJob::privileged
readwrite

Set this to true to run the exec process with exended privileges.

The default value is false.

Access functions
Notifier signal

◆ tty

bool CreateExecInstanceJob::tty
readwrite

This property holds whether a pseudo-TTY should be allocated.

Set it to true to allocate a pseudo-TTY. The default value is false.

Access functions
Notifier signal

◆ user

QString CreateExecInstanceJob::user
readwrite

This property holds the user, and optionally, group to run the exec process inside the container.

Format is one of user, user:group, uid or uid:gid.

Access functions
Notifier signal

◆ workingDir

QString CreateExecInstanceJob::workingDir
readwrite

This property holds the working directoy for the exec process inside the container.

Access functions
Notifier signal

Constructor & Destructor Documentation

◆ CreateExecInstanceJob()

CreateExecInstanceJob::CreateExecInstanceJob ( QObject parent = nullptr)
explicit

Constructs a new CreateExecInstanceJob with the given parent.

◆ ~CreateExecInstanceJob()

CreateExecInstanceJob::~CreateExecInstanceJob ( )
overridedefault

Destroys the CreateExecInstanceJob object.

Member Function Documentation

◆ addEnv() [1/2]

void CreateExecInstanceJob::addEnv ( const QString env)

Adds a single key-value-pair to the list of environment variables.

Example
auto job = new CreateExecInstanceJob();
job->addEnv(QStringLiteral("FOO=bar"));
See also
env(), setEnv(), envChanged(), removeEnv();

◆ addEnv() [2/2]

void CreateExecInstanceJob::addEnv ( const QString key,
const QString value 
)

Adds key and value as pair to the list of environment variables.

Example
auto job = new CreateExecInstanceJob();
job->addEnv(QStringLiteral("FOO"), QStringLiteral("bar"));
See also
env(), setEnv(), envChanged(), removeEnv();

◆ attachStderr()

bool Schauer::CreateExecInstanceJob::attachStderr ( ) const

Getter function for the attachStderr property.

See also
setAttachStderr(), attachStderrChanged()

◆ attachStderrChanged

void Schauer::CreateExecInstanceJob::attachStderrChanged ( bool  attachStderr)
signal

Notifier signal for the attachStderr property.

See also
attachStderr(), setAttachStderr()

◆ attachStdin()

bool Schauer::CreateExecInstanceJob::attachStdin ( ) const

Getter function for the attachStdin property.

See also
setAttachStdin(), attachStdinChanged()

◆ attachStdinChanged

void Schauer::CreateExecInstanceJob::attachStdinChanged ( bool  attachStdin)
signal

Notifier signal for the attachStdin property.

See also
attachStdin(), setAttachStdin()

◆ attachStdout()

bool Schauer::CreateExecInstanceJob::attachStdout ( ) const

Getter function for the attachStdout property.

See also
setAttachStdout(), attachStdoutChanged()

◆ attachStdoutChanged

void Schauer::CreateExecInstanceJob::attachStdoutChanged ( bool  attachStdout)
signal

Notifier signal for the attachStdout property.

See also
attachStdout(), setAttachStdout()

◆ cmd()

QStringList Schauer::CreateExecInstanceJob::cmd ( ) const

Getter function for the cmd property.

See also
setCmd(), cmdChanged()

◆ cmdChanged

void Schauer::CreateExecInstanceJob::cmdChanged ( const QStringList cmd)
signal

Notifier signal for the cmd property.

See also
cmd(), setCmd()

◆ detachKeys()

QString Schauer::CreateExecInstanceJob::detachKeys ( ) const

Getter function for the detachKeys property.

See also
setDetachKeys(), detachKeysChanged()

◆ detachKeysChanged

void Schauer::CreateExecInstanceJob::detachKeysChanged ( const QString detachKeys)
signal

Notifier signal for the detachKeys property.

See also
detachKeys(), setDetachKeys()

◆ env()

QStringList Schauer::CreateExecInstanceJob::env ( ) const

Getter function for the tty property.

See also
setEnv(), envChanged(), addEnv(), removeEnv()

◆ envChanged

void Schauer::CreateExecInstanceJob::envChanged ( const QStringList env)
signal

Notifier signal for the env property.

See also
env(), setEnv()

◆ id()

QString Schauer::CreateExecInstanceJob::id ( ) const

Getter function for the id property.

See also
setId(), idChanged()

◆ idChanged

void Schauer::CreateExecInstanceJob::idChanged ( const QString id)
signal

Notifier signal for the id property.

See also
id(), setId()

◆ privileged()

bool Schauer::CreateExecInstanceJob::privileged ( ) const

Getter function for the privileged property.

See also
setPrivileged(), privilegedChanged()

◆ privilegedChanged

void Schauer::CreateExecInstanceJob::privilegedChanged ( bool  privileged)
signal

Notifier signal for the privileged property.

See also
privileged(), setPrivileged()

◆ removeEnv()

void CreateExecInstanceJob::removeEnv ( const QString env)

Removes env from the list of environment variables.

Example
auto job = new CreateExecInstanceJob();
job->removeEnv(QStringLiteral("FOO"), QStringLiteral("bar"));
See also
env(), setEnv(), envChanged(), addEnv()

◆ setAttachStderr()

void CreateExecInstanceJob::setAttachStderr ( bool  attachStderr)

Setter function for the attachStderr property.

See also
attachStderr(), attachStderrChanged()

◆ setAttachStdin()

void CreateExecInstanceJob::setAttachStdin ( bool  attachStdin)

Setter function for the attachStdin property.

See also
attachStdin(), attachStdinChanged()

◆ setAttachStdout()

void CreateExecInstanceJob::setAttachStdout ( bool  attachStdout)

Setter function for the attachStdout property.

See also
attachStdout(), attachStdoutChanged()

◆ setCmd()

void CreateExecInstanceJob::setCmd ( const QStringList cmd)

Setter function for the cmd property.

See also
setCmd(), cmdChanged()

◆ setDetachKeys()

void CreateExecInstanceJob::setDetachKeys ( const QString detachKeys)

Setter function for the detachKeys property.

See also
detachKeys(), detachKeysChanged()

◆ setEnv()

void CreateExecInstanceJob::setEnv ( const QStringList env)

Setter function for the tty property.

Set the list of environment variables in the form QStringList({QStringLiteral("VAR=value"), …}).

See also
env(), envChanged(), addEnv(), removeEnv()

◆ setId()

void CreateExecInstanceJob::setId ( const QString id)

Setter function for the id property.

See also
id(), idChanged()

◆ setPrivileged()

void CreateExecInstanceJob::setPrivileged ( bool  privileged)

Setter function for the privileged property.

See also
privileged(), privilegedChanged()

◆ setTty()

void CreateExecInstanceJob::setTty ( bool  tty)

Setter function for the tty property.

See also
tty(), ttyChanged()

◆ setUser()

void CreateExecInstanceJob::setUser ( const QString user)

Setter function for the user property.

See also
user(), userChanged()

◆ setWorkingDir()

void CreateExecInstanceJob::setWorkingDir ( const QString workingDir)

Setter function for the workingDir property.

See also
workingDir(), workingDirChanged()

◆ start()

void CreateExecInstanceJob::start ( )
overridevirtual

Start creating an execution instance asynchronously.

When the job is finished, result() is emitted. To create an execution instance in a synchronous way, use exec().

Implements Schauer::SJob.

◆ tty()

bool Schauer::CreateExecInstanceJob::tty ( ) const

Getter function for the tty property.

See also
setTty(), ttyChanged()

◆ ttyChanged

void Schauer::CreateExecInstanceJob::ttyChanged ( bool  tty)
signal

Notifier signal for the tty property.

See also
tty(), setTty()

◆ user()

QString Schauer::CreateExecInstanceJob::user ( ) const

Getter function for the user property.

See also
setUser(), userChanged()

◆ userChanged

void Schauer::CreateExecInstanceJob::userChanged ( const QString user)
signal

Notifier signal for the user property.

See also
user(), setUser()

◆ workingDir()

QString Schauer::CreateExecInstanceJob::workingDir ( ) const

Getter function for the workingDir property.

See also
setWorkingDir(), workingDirChanged()

◆ workingDirChanged

void Schauer::CreateExecInstanceJob::workingDirChanged ( const QString workingDir)
signal

Notifier signal for the workingDir property.

See also
workingDir(), setWorkingDir()

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