Use "simpler" naming convention per user request
This commit is contained in:
committed by
Yorik van Havre
parent
8afb0379bd
commit
f692494ada
@@ -62,46 +62,46 @@ PyMOD_INIT_FUNC(Cloud)
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
||||
Py::Object Cloud::Module::sCloudUrl(const Py::Tuple& args)
|
||||
Py::Object Cloud::Module::sCloudURL(const Py::Tuple& args)
|
||||
{
|
||||
char *Url;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Url)) // convert args: Python->C
|
||||
char *URL;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&URL)) // convert args: Python->C
|
||||
return Py::None();
|
||||
if (this->Url.getStrValue() != Url) {
|
||||
this->Url.setValue(Url);
|
||||
if (this->URL.getStrValue() != URL) {
|
||||
this->URL.setValue(URL);
|
||||
}
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
Py::Object Cloud::Module::sCloudAccessKey(const Py::Tuple& args)
|
||||
Py::Object Cloud::Module::sCloudTokenAuth(const Py::Tuple& args)
|
||||
{
|
||||
char *AccessKey;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8", &AccessKey)) // convert args: Python->C
|
||||
char *TokenAuth;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8", &TokenAuth)) // convert args: Python->C
|
||||
return Py::None();
|
||||
if (this->AccessKey.getStrValue() != AccessKey) {
|
||||
this->AccessKey.setValue(AccessKey);
|
||||
if (this->TokenAuth.getStrValue() != TokenAuth) {
|
||||
this->TokenAuth.setValue(TokenAuth);
|
||||
}
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
Py::Object Cloud::Module::sCloudSecretKey(const Py::Tuple& args)
|
||||
Py::Object Cloud::Module::sCloudTokenSecret(const Py::Tuple& args)
|
||||
{
|
||||
char *SecretKey;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8", &SecretKey)) // convert args: Python->C
|
||||
char *TokenSecret;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8", &TokenSecret)) // convert args: Python->C
|
||||
return Py::None();
|
||||
if (this->SecretKey.getStrValue() != SecretKey) {
|
||||
this->SecretKey.setValue(SecretKey);
|
||||
if (this->TokenSecret.getStrValue() != TokenSecret) {
|
||||
this->TokenSecret.setValue(TokenSecret);
|
||||
}
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
Py::Object Cloud::Module::sCloudTcpPort(const Py::Tuple& args)
|
||||
Py::Object Cloud::Module::sCloudTCPPort(const Py::Tuple& args)
|
||||
{
|
||||
char *TcpPort;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8", &TcpPort)) // convert args: Python->C
|
||||
char *TCPPort;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8", &TCPPort)) // convert args: Python->C
|
||||
return Py::None();
|
||||
if (this->TcpPort.getStrValue() != TcpPort) {
|
||||
this->TcpPort.setValue(TcpPort);
|
||||
if (this->TCPPort.getStrValue() != TCPPort) {
|
||||
this->TCPPort.setValue(TCPPort);
|
||||
}
|
||||
return Py::None();
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void Cloud::CloudWriter::createBucket()
|
||||
|
||||
char path[1024];
|
||||
sprintf(path, "/%s/", this->Bucket);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("PUT", "application/xml", path, this->SecretKey, NULL, 0);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("PUT", "application/xml", path, this->TokenSecret, NULL, 0);
|
||||
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
@@ -220,22 +220,22 @@ void Cloud::CloudWriter::createBucket()
|
||||
if ( curl )
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
char Url[256];
|
||||
char URL[256];
|
||||
// Let's build our own header
|
||||
std::string strUrl(this->Url);
|
||||
eraseSubStr(strUrl,"http://");
|
||||
eraseSubStr(strUrl,"https://");
|
||||
std::string strURL(this->URL);
|
||||
eraseSubStr(strURL,"http://");
|
||||
eraseSubStr(strURL,"https://");
|
||||
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strUrl.c_str(), this->TcpPort, this->AccessKey, RequestData);
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strURL.c_str(), this->TCPPort, this->TokenAuth, RequestData);
|
||||
delete RequestData;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
|
||||
|
||||
// Lets build the Url for our Curl call
|
||||
// Lets build the URL for our Curl call
|
||||
|
||||
sprintf(Url,"%s:%s/%s/", this->Url,this->TcpPort,
|
||||
sprintf(URL,"%s:%s/%s/", this->URL,this->TCPPort,
|
||||
this->Bucket);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, Url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
|
||||
@@ -336,14 +336,14 @@ char *Cloud::MD5Sum(const char *ptr, long size)
|
||||
return(output);
|
||||
}
|
||||
|
||||
struct curl_slist *Cloud::BuildHeaderAmzS3v2(const char *Url, const char *TcpPort, const char *PublicKey, struct Cloud::AmzData *Data)
|
||||
struct curl_slist *Cloud::BuildHeaderAmzS3v2(const char *URL, const char *TCPPort, const char *PublicKey, struct Cloud::AmzData *Data)
|
||||
{
|
||||
char header_data[1024];
|
||||
struct curl_slist *chunk = NULL;
|
||||
|
||||
// Build the Host: entry
|
||||
|
||||
sprintf(header_data,"Host: %s:%s", Url, TcpPort);
|
||||
sprintf(header_data,"Host: %s:%s", URL, TCPPort);
|
||||
chunk = curl_slist_append(chunk, header_data);
|
||||
|
||||
// Build the Date entry
|
||||
@@ -375,7 +375,7 @@ struct curl_slist *Cloud::BuildHeaderAmzS3v2(const char *Url, const char *TcpPor
|
||||
return chunk;
|
||||
}
|
||||
|
||||
Cloud::CloudWriter::CloudWriter(const char* Url, const char* AccessKey, const char* SecretKey, const char* TcpPort, const char* Bucket)
|
||||
Cloud::CloudWriter::CloudWriter(const char* URL, const char* TokenAuth, const char* TokenSecret, const char* TCPPort, const char* Bucket)
|
||||
{
|
||||
struct Cloud::AmzData *RequestData;
|
||||
CURL *curl;
|
||||
@@ -383,15 +383,15 @@ Cloud::CloudWriter::CloudWriter(const char* Url, const char* AccessKey, const ch
|
||||
|
||||
std::string s;
|
||||
|
||||
this->Url=Url;
|
||||
this->AccessKey=AccessKey;
|
||||
this->SecretKey=SecretKey;
|
||||
this->TcpPort=TcpPort;
|
||||
this->URL=URL;
|
||||
this->TokenAuth=TokenAuth;
|
||||
this->TokenSecret=TokenSecret;
|
||||
this->TCPPort=TCPPort;
|
||||
this->Bucket=Bucket;
|
||||
this->FileName="";
|
||||
char path[1024];
|
||||
sprintf(path,"/%s/", this->Bucket);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/xml", path, this->SecretKey, NULL, 0);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/xml", path, this->TokenSecret, NULL, 0);
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
@@ -403,21 +403,21 @@ Cloud::CloudWriter::CloudWriter(const char* Url, const char* AccessKey, const ch
|
||||
{
|
||||
// Let's build our own header
|
||||
struct curl_slist *chunk = NULL;
|
||||
char Url[256];
|
||||
std::string strUrl(this->Url);
|
||||
eraseSubStr(strUrl,"http://");
|
||||
eraseSubStr(strUrl,"https://");
|
||||
char URL[256];
|
||||
std::string strURL(this->URL);
|
||||
eraseSubStr(strURL,"http://");
|
||||
eraseSubStr(strURL,"https://");
|
||||
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strUrl.c_str(), this->TcpPort, this->AccessKey, RequestData);
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strURL.c_str(), this->TCPPort, this->TokenAuth, RequestData);
|
||||
delete RequestData;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
|
||||
|
||||
// Lets build the Url for our Curl call
|
||||
// Lets build the URL for our Curl call
|
||||
|
||||
sprintf(Url,"%s:%s/%s/", this->Url,this->TcpPort,
|
||||
sprintf(URL,"%s:%s/%s/", this->URL,this->TCPPort,
|
||||
this->Bucket);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, Url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &s);
|
||||
@@ -557,7 +557,7 @@ Cloud::CloudReader::~CloudReader()
|
||||
{
|
||||
}
|
||||
|
||||
Cloud::CloudReader::CloudReader(const char* Url, const char* AccessKey, const char* SecretKey, const char* TcpPort, const char* Bucket)
|
||||
Cloud::CloudReader::CloudReader(const char* URL, const char* TokenAuth, const char* TokenSecret, const char* TCPPort, const char* Bucket)
|
||||
{
|
||||
struct Cloud::AmzData *RequestData;
|
||||
CURL *curl;
|
||||
@@ -565,10 +565,10 @@ Cloud::CloudReader::CloudReader(const char* Url, const char* AccessKey, const ch
|
||||
bool GetBucketContentList=true;
|
||||
|
||||
|
||||
this->Url=Url;
|
||||
this->AccessKey=AccessKey;
|
||||
this->SecretKey=SecretKey;
|
||||
this->TcpPort=TcpPort;
|
||||
this->URL=URL;
|
||||
this->TokenAuth=TokenAuth;
|
||||
this->TokenSecret=TokenSecret;
|
||||
this->TCPPort=TCPPort;
|
||||
this->Bucket=Bucket;
|
||||
|
||||
char path[1024];
|
||||
@@ -584,7 +584,7 @@ Cloud::CloudReader::CloudReader(const char* Url, const char* AccessKey, const ch
|
||||
while ( GetBucketContentList )
|
||||
{
|
||||
std::string s;
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/xml", path, this->SecretKey, NULL, 0);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/xml", path, this->TokenSecret, NULL, 0);
|
||||
curl = curl_easy_init();
|
||||
#ifdef ALLOW_SELF_SIGNED_CERTIFICATE
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
@@ -594,22 +594,22 @@ Cloud::CloudReader::CloudReader(const char* Url, const char* AccessKey, const ch
|
||||
{
|
||||
// Let's build our own header
|
||||
struct curl_slist *chunk = NULL;
|
||||
char Url[256];
|
||||
std::string strUrl(this->Url);
|
||||
eraseSubStr(strUrl,"http://");
|
||||
eraseSubStr(strUrl,"https://");
|
||||
char URL[256];
|
||||
std::string strURL(this->URL);
|
||||
eraseSubStr(strURL,"http://");
|
||||
eraseSubStr(strURL,"https://");
|
||||
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strUrl.c_str(), this->TcpPort, this->AccessKey, RequestData);
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strURL.c_str(), this->TCPPort, this->TokenAuth, RequestData);
|
||||
delete RequestData;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
|
||||
if ( strlen(NextFileName) == 0 )
|
||||
sprintf(Url,"%s:%s/%s/?list-type=2", this->Url,this->TcpPort,
|
||||
sprintf(URL,"%s:%s/%s/?list-type=2", this->URL,this->TCPPort,
|
||||
this->Bucket);
|
||||
else
|
||||
sprintf(Url,"%s:%s/%s/?list-type=2&continuation-token=%s", this->Url,this->TcpPort,
|
||||
sprintf(URL,"%s:%s/%s/?list-type=2&continuation-token=%s", this->URL,this->TCPPort,
|
||||
this->Bucket, NextFileName);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, Url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
|
||||
@@ -669,7 +669,7 @@ void Cloud::CloudReader::DownloadFile(Cloud::CloudReader::FileEntry *entry)
|
||||
// We must get the directory content
|
||||
char path[1024];
|
||||
sprintf(path, "/%s/%s", this->Bucket, entry->FileName);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/octet-stream", path, this->SecretKey, NULL, 0);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/octet-stream", path, this->TokenSecret, NULL, 0);
|
||||
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
@@ -681,20 +681,20 @@ void Cloud::CloudReader::DownloadFile(Cloud::CloudReader::FileEntry *entry)
|
||||
if ( curl )
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
char Url[256];
|
||||
char URL[256];
|
||||
// Let's build our own header
|
||||
std::string strUrl(this->Url);
|
||||
eraseSubStr(strUrl,"http://");
|
||||
eraseSubStr(strUrl,"https://");
|
||||
std::string strURL(this->URL);
|
||||
eraseSubStr(strURL,"http://");
|
||||
eraseSubStr(strURL,"https://");
|
||||
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strUrl.c_str(), this->TcpPort, this->AccessKey, RequestData);
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strURL.c_str(), this->TCPPort, this->TokenAuth, RequestData);
|
||||
delete RequestData;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
|
||||
|
||||
sprintf(Url,"%s:%s/%s/%s", this->Url,this->TcpPort,
|
||||
sprintf(URL,"%s:%s/%s/%s", this->URL,this->TCPPort,
|
||||
this->Bucket, entry->FileName);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, Url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);
|
||||
@@ -783,7 +783,7 @@ void Cloud::CloudWriter::pushCloud(const char *FileName, const char *data, long
|
||||
|
||||
char path[1024];
|
||||
sprintf(path, "/%s/%s", this->Bucket, FileName);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("PUT", "application/octet-stream", path, this->SecretKey, data, size);
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("PUT", "application/octet-stream", path, this->TokenSecret, data, size);
|
||||
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
@@ -795,23 +795,23 @@ void Cloud::CloudWriter::pushCloud(const char *FileName, const char *data, long
|
||||
if ( curl )
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
char Url[256];
|
||||
char URL[256];
|
||||
// Let's build our own header
|
||||
std::string strUrl(this->Url);
|
||||
eraseSubStr(strUrl,"http://");
|
||||
eraseSubStr(strUrl,"https://");
|
||||
std::string strURL(this->URL);
|
||||
eraseSubStr(strURL,"http://");
|
||||
eraseSubStr(strURL,"https://");
|
||||
|
||||
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strUrl.c_str(), this->TcpPort, this->AccessKey, RequestData);
|
||||
chunk = Cloud::BuildHeaderAmzS3v2( strURL.c_str(), this->TCPPort, this->TokenAuth, RequestData);
|
||||
delete RequestData;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
|
||||
|
||||
// Lets build the Url for our Curl call
|
||||
// Lets build the URL for our Curl call
|
||||
|
||||
sprintf(Url,"%s:%s/%s/%s", this->Url,this->TcpPort,
|
||||
sprintf(URL,"%s:%s/%s/%s", this->URL,this->TCPPort,
|
||||
this->Bucket,FileName);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, Url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
|
||||
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
@@ -898,10 +898,10 @@ bool Cloud::Module::cloudSave(const char *BucketName)
|
||||
if ( strcmp(BucketName, doc->Label.getValue()) != 0 )
|
||||
doc->Label.setValue(BucketName);
|
||||
|
||||
Cloud::CloudWriter mywriter((const char*)this->Url.getStrValue().c_str(),
|
||||
(const char*)this->AccessKey.getStrValue().c_str(),
|
||||
(const char*)this->SecretKey.getStrValue().c_str(),
|
||||
(const char*)this->TcpPort.getStrValue().c_str(),
|
||||
Cloud::CloudWriter mywriter((const char*)this->URL.getStrValue().c_str(),
|
||||
(const char*)this->TokenAuth.getStrValue().c_str(),
|
||||
(const char*)this->TokenSecret.getStrValue().c_str(),
|
||||
(const char*)this->TCPPort.getStrValue().c_str(),
|
||||
BucketName);
|
||||
|
||||
mywriter.putNextEntry("Document.xml");
|
||||
@@ -972,10 +972,10 @@ bool Cloud::Module::cloudRestore (const char *BucketName)
|
||||
|
||||
std::stringstream oss;
|
||||
|
||||
Cloud::CloudReader myreader((const char*)this->Url.getStrValue().c_str(),
|
||||
(const char*)this->AccessKey.getStrValue().c_str(),
|
||||
(const char*)this->SecretKey.getStrValue().c_str(),
|
||||
(const char*)this->TcpPort.getStrValue().c_str(),
|
||||
Cloud::CloudReader myreader((const char*)this->URL.getStrValue().c_str(),
|
||||
(const char*)this->TokenAuth.getStrValue().c_str(),
|
||||
(const char*)this->TokenSecret.getStrValue().c_str(),
|
||||
(const char*)this->TCPPort.getStrValue().c_str(),
|
||||
BucketName);
|
||||
|
||||
// we shall pass there the initial Document.xml file
|
||||
|
||||
@@ -58,13 +58,13 @@ struct AmzData {
|
||||
void eraseSubStr(std::string & Str, const std::string & toErase);
|
||||
size_t CurlWrite_CallbackFunc_StdString(void *contents, size_t size, size_t nmemb, std::string *s);
|
||||
struct AmzData *ComputeDigestAmzS3v2(char *operation, char *data_type, const char *target, const char *Secret, const char *ptr, long size);
|
||||
struct curl_slist *BuildHeaderAmzS3v2(const char *Url, const char *TcpPort, const char *PublicKey, struct AmzData *Data);
|
||||
struct curl_slist *BuildHeaderAmzS3v2(const char *URL, const char *TCPPort, const char *PublicKey, struct AmzData *Data);
|
||||
char *MD5Sum(const char *ptr, long size);
|
||||
|
||||
class CloudAppExport CloudReader
|
||||
{
|
||||
public:
|
||||
CloudReader(const char* Url, const char* AccessKey, const char* SecretKey, const char* TcpPort, const char* Bucket);
|
||||
CloudReader(const char* URL, const char* AccessKey, const char* SecretKey, const char* TCPPort, const char* Bucket);
|
||||
virtual ~CloudReader();
|
||||
int file=0;
|
||||
int continuation=0;
|
||||
@@ -86,10 +86,10 @@ public:
|
||||
protected:
|
||||
std::list<Cloud::CloudReader::FileEntry*> FileList;
|
||||
char* NextFileName;
|
||||
const char* Url;
|
||||
const char* TcpPort;
|
||||
const char* AccessKey;
|
||||
const char* SecretKey;
|
||||
const char* URL;
|
||||
const char* TCPPort;
|
||||
const char* TokenAuth;
|
||||
const char* TokenSecret;
|
||||
const char* Bucket;
|
||||
};
|
||||
|
||||
@@ -98,28 +98,28 @@ class Module : public Py::ExtensionModule<Module>
|
||||
public:
|
||||
Module() : Py::ExtensionModule<Module>("Cloud")
|
||||
{
|
||||
add_varargs_method("cloudurl",&Module::sCloudUrl,
|
||||
"cloudurl(string) -- Connect to a Cloud Storage service."
|
||||
add_varargs_method("URL",&Module::sCloudURL,
|
||||
"URL(string) -- Connect to a Cloud Storage service."
|
||||
);
|
||||
|
||||
add_varargs_method("cloudaccesskey",&Module::sCloudAccessKey,
|
||||
"cloudurl(string) -- Connect to a Cloud Storage service."
|
||||
add_varargs_method("TokenAuth",&Module::sCloudTokenAuth,
|
||||
"TokenAuth(string) -- Token Authorization string."
|
||||
);
|
||||
|
||||
add_varargs_method("cloudsecretkey",&Module::sCloudSecretKey,
|
||||
"cloudurl(string) -- Connect to a Cloud Storage service."
|
||||
add_varargs_method("TokenSecret",&Module::sCloudTokenSecret,
|
||||
"TokenSecret(string) -- Token Secret string."
|
||||
);
|
||||
|
||||
add_varargs_method("cloudtcpport",&Module::sCloudTcpPort,
|
||||
"cloudurl(string) -- Connect to a Cloud Storage service."
|
||||
add_varargs_method("TCPPort",&Module::sCloudTCPPort,
|
||||
"TCPPort(string) -- Port number."
|
||||
);
|
||||
|
||||
add_varargs_method("cloudsave",&Module::sCloudSave,
|
||||
"cloudurl(string) -- Connect to a Cloud Storage service."
|
||||
add_varargs_method("Save",&Module::sCloudSave,
|
||||
"Save(string) -- Save the active document to the Cloud."
|
||||
);
|
||||
|
||||
add_varargs_method("cloudrestore",&Module::sCloudRestore,
|
||||
"cloudurl(string) -- Connect to a Cloud Storage service."
|
||||
add_varargs_method("Restore",&Module::sCloudRestore,
|
||||
"Restore(string) -- Restore to the active document from the Cloud."
|
||||
);
|
||||
|
||||
initialize("This module is the Cloud module."); // register with Python
|
||||
@@ -127,18 +127,18 @@ public:
|
||||
|
||||
virtual ~Module() {}
|
||||
|
||||
App::PropertyString Url;
|
||||
App::PropertyString TcpPort;
|
||||
App::PropertyString AccessKey;
|
||||
App::PropertyString SecretKey;
|
||||
App::PropertyString URL;
|
||||
App::PropertyString TCPPort;
|
||||
App::PropertyString TokenAuth;
|
||||
App::PropertyString TokenSecret;
|
||||
bool cloudSave(const char* BucketName);
|
||||
bool cloudRestore(const char* BucketName);
|
||||
|
||||
private:
|
||||
Py::Object sCloudUrl (const Py::Tuple& args);
|
||||
Py::Object sCloudAccessKey (const Py::Tuple& args);
|
||||
Py::Object sCloudSecretKey (const Py::Tuple& args);
|
||||
Py::Object sCloudTcpPort (const Py::Tuple& args);
|
||||
Py::Object sCloudURL (const Py::Tuple& args);
|
||||
Py::Object sCloudTokenAuth (const Py::Tuple& args);
|
||||
Py::Object sCloudTokenSecret (const Py::Tuple& args);
|
||||
Py::Object sCloudTCPPort (const Py::Tuple& args);
|
||||
Py::Object sCloudSave (const Py::Tuple& args);
|
||||
Py::Object sCloudRestore (const Py::Tuple& args);
|
||||
|
||||
@@ -158,7 +158,7 @@ class CloudAppExport CloudWriter : public Base::Writer
|
||||
public:
|
||||
int print=0;
|
||||
char errorCode[1024]="";
|
||||
CloudWriter(const char* Url, const char* AccessKey, const char* SecretKey, const char* TcpPort, const char* Bucket);
|
||||
CloudWriter(const char* URL, const char* TokenAuth, const char* TokenSecret, const char* TCPPort, const char* Bucket);
|
||||
virtual ~CloudWriter();
|
||||
void pushCloud(const char *FileName, const char *data, long size);
|
||||
void putNextEntry(const char* file);
|
||||
@@ -173,10 +173,10 @@ public:
|
||||
|
||||
protected:
|
||||
std::string FileName;
|
||||
const char* Url;
|
||||
const char* TcpPort;
|
||||
const char* AccessKey;
|
||||
const char* SecretKey;
|
||||
const char* URL;
|
||||
const char* TCPPort;
|
||||
const char* TokenAuth;
|
||||
const char* TokenSecret;
|
||||
const char* Bucket;
|
||||
std::stringstream FileStream;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user