Leosac  0.8.0
Open Source Access Control
Leosac::Audit::WSAPICall Class Reference

Provides the implementation of IWSAPICall. More...

#include <WSAPICall.hpp>

+ Inheritance diagram for Leosac::Audit::WSAPICall:
+ Collaboration diagram for Leosac::Audit::WSAPICall:

Public Member Functions

virtual ~WSAPICall ()=default
 
virtual void method (const std::string &string) override
 Set the API method that was targeted by the call. More...
 
virtual void uuid (const std::string &string) override
 Set the UUID of the request. More...
 
virtual void status_code (APIStatusCode code) override
 Set the status_code of the reponse. More...
 
virtual void status_string (const std::string &string) override
 Set the status string of the response. More...
 
virtual void source_endpoint (const std::string &string) override
 Set the source endpoint. More...
 
virtual void request_content (const std::string &string) override
 The (JSON) content of the request. More...
 
virtual void response_content (const std::string &string) override
 
virtual void database_operations (uint16_t nb_operation) override
 The number of database queries. More...
 
virtual const std::string & method () const override
 
virtual const std::string & uuid () const override
 
virtual APIStatusCode status_code () const override
 
virtual const std::string & status_string () const override
 
virtual const std::string & source_endpoint () const override
 
virtual std::string generate_description () const override
 Generate a description for this event. More...
 
- Public Member Functions inherited from Leosac::Audit::IWSAPICall
 MAKE_VISITABLE ()
 
- Public Member Functions inherited from Leosac::Audit::IAuditEntry
 MAKE_VISITABLE ()
 
- Public Member Functions inherited from Leosac::Tools::IVisitable
virtual void accept (::Leosac::Tools::BaseVisitor &)=0
 Accept a visitor that may mutate this. More...
 
virtual void accept (::Leosac::Tools::BaseVisitor &) const =0
 Accept a visitor that will not mutate this. More...
 
- Public Member Functions inherited from Leosac::Audit::AuditEntry
 AuditEntry (const AuditEntry &)=delete
 
virtual ~AuditEntry ()=default
 
virtual AuditEntryId id () const override
 Retrieve the identifier of the entry. More...
 
virtual void finalize () override
 Mark the entry as finalized, and update it wrt the database. More...
 
virtual bool finalized () const override
 Is this entry finalized. More...
 
virtual void event_mask (const EventMask &mask) override
 Set the event mask for the entry. More...
 
virtual const EventMaskevent_mask () const override
 Retrieve the current event mask. More...
 
virtual void author (Auth::UserPtr user) override
 Set the author of the entry. More...
 
virtual Auth::UserId author_id () const override
 Retrieve the user id of the author of this entry. More...
 
virtual void set_parent (IAuditEntryPtr parent) override
 Set parent as the parent audit entry for this entry. More...
 
virtual IAuditEntryPtr parent () const override
 Retrieve the parent of this entry. More...
 
virtual void remove_parent () override
 Remove the parent-child relationship between this entry and its parent. More...
 
virtual size_t children_count () const override
 Returns the number of children that this entry has. More...
 
virtual size_t version () const override
 Returns the ODB version of the object. More...
 
virtual void reload () override
 Reload the object from the database. More...
 
virtual boost::posix_time::ptime timestamp () const override
 Retrieve unix timestamp. More...
 
void database (DBPtr db)
 Set the database pointer. More...
 

Public Attributes

std::string api_method_
 
std::string uuid_
 The UUID of the request. More...
 
APIStatusCode status_code_
 Status code of the response. More...
 
std::string status_string_
 The status string of the response. More...
 
std::string source_endpoint_
 The source IP:Port of the client who made the request. More...
 
std::string request_content_
 Copy of the JSON content of the request. More...
 
std::string response_content_
 Copy of the JSON content of the response. More...
 
uint16_t database_operations_
 Count the number of database operation that happened while processing this API call. More...
 

Private Member Functions

 WSAPICall ()
 

Static Private Member Functions

static WSAPICallPtr create (const DBPtr &database)
 

Friends

class Factory
 
class odb::access
 

Additional Inherited Members

- Static Public Member Functions inherited from Leosac::Audit::AuditEntry
static AuditEntryPtr get_last_audit (DBPtr db)
 Retrieve the last (finalized) audit entry. More...
 
- Protected Member Functions inherited from Leosac::Audit::AuditEntry
 AuditEntry ()
 
- Static Protected Member Functions inherited from Leosac::Tools::IVisitable
template<class T >
static bool visitor_dispatch (T &visited, BaseVisitor &visitor, bool abort_on_failure)
 
- Protected Attributes inherited from Leosac::Audit::AuditEntry
AuditEntryWPtr parent_
 
std::string msg_
 
Auth::UserLPtr author_
 The user at the source of the entry. More...
 
EventMask event_mask_
 
size_t duration_
 How long did it take for the Audit object to be finalized. More...
 
bool finalized_
 Audit entry are sometime persisted multiple time before reaching their final state. More...
 
DBPtr database_
 Pointer to the database. More...
 
Tools::ElapsedTimeCounter etc_
 Keep track of how long the object has been alive. More...
 

Detailed Description

Provides the implementation of IWSAPICall.

Definition at line 33 of file WSAPICall.hpp.

Constructor & Destructor Documentation

