26 #include "CredentialsManager.h"
28 #include <BESInternalError.h>
29 #include <kvp_utils.h>
30 #include <TheBESKeys.h>
31 #include <AllowedHosts.h>
43 #include "AccessCredentials.h"
48 using std::stringstream;
53 const string AccessCredentials::ID_KEY =
"id";
54 const string AccessCredentials::KEY_KEY =
"key";
55 const string AccessCredentials::REGION_KEY =
"region";
56 const string AccessCredentials::URL_KEY =
"url";
58 const char *AccessCredentials::ID_KEY =
"id";
59 const char *AccessCredentials::KEY_KEY =
"key";
60 const char *AccessCredentials::REGION_KEY =
"region";
61 const char *AccessCredentials::URL_KEY =
"url";
71 map<string, string>::iterator it;
86 kvp.insert(pair<string, string>(key, value));
95 d_is_s3 =
get(URL_KEY).length() > 0 &&
96 get(ID_KEY).length() > 0 &&
97 get(KEY_KEY).length() > 0 &&
98 get(REGION_KEY).length() > 0;
105 string AccessCredentials::to_json() {
107 ss <<
"{" << endl <<
" \"AccessCredentials\": { " << endl;
108 ss <<
" \"name\": \"" << d_config_name <<
"\"," << endl;
109 for (map<string, string>::iterator it = kvp.begin(); it != kvp.end(); ++it) {
110 string key = it->first;
111 string value = it->second;
113 if (it != kvp.begin())
116 ss <<
" \"" << it->first <<
"\": \"" << it->second <<
"\"";
118 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?