CloudApi.cpp 965 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "CloudApi.h"
  2. #include "qcloud.h"
  3. #include "eSDKOBS.h"
  4. static int g_type=0;
  5. void CloudSetYunType(int type)//0ÌÚѶ 1»ªÎª
  6. {
  7. g_type = type;
  8. }
  9. void InitQCLoud(unsigned long long appid, char* access_key, char* secret_key, char* region, char* bucket_name)
  10. {
  11. Qcloud_Init(appid, access_key, secret_key, region, bucket_name);
  12. }
  13. void InitHuaweiCLoud(char * hostName, char * accessKey, char * SecretKey, char * bucketName)
  14. {
  15. HWCloud_Init(hostName, accessKey, SecretKey, bucketName,0);
  16. }
  17. bool CloudPutFile(char* object_name, char* file_path, char url[], char ret[])
  18. {
  19. if (g_type==0)
  20. {
  21. return Qcloud_PutFromFile(object_name, file_path, url, ret);
  22. }
  23. else
  24. {
  25. return HWCloud_PutFromFile(object_name, file_path, url, ret);
  26. }
  27. }
  28. bool CloudPutFile(char* object_name, char* file_path, char url[])
  29. {
  30. if (g_type == 0)
  31. {
  32. return Qcloud_PutFromFile(object_name, file_path, url);
  33. }
  34. else
  35. {
  36. return HWCloud_PutFromFile(object_name, file_path, url, NULL);
  37. }
  38. }