source: box/trunk/lib/httpserver/S3Client.h @ 2447

Revision 2447, 1.8 KB checked in by chris, 3 years ago (diff)

Move S3Client class into its own files for public access.

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    S3Client.h
5//              Purpose: Amazon S3 client helper implementation class
6//              Created: 09/01/2009
7//
8// --------------------------------------------------------------------------
9
10#ifndef S3CLIENT__H
11#define S3CLIENT__H
12
13#include <string>
14#include <map>
15
16#include "HTTPRequest.h"
17#include "SocketStream.h"
18
19class HTTPResponse;
20class HTTPServer;
21class IOStream;
22
23// --------------------------------------------------------------------------
24//
25// Class
26//              Name:    S3Client
27//              Purpose: Amazon S3 client helper implementation class
28//              Created: 09/01/2009
29//
30// --------------------------------------------------------------------------
31class S3Client
32{
33        public:
34        S3Client(HTTPServer* pSimulator, const std::string& rHostName,
35                const std::string& rAccessKey, const std::string& rSecretKey)
36        : mpSimulator(pSimulator),
37          mHostName(rHostName),
38          mAccessKey(rAccessKey),
39          mSecretKey(rSecretKey)
40        { }
41       
42        S3Client(std::string HostName, int Port, const std::string& rAccessKey,
43                const std::string& rSecretKey)
44        : mpSimulator(NULL),
45          mHostName(HostName),
46          mPort(Port),
47          mAccessKey(rAccessKey),
48          mSecretKey(rSecretKey)
49        { }
50               
51        HTTPResponse GetObject(const std::string& rObjectURI);
52        HTTPResponse PutObject(const std::string& rObjectURI,
53                IOStream& rStreamToSend, const char* pContentType = NULL);
54
55        private:
56        HTTPServer* mpSimulator;
57        std::string mHostName;
58        int mPort;
59        std::auto_ptr<SocketStream> mapClientSocket;
60        std::string mAccessKey, mSecretKey;
61
62        HTTPResponse FinishAndSendRequest(HTTPRequest::Method Method,
63                const std::string& rRequestURI,
64                IOStream* pStreamToSend = NULL,
65                const char* pStreamContentType = NULL);
66        HTTPResponse SendRequest(HTTPRequest& rRequest,
67                IOStream* pStreamToSend = NULL,
68                const char* pStreamContentType = NULL);
69};
70
71#endif // S3CLIENT__H
72
Note: See TracBrowser for help on using the repository browser.