28#include "AccessCredentials.h"
33using std::stringstream;
36const char *AccessCredentials::ID_KEY =
"id";
37const char *AccessCredentials::KEY_KEY =
"key";
38const char *AccessCredentials::REGION_KEY =
"region";
39const char *AccessCredentials::URL_KEY =
"url";
48 map<string, string>::iterator it;
63 kvp.insert(pair<string, string>(key, value));
72 d_is_s3 =
get(URL_KEY).length() > 0 &&
73 get(ID_KEY).length() > 0 &&
74 get(KEY_KEY).length() > 0 &&
75 get(REGION_KEY).length() > 0;
82string AccessCredentials::to_json() {
84 ss <<
"{" << endl <<
" \"AccessCredentials\": { " << endl;
85 ss <<
" \"name\": \"" << d_config_name <<
"\"," << endl;
86 for (map<string, string>::iterator it = kvp.begin(); it != kvp.end(); ++it) {
87 string key = it->first;
88 string value = it->second;
90 if (it != kvp.begin())
93 ss <<
" \"" << it->first <<
"\": \"" << it->second <<
"\"";
95 ss << endl <<
" }" << endl <<
"}" << endl;
void add(const std::string &key, const std::string &value)
Add the key and value pair.
virtual std::string get(const std::string &key)
virtual bool is_s3_cred()
Do the URL, ID, Key amd Region items make up an S3 Credential?