Fawkes API  Fawkes Development Version
PluginOpRequest Class Reference

PluginOpRequest representation for JSON transfer. More...

#include <PluginOpRequest.h>

Public Member Functions

 PluginOpRequest ()
 Constructor. More...
 
 PluginOpRequest (const std::string &json)
 Constructor from JSON. More...
 
 PluginOpRequest (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~PluginOpRequest ()
 Destructor. More...
 
virtual std::string to_json (bool pretty=false) const
 Render object to JSON. More...
 
virtual void to_json_value (rapidjson::Document &d, rapidjson::Value &v) const
 Render object to JSON. More...
 
virtual void from_json (const std::string &json)
 Retrieve data from JSON string. More...
 
virtual void from_json_value (const rapidjson::Value &v)
 Retrieve data from JSON string. More...
 
virtual void validate (bool subcall=false) const
 Validate if all required fields have been set. More...
 
std::optional< std::string > kind () const
 Get kind value. More...
 
void set_kind (const std::string &kind)
 Set kind value. More...
 
std::optional< std::string > apiVersion () const
 Get apiVersion value. More...
 
void set_apiVersion (const std::string &apiVersion)
 Set apiVersion value. More...
 
std::optional< std::string > desired_state () const
 Get desired_state value. More...
 
void set_desired_state (const std::string &desired_state)
 Set desired_state value. More...
 

Static Public Member Functions

static std::string api_version ()
 Get version of implemented API. More...
 

Detailed Description

PluginOpRequest representation for JSON transfer.

Definition at line 25 of file PluginOpRequest.h.

Constructor & Destructor Documentation

◆ PluginOpRequest() [1/3]

PluginOpRequest::PluginOpRequest ( )

Constructor.

Definition at line 23 of file PluginOpRequest.cpp.

◆ PluginOpRequest() [2/3]

PluginOpRequest::PluginOpRequest ( const std::string &  json)

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 27 of file PluginOpRequest.cpp.

References from_json().

◆ PluginOpRequest() [3/3]

PluginOpRequest::PluginOpRequest ( const rapidjson::Value &  v)

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 32 of file PluginOpRequest.cpp.

References from_json_value().

◆ ~PluginOpRequest()

PluginOpRequest::~PluginOpRequest ( )
virtual

Destructor.

Definition at line 37 of file PluginOpRequest.cpp.

Member Function Documentation

◆ api_version()

static std::string PluginOpRequest::api_version ( )
inlinestatic

Get version of implemented API.

Returns
string representation of version

Definition at line 47 of file PluginOpRequest.h.

◆ apiVersion()

std::optional<std::string> PluginOpRequest::apiVersion ( ) const
inline

Get apiVersion value.

Returns
apiVersion value

Definition at line 108 of file PluginOpRequest.h.

Referenced by set_apiVersion().

◆ desired_state()

std::optional<std::string> PluginOpRequest::desired_state ( ) const
inline

Get desired_state value.

Returns
desired_state value

Definition at line 125 of file PluginOpRequest.h.

Referenced by set_desired_state().

◆ from_json()

void PluginOpRequest::from_json ( const std::string &  json)
virtual

Retrieve data from JSON string.

Parameters
jsonJSON representation suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 86 of file PluginOpRequest.cpp.

References from_json_value().

Referenced by PluginOpRequest().

◆ from_json_value()

void PluginOpRequest::from_json_value ( const rapidjson::Value &  v)
virtual

Retrieve data from JSON string.

Parameters
vRapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 95 of file PluginOpRequest.cpp.

Referenced by from_json(), and PluginOpRequest().

◆ kind()

std::optional<std::string> PluginOpRequest::kind ( ) const
inline

Get kind value.

Returns
kind value

Definition at line 91 of file PluginOpRequest.h.

Referenced by set_kind().

◆ set_apiVersion()

void PluginOpRequest::set_apiVersion ( const std::string &  apiVersion)
inline

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 117 of file PluginOpRequest.h.

References apiVersion().

◆ set_desired_state()

void PluginOpRequest::set_desired_state ( const std::string &  desired_state)
inline

Set desired_state value.

Parameters
desired_statenew value

Definition at line 134 of file PluginOpRequest.h.

References desired_state().

◆ set_kind()

void PluginOpRequest::set_kind ( const std::string &  kind)
inline

Set kind value.

Parameters
kindnew value

Definition at line 100 of file PluginOpRequest.h.

References kind().

◆ to_json()

std::string PluginOpRequest::to_json ( bool  pretty = false) const
virtual

Render object to JSON.

Parameters
prettytrue to enable pretty printing (readable spacing)
Returns
JSON string

Definition at line 42 of file PluginOpRequest.cpp.

References to_json_value().

◆ to_json_value()

void PluginOpRequest::to_json_value ( rapidjson::Document &  d,
rapidjson::Value &  v 
) const
virtual

Render object to JSON.

Parameters
dRapidJSON document to retrieve allocator from
vRapidJSON value to add data to

Definition at line 61 of file PluginOpRequest.cpp.

Referenced by to_json().

◆ validate()

void PluginOpRequest::validate ( bool  subcall = false) const
virtual

Validate if all required fields have been set.

Parameters
subcalltrue if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown.
Exceptions
std::vector<std::string>thrown if required information is missing and subcall is set to true. Contains a list of missing fields.
std::runtime_errorinformative message describing the missing fields

Definition at line 109 of file PluginOpRequest.cpp.


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