|
|
|
@@ -1522,6 +1522,7 @@ namespace ANSCENTER
|
|
|
|
// Uploads text data from a file to the specified S3 bucket
|
|
|
|
// Uploads text data from a file to the specified S3 bucket
|
|
|
|
bool ANSAWSS3::UploadTextData(const std::string& bucketName, const std::string& textFilePath, std::string& uploadedFilePath) {
|
|
|
|
bool ANSAWSS3::UploadTextData(const std::string& bucketName, const std::string& textFilePath, std::string& uploadedFilePath) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadTextData";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadTextData";
|
|
|
|
|
|
|
|
// _logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
|
|
|
|
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
@@ -1614,6 +1615,7 @@ namespace ANSCENTER
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool ANSAWSS3::UploadBinaryData(const std::string& bucketName, const std::string& dataFilePath, std::string& uploadedFilePath) {
|
|
|
|
bool ANSAWSS3::UploadBinaryData(const std::string& bucketName, const std::string& dataFilePath, std::string& uploadedFilePath) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadBinaryData";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadBinaryData";
|
|
|
|
|
|
|
|
// _logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
|
|
|
|
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
@@ -1691,9 +1693,9 @@ namespace ANSCENTER
|
|
|
|
return retryable ? AttemptResult::Transient : AttemptResult::Permanent;
|
|
|
|
return retryable ? AttemptResult::Transient : AttemptResult::Permanent;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ANSAWSS3::UploadPrefixBinaryData(const std::string& bucketName, const std::string& prefix, const std::string& dataFilePath, const std::string& objectName, std::string& uploadedFilePath) {
|
|
|
|
bool ANSAWSS3::UploadPrefixBinaryData(const std::string& bucketName, const std::string& prefix, const std::string& dataFilePath, const std::string& objectName, std::string& uploadedFilePath) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadPrefixBinaryData";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadPrefixBinaryData";
|
|
|
|
|
|
|
|
//_logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
|
|
|
|
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
@@ -1795,9 +1797,9 @@ namespace ANSCENTER
|
|
|
|
return retryable ? AttemptResult::Transient : AttemptResult::Permanent;
|
|
|
|
return retryable ? AttemptResult::Transient : AttemptResult::Permanent;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ANSAWSS3::UploadFileStream(const std::string& bucketName, const std::string& dataFilePath, std::string& uploadedFilePath) {
|
|
|
|
bool ANSAWSS3::UploadFileStream(const std::string& bucketName, const std::string& dataFilePath, std::string& uploadedFilePath) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadFileStream";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadFileStream";
|
|
|
|
|
|
|
|
//_logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
|
|
|
|
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
@@ -1867,6 +1869,7 @@ namespace ANSCENTER
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool ANSAWSS3::UploadMultipartData(const std::string& bucketName,const std::string& dataFilePath, std::string& uploadedFilePath, int partSize) {
|
|
|
|
bool ANSAWSS3::UploadMultipartData(const std::string& bucketName,const std::string& dataFilePath, std::string& uploadedFilePath, int partSize) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadMultipartData";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadMultipartData";
|
|
|
|
|
|
|
|
//_logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
|
|
|
|
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
@@ -2067,6 +2070,7 @@ namespace ANSCENTER
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool ANSAWSS3::UploadPrefixMultipartData(const std::string& bucketName, const std::string& prefix,const std::string& dataFilePath, const std::string& objectName, std::string& uploadedFilePath, int partSize) {
|
|
|
|
bool ANSAWSS3::UploadPrefixMultipartData(const std::string& bucketName, const std::string& prefix,const std::string& dataFilePath, const std::string& objectName, std::string& uploadedFilePath, int partSize) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadPrefixMultipartData";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadPrefixMultipartData";
|
|
|
|
|
|
|
|
//_logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
|
|
|
|
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
// Early validation (permanent — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
@@ -2284,7 +2288,7 @@ namespace ANSCENTER
|
|
|
|
// Upload jpeg data
|
|
|
|
// Upload jpeg data
|
|
|
|
bool ANSAWSS3::UploadJpegImage(const std::string& bucketName, unsigned char* jpeg_string, int32 bufferLength, const std::string& fileName, std::string& uploadedFilePath) {
|
|
|
|
bool ANSAWSS3::UploadJpegImage(const std::string& bucketName, unsigned char* jpeg_string, int32 bufferLength, const std::string& fileName, std::string& uploadedFilePath) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadJpegImage";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadJpegImage";
|
|
|
|
|
|
|
|
// _logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
// Early validation checks (permanent — do NOT retry)
|
|
|
|
// Early validation checks (permanent — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
_logger.LogError(kOp,
|
|
|
|
_logger.LogError(kOp,
|
|
|
|
@@ -2356,7 +2360,7 @@ namespace ANSCENTER
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool ANSAWSS3::UploadPrefixJpegImage(const std::string& bucketName, const std::string& prefix,unsigned char* jpeg_string,int32 bufferLength,const std::string& fileName, std::string& uploadedFilePath) {
|
|
|
|
bool ANSAWSS3::UploadPrefixJpegImage(const std::string& bucketName, const std::string& prefix,unsigned char* jpeg_string,int32 bufferLength,const std::string& fileName, std::string& uploadedFilePath) {
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadPrefixJpegImage";
|
|
|
|
const std::string kOp = "ANSAWSS3::UploadPrefixJpegImage";
|
|
|
|
|
|
|
|
//_logger.LogError(kOp,"Start Uploading...",__FILE__, __LINE__);
|
|
|
|
// Early validation checks (permanent failures — do NOT retry)
|
|
|
|
// Early validation checks (permanent failures — do NOT retry)
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
if (!_isLicenseValid || !_isUnlockCodeValid || !_bConnected) {
|
|
|
|
_logger.LogError(kOp,
|
|
|
|
_logger.LogError(kOp,
|
|
|
|
@@ -2427,7 +2431,7 @@ namespace ANSCENTER
|
|
|
|
// addressing style) — always the canonical path-style URL.
|
|
|
|
// addressing style) — always the canonical path-style URL.
|
|
|
|
std::string scheme = _bTls ? "https://" : "http://";
|
|
|
|
std::string scheme = _bTls ? "https://" : "http://";
|
|
|
|
uploadedFilePath = scheme + _fullAWSURL + "/" + bucketName + "/" + objectKey;
|
|
|
|
uploadedFilePath = scheme + _fullAWSURL + "/" + bucketName + "/" + objectKey;
|
|
|
|
_logger.LogDebug(kOp,
|
|
|
|
_logger.LogError(kOp,
|
|
|
|
"Successfully uploaded: " + objectKey + " (" + std::to_string(bufferLength) + " bytes) | URL: " + uploadedFilePath,
|
|
|
|
"Successfully uploaded: " + objectKey + " (" + std::to_string(bufferLength) + " bytes) | URL: " + uploadedFilePath,
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
ReleaseConnection(std::move(conn));
|
|
|
|
ReleaseConnection(std::move(conn));
|
|
|
|
|