#ifndef ROOT_TS3HTTPRequest
#define ROOT_TS3HTTPRequest
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
class TS3HTTPRequest : public TObject {
public:
enum EHTTPVerb { kGET, kPOST, kPUT, kDELETE, kHEAD, kCOPY };
enum EAuthType { kNoAuth, kAmazon, kGoogle };
private:
EHTTPVerb fVerb;
EAuthType fAuthType;
TString fHost;
TString fBucket;
TString fObjectKey;
TString fTimeStamp;
TString fAccessKey;
TString fSecretKey;
protected:
TString HTTPVerbToTString(EHTTPVerb httpVerb) const;
TString MakeRequestLine(TS3HTTPRequest::EHTTPVerb httpVerb) const;
TString MakeAuthHeader(TS3HTTPRequest::EHTTPVerb httpVerb) const;
TString ComputeSignature(TS3HTTPRequest::EHTTPVerb httpVerb) const;
TString MakeAuthPrefix() const;
TString MakeHostHeader() const;
TString MakeDateHeader() const;
TS3HTTPRequest& SetTimeStamp();
public:
TS3HTTPRequest();
TS3HTTPRequest(EHTTPVerb httpVerb, const TString& host,
const TString& bucket, const TString& objectKey,
EAuthType authType, const TString& accessKey,
const TString& secretKey);
TS3HTTPRequest(const TS3HTTPRequest& m);
virtual ~TS3HTTPRequest() { }
EHTTPVerb GetHTTPVerb() const { return fVerb; }
const TString& GetHost() const { return fHost; }
const TString& GetBucket() const { return fBucket; }
const TString& GetObjectKey() const { return fObjectKey; }
const TString& GetTimeStamp() const { return fTimeStamp; }
const TString& GetAccessKey() const { return fAccessKey; }
const TString& GetSecretKey() const { return fSecretKey; }
TString GetAuthType() const { return fAuthType; }
TString GetRequest(TS3HTTPRequest::EHTTPVerb httpVerb, Bool_t appendCRLF=kTRUE);
TS3HTTPRequest& SetHost(const TString& host);
TS3HTTPRequest& SetBucket(const TString& bucket);
TS3HTTPRequest& SetObjectKey(const TString& objectKey);
TS3HTTPRequest& SetAccessKey(const TString& accessKey);
TS3HTTPRequest& SetSecretKey(const TString& secretKey);
TS3HTTPRequest& SetAuthKeys(const TString& accessKey, const TString& secretKey);
TS3HTTPRequest& SetAuthType(TS3HTTPRequest::EAuthType authType);
ClassDef(TS3HTTPRequest, 0)
};
inline TS3HTTPRequest& TS3HTTPRequest::SetHost(const TString& host)
{
fHost = host;
return *this;
}
inline TS3HTTPRequest& TS3HTTPRequest::SetBucket(const TString& bucket)
{
fBucket = bucket;
return *this;
}
inline TS3HTTPRequest& TS3HTTPRequest::SetObjectKey(const TString& objectKey)
{
fObjectKey = objectKey;
return *this;
}
inline TS3HTTPRequest& TS3HTTPRequest::SetAuthKeys(const TString& accessKey, const TString& secretKey)
{
fAccessKey = accessKey;
fSecretKey = secretKey;
return *this;
}
inline TS3HTTPRequest& TS3HTTPRequest::SetAuthType(TS3HTTPRequest::EAuthType authType)
{
fAuthType = authType;
return *this;
}
inline TS3HTTPRequest& TS3HTTPRequest::SetAccessKey(const TString& accessKey)
{
fAccessKey = accessKey;
return *this;
}
inline TS3HTTPRequest& TS3HTTPRequest::SetSecretKey(const TString& secretKey)
{
fSecretKey = secretKey;
return *this;
}
#endif