bes  Updated for version 3.20.10
AccessCredentials.h
1 //
2 // Created by ndp on 2/12/20.
3 //
4 
5 #ifndef HYRAX_GIT_ACCESSCREDENTIALS_H
6 #define HYRAX_GIT_ACCESSCREDENTIALS_H
7 
8 #include <map>
9 #include <string>
10 
12 public:
13  // These are the string keys used to express the normative key names
14  // for the credentials components.
15 #if 0
16  static const std::string ID_KEY;
17  static const std::string KEY_KEY;
18  static const std::string REGION_KEY;
19  //static const std::string BUCKET_KEY;
20  static const std::string URL_KEY;
21 #else
22  static const char *ID_KEY;
23  static const char *KEY_KEY;
24  static const char *REGION_KEY;
25  static const char *URL_KEY;
26 #endif
27 private:
28  std::map<std::string, std::string> kvp;
29  std::string d_config_name;
30  bool d_s3_tested;
31  bool d_is_s3;
32 public:
33  AccessCredentials() = default;
34 
35  explicit AccessCredentials(const std::string &config_name) :
36  d_config_name(config_name),
37  d_s3_tested(false),
38  d_is_s3(false) { }
39 
40  AccessCredentials(const AccessCredentials &ac) = default;
41 
42  virtual ~AccessCredentials() = default;
43 
44  virtual std::string get(const std::string &key);
45 
46  void add(const std::string &key, const std::string &value);
47 
48  virtual bool is_s3_cred();
49 
50  std::string to_json();
51 
52  std::string name() { return d_config_name; }
53 
54  void name(const std::string &name) { d_config_name = name; }
55 };
56 
57 #include <string>
58 #include <vector>
59 
60 #endif //HYRAX_GIT_ACCESSCREDENTIALS_H
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?