clibdocker
0.1.0-alpha.0
A Docker API for C
|
Docker Results. More...
Go to the source code of this file.
Data Structures | |
struct | docker_result_t |
Macros | |
#define | DOCKER_PARAM_TRUE 1 |
#define | DOCKER_PARAM_FALSE 0 |
#define | HTTP_GET_STR "GET" |
#define | HTTP_POST_STR "POST" |
#define | HTTP_DELETE_STR "DELETE" |
Typedefs | |
typedef enum _config_error | d_err_t |
typedef struct docker_result_t | docker_result |
Enumerations | |
enum | _config_error { E_UNKNOWN_ERROR = 1 , E_SUCCESS = 0 , E_INVALID_INPUT = -1 , E_FILE_NOT_FOUND = -2 , E_ALLOC_FAILED = -3 , E_PING_FAILED = -4 , E_CONNECTION_FAILED = -5 } |
Functions | |
d_err_t | new_docker_result (docker_result **result) |
void | free_docker_result (docker_result *result) |
docker_result * | docker_result_clone (docker_result *result) |
Clone the given docker_result object. More... | |
d_err_t | docker_result_get_error_code (docker_result *result) |
Get the result error code. For possible values of the error code see the enum d_err_t. More... | |
time_t | docker_result_get_start_time (docker_result *result) |
Get the start time of the operation which produced this result. More... | |
time_t | docker_result_get_end_time (docker_result *result) |
Get the end time of the operation which produces this result. More... | |
char * | docker_result_get_url (docker_result *result) |
Get the url for the docker API call performed by this operation. More... | |
char * | docker_result_get_method (docker_result *result) |
Get the HTTP method used for the docker API call performed by this operation. More... | |
char * | docker_result_get_request_json_str (docker_result *result) |
Get the JSON request string sent to the docker API endpoint. More... | |
char * | docker_result_get_response_json_str (docker_result *result) |
Get the JSON response string received from the docker API endpoint. More... | |
long | docker_result_get_http_error_code (docker_result *result) |
Get the HTTP error code returned by the docker API call. More... | |
char * | docker_result_get_message (docker_result *result) |
Get the message string received from docker API call. This is usually part of the JSON response. It is extracted for convenience. More... | |
int | is_ok (docker_result *result) |
void | docker_simple_error_handler_print (docker_result *res) |
void | docker_simple_error_handler_log (docker_result *res) |
Docker Results.
#define DOCKER_PARAM_FALSE 0 |
False value for boolean type
#define DOCKER_PARAM_TRUE 1 |
True value for boolean type
#define HTTP_DELETE_STR "DELETE" |
HTTP DELETE Method string
#define HTTP_GET_STR "GET" |
HTTP GET Method string
#define HTTP_POST_STR "POST" |
HTTP POST Method string
typedef enum _config_error d_err_t |
Error code enum for the Docker API calls
Internal struct docker_result_t typedef to docker_result
The universal result object for docker API calls in this library. This struct and associated methods provide ways to extract success/failure state of the API Call, and messages associated with any error.
The struct must be inspected before the result values of the API calls are used to ensure safe access.
Also the result object must be freed using free_docker_result, as soon as it is no longer needed.
enum _config_error |
(Internal name) Error code enum for the Docker API calls
docker_result* docker_result_clone | ( | docker_result * | result | ) |
Clone the given docker_result object.
result | docker result object |
References new_docker_result().
time_t docker_result_get_end_time | ( | docker_result * | result | ) |
Get the end time of the operation which produces this result.
result |
References docker_result_t::end_time.
d_err_t docker_result_get_error_code | ( | docker_result * | result | ) |
Get the result error code. For possible values of the error code see the enum d_err_t.
result |
References docker_result_t::error_code.
long docker_result_get_http_error_code | ( | docker_result * | result | ) |
Get the HTTP error code returned by the docker API call.
result |
References docker_result_t::http_error_code.
char* docker_result_get_message | ( | docker_result * | result | ) |
Get the message string received from docker API call. This is usually part of the JSON response. It is extracted for convenience.
result |
References docker_result_t::message.
char* docker_result_get_method | ( | docker_result * | result | ) |
Get the HTTP method used for the docker API call performed by this operation.
result |
References docker_result_t::method.
char* docker_result_get_request_json_str | ( | docker_result * | result | ) |
Get the JSON request string sent to the docker API endpoint.
result |
References docker_result_t::request_json_str.
char* docker_result_get_response_json_str | ( | docker_result * | result | ) |
Get the JSON response string received from the docker API endpoint.
result |
References docker_result_t::response_json_str.
time_t docker_result_get_start_time | ( | docker_result * | result | ) |
Get the start time of the operation which produced this result.
result |
References docker_result_t::start_time.
char* docker_result_get_url | ( | docker_result * | result | ) |
Get the url for the docker API call performed by this operation.
result |
References docker_result_t::url.
void docker_simple_error_handler_log | ( | docker_result * | res | ) |
A simple error handler suitable for programs which just want to log the error (if any).
References docker_log_debug, docker_log_error, docker_result_t::error_code, docker_result_t::http_error_code, is_ok(), docker_result_t::message, and docker_result_t::url.
void docker_simple_error_handler_print | ( | docker_result * | res | ) |
A simple error handler suitable for programs which just want to log the error (if any).
References docker_result_t::error_code, docker_result_t::http_error_code, is_ok(), docker_result_t::message, and docker_result_t::url.
void free_docker_result | ( | docker_result * | result | ) |
Utility method to create docker result, should be used by all API implementations to create the result object to return.
Makes a copy of all provided data so that they can be freed after creation of the result. Frees all internal memory used in the docker_result, should be called for all result objects as soon as they are no longer needed.
Frees all internal memory used in the docker_result, should be called for all result objects as soon as they are no longer needed.
References docker_result_t::message, docker_result_t::request_json_str, docker_result_t::response_json_str, and docker_result_t::url.
int is_ok | ( | docker_result * | result | ) |
Check if the error_code is E_SUCCESS
References docker_result_t::error_code.
Referenced by docker_simple_error_handler_log(), and docker_simple_error_handler_print().
d_err_t new_docker_result | ( | docker_result ** | result | ) |
Utility method to create docker result, should be used by all API implementations to create the result object to return.
Referenced by docker_result_clone().