◆ WSAPICall()

WSAPICall::WSAPICall ( )
private

Definition at line 29 of file WSAPICall.cpp.

◆ ~WSAPICall()

virtual Leosac::Audit::WSAPICall::~WSAPICall ( )
virtualdefault

Member Function Documentation

◆ create()

WSAPICallPtr WSAPICall::create ( const DBPtr database)
staticprivate

Definition at line 35 of file WSAPICall.cpp.

◆ database_operations()

void WSAPICall::database_operations ( uint16_t  nb_operation)
overridevirtual

The number of database queries.

Implements Leosac::Audit::IWSAPICall.

Definition at line 89 of file WSAPICall.cpp.

◆ generate_description()

std::string WSAPICall::generate_description ( ) const
overridevirtual

Generate a description for this event.

todo: should be pure virtual

Reimplemented from Leosac::Audit::IAuditEntry.

Definition at line 120 of file WSAPICall.cpp.

◆ method() [1/2]

const std::string & WSAPICall::method ( ) const
overridevirtual

Implements Leosac::Audit::IWSAPICall.

Definition at line 95 of file WSAPICall.cpp.

◆ method() [2/2]

void WSAPICall::method ( const std::string &  )
overridevirtual

Set the API method that was targeted by the call.

Implements Leosac::Audit::IWSAPICall.

Definition at line 47 of file WSAPICall.cpp.

◆ request_content()

void WSAPICall::request_content ( const std::string &  )
overridevirtual

The (JSON) content of the request.

Implements Leosac::Audit::IWSAPICall.

Definition at line 77 of file WSAPICall.cpp.

◆ response_content()

void WSAPICall::response_content ( const std::string &  string)
overridevirtual

Implements Leosac::Audit::IWSAPICall.

Definition at line 83 of file WSAPICall.cpp.

◆ source_endpoint() [1/2]

const std::string & WSAPICall::source_endpoint ( ) const
overridevirtual

Implements Leosac::Audit::IWSAPICall.

Definition at line 115 of file WSAPICall.cpp.

◆ source_endpoint() [2/2]

void WSAPICall::source_endpoint ( const std::string &  )
overridevirtual

Set the source endpoint.

Generally IP:PORT

Implements Leosac::Audit::IWSAPICall.

Definition at line 71 of file WSAPICall.cpp.

◆ status_code() [1/2]

APIStatusCode WSAPICall::status_code ( ) const
overridevirtual

Implements Leosac::Audit::IWSAPICall.

Definition at line 105 of file WSAPICall.cpp.

◆ status_code() [2/2]

void WSAPICall::status_code ( APIStatusCode  )
overridevirtual

Set the status_code of the reponse.

Implements Leosac::Audit::IWSAPICall.

Definition at line 59 of file WSAPICall.cpp.

◆ status_string() [1/2]

const std::string & WSAPICall::status_string ( ) const
overridevirtual

Implements Leosac::Audit::IWSAPICall.

Definition at line 110 of file WSAPICall.cpp.

◆ status_string() [2/2]

void WSAPICall::status_string ( const std::string &  )
overridevirtual

Set the status string of the response.

Implements Leosac::Audit::IWSAPICall.

Definition at line 65 of file WSAPICall.cpp.

◆ uuid() [1/2]

const std::string & WSAPICall::uuid ( ) const
overridevirtual

Implements Leosac::Audit::IWSAPICall.

Definition at line 100 of file WSAPICall.cpp.

◆ uuid() [2/2]

void WSAPICall::uuid ( const std::string &  )
overridevirtual

Set the UUID of the request.

Implements Leosac::Audit::IWSAPICall.

Definition at line 53 of file WSAPICall.cpp.

Friends And Related Function Documentation

◆ Factory

friend class Factory
friend

Definition at line 38 of file WSAPICall.hpp.

◆ odb::access

friend class odb::access
friend

Definition at line 118 of file WSAPICall.hpp.

Member Data Documentation

◆ api_method_

std::string Leosac::Audit::WSAPICall::api_method_

Definition at line 74 of file WSAPICall.hpp.

◆ database_operations_

uint16_t Leosac::Audit::WSAPICall::database_operations_

Count the number of database operation that happened while processing this API call.

Definition at line 115 of file WSAPICall.hpp.

◆ request_content_

std::string Leosac::Audit::WSAPICall::request_content_

Copy of the JSON content of the request.

Definition at line 104 of file WSAPICall.hpp.

◆ response_content_

std::string Leosac::Audit::WSAPICall::response_content_

Copy of the JSON content of the response.

Definition at line 109 of file WSAPICall.hpp.

◆ source_endpoint_

std::string Leosac::Audit::WSAPICall::source_endpoint_

The source IP:Port of the client who made the request.

Definition at line 99 of file WSAPICall.hpp.

◆ status_code_

APIStatusCode Leosac::Audit::WSAPICall::status_code_

Status code of the response.

Definition at line 86 of file WSAPICall.hpp.

◆ status_string_

std::string Leosac::Audit::WSAPICall::status_string_

The status string of the response.

May be empty.

Definition at line 92 of file WSAPICall.hpp.

◆ uuid_

std::string Leosac::Audit::WSAPICall::uuid_

The UUID of the request.

Definition at line 80 of file WSAPICall.hpp.


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