bce-python-sdk 0.9.50__tar.gz → 0.9.52__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/PKG-INFO +1 -1
  2. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/__init__.py +1 -1
  3. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/auth/bce_v1_signer.py +52 -3
  4. bce_python_sdk-0.9.52/baidubce/services/aihc/__init__.py +18 -0
  5. bce_python_sdk-0.9.52/baidubce/services/aihc/aihc_client.py +171 -0
  6. bce_python_sdk-0.9.52/baidubce/services/aihc/aihc_handler.py +145 -0
  7. bce_python_sdk-0.9.52/baidubce/services/aihc/aihc_model.py +37 -0
  8. bce_python_sdk-0.9.52/baidubce/services/aihc/base/__init__.py +15 -0
  9. bce_python_sdk-0.9.52/baidubce/services/aihc/base/aihc_base_client.py +174 -0
  10. bce_python_sdk-0.9.52/baidubce/services/aihc/base/aihc_common.py +48 -0
  11. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/__init__.py +15 -0
  12. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/dataset/__init__.py +18 -0
  13. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/dataset/dataset_client.py +386 -0
  14. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/dataset/dataset_model.py +75 -0
  15. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/dev_instance/__init__.py +18 -0
  16. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/dev_instance/dev_instance_client.py +390 -0
  17. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/job/__init__.py +18 -0
  18. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/job/job_client.py +590 -0
  19. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/job/job_model.py +254 -0
  20. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/model/__init__.py +18 -0
  21. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/model/model_client.py +294 -0
  22. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/model/model_model.py +54 -0
  23. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/service/__init__.py +18 -0
  24. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/service/service_client.py +562 -0
  25. bce_python_sdk-0.9.52/baidubce/services/aihc/modules/service/service_model.py +512 -0
  26. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/vpc_client.py +1 -1
  27. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/bce_python_sdk.egg-info/PKG-INFO +1 -1
  28. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/bce_python_sdk.egg-info/SOURCES.txt +22 -0
  29. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/setup.py +8 -0
  30. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/README.txt +0 -0
  31. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/auth/__init__.py +0 -0
  32. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/auth/bce_credentials.py +0 -0
  33. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/bce_base_client.py +0 -0
  34. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/bce_client_configuration.py +0 -0
  35. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/bce_response.py +0 -0
  36. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/compat.py +0 -0
  37. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/exception.py +0 -0
  38. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/http/__init__.py +0 -0
  39. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/http/bce_http_client.py +0 -0
  40. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/http/handler.py +0 -0
  41. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/http/http_content_types.py +0 -0
  42. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/http/http_headers.py +0 -0
  43. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/http/http_methods.py +0 -0
  44. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/protocol.py +0 -0
  45. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/region.py +0 -0
  46. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/retry/__init__.py +0 -0
  47. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/retry/retry_policy.py +0 -0
  48. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/__init__.py +0 -0
  49. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/autoscaling/__init__.py +0 -0
  50. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/autoscaling/as_client.py +0 -0
  51. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/autoscaling/as_handler.py +0 -0
  52. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/autoscaling/as_model.py +0 -0
  53. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bbc/__init__.py +0 -0
  54. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bbc/bbc_client.py +0 -0
  55. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bbc/bbc_model.py +0 -0
  56. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcc/__init__.py +0 -0
  57. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcc/bcc_client.py +0 -0
  58. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcc/bcc_model.py +0 -0
  59. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcc/fpga_card_type.py +0 -0
  60. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcc/gpu_card_type.py +0 -0
  61. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcm/__init__.py +0 -0
  62. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcm/bcm_client.py +0 -0
  63. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcm/bcm_handler.py +0 -0
  64. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bcm/bcm_model.py +0 -0
  65. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bes/__init__.py +0 -0
  66. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bes/bes_client.py +0 -0
  67. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bes/bes_model.py +0 -0
  68. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/blb/__init__.py +0 -0
  69. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/blb/app_blb_client.py +0 -0
  70. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/blb/blb_client.py +0 -0
  71. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/blb/user_service_client.py +0 -0
  72. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bls/__init__.py +0 -0
  73. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bls/bls_client.py +0 -0
  74. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bls/bls_handler.py +0 -0
  75. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bls/bls_model.py +0 -0
  76. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bmr/__init__.py +0 -0
  77. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bmr/bmr_client.py +0 -0
  78. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bos/__init__.py +0 -0
  79. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bos/bos_client.py +0 -0
  80. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bos/bos_handler.py +0 -0
  81. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bos/canned_acl.py +0 -0
  82. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bos/common.py +0 -0
  83. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bos/storage_class.py +0 -0
  84. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bts/__init__.py +0 -0
  85. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bts/bts_client.py +0 -0
  86. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bts/model.py +0 -0
  87. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/bts/util.py +0 -0
  88. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ca/__init__.py +0 -0
  89. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ca/ca_client.py +0 -0
  90. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ca/ca_handler.py +0 -0
  91. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ca/ca_model.py +0 -0
  92. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cdn/__init__.py +0 -0
  93. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cdn/cdn_client.py +0 -0
  94. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cdn/cdn_stats_param.py +0 -0
  95. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cert/__init__.py +0 -0
  96. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cert/cert_client.py +0 -0
  97. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cert/cert_model.py +0 -0
  98. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cfc/__init__.py +0 -0
  99. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cfc/cfc_client.py +0 -0
  100. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cfc/cfc_handler.py +0 -0
  101. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/cfc/models.py +0 -0
  102. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/csn/__init__.py +0 -0
  103. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/csn/csn_api.py +0 -0
  104. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/csn/csn_client.py +0 -0
  105. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/csn/csn_model.py +0 -0
  106. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ddc/__init__.py +0 -0
  107. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ddc/ddc_client.py +0 -0
  108. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/dns/__init__.py +0 -0
  109. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/dns/api/__init__.py +0 -0
  110. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/dns/api/dns_api.py +0 -0
  111. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/dns/dns_client.py +0 -0
  112. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/dumap/__init__.py +0 -0
  113. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/dumap/dumap_client.py +0 -0
  114. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eip/__init__.py +0 -0
  115. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eip/eip_bp_client.py +0 -0
  116. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eip/eip_client.py +0 -0
  117. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eip/eip_group_client.py +0 -0
  118. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eip/eip_group_model.py +0 -0
  119. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eip/eip_tp_client.py +0 -0
  120. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eip/model.py +0 -0
  121. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/endpoint/__init__.py +0 -0
  122. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/endpoint/endpoint_client.py +0 -0
  123. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/endpoint/model.py +0 -0
  124. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eni/__init__.py +0 -0
  125. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eni/eni_client.py +0 -0
  126. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/eni/eni_model.py +0 -0
  127. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/esg/__init__.py +0 -0
  128. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/esg/esg_client.py +0 -0
  129. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/esg/esg_model.py +0 -0
  130. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/et/__init__.py +0 -0
  131. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/et/et_client.py +0 -0
  132. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/et/model.py +0 -0
  133. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/etGateway/__init__.py +0 -0
  134. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/etGateway/et_gateway_client.py +0 -0
  135. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/havip/havip_client.py +0 -0
  136. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/iam/__init__.py +0 -0
  137. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/iam/iam_client.py +0 -0
  138. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/infinite/__init__.py +0 -0
  139. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/infinite/infinite_client.py +0 -0
  140. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ipv6gateway/__init__.py +0 -0
  141. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ipv6gateway/ipv6gateway_client.py +0 -0
  142. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/ipv6gateway/ipv6gateway_model.py +0 -0
  143. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/kms/__init__.py +0 -0
  144. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/kms/keyspec_class.py +0 -0
  145. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/kms/kms_client.py +0 -0
  146. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/kms/origin_class.py +0 -0
  147. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/kms/protectedby_class.py +0 -0
  148. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/kms/publickeyencoding_class.py +0 -0
  149. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/lbdc/__init__.py +0 -0
  150. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/lbdc/lbdc_client.py +0 -0
  151. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/lbdc/model.py +0 -0
  152. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/localdns/__init__.py +0 -0
  153. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/localdns/api/__init__.py +0 -0
  154. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/localdns/api/ld_api.py +0 -0
  155. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/localdns/ld_client.py +0 -0
  156. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/media/__init__.py +0 -0
  157. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/media/media_client.py +0 -0
  158. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/media/media_handler.py +0 -0
  159. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/mms/__init__.py +0 -0
  160. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/mms/mms_client.py +0 -0
  161. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/mvs/__init__.py +0 -0
  162. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/mvs/mvs_client.py +0 -0
  163. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/oos/__init__.py +0 -0
  164. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/oos/oos_client.py +0 -0
  165. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/oos/oos_model.py +0 -0
  166. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/probe/__init__.py +0 -0
  167. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/probe/probe_client.py +0 -0
  168. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/rds/__init__.py +0 -0
  169. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/rds/rds_client.py +0 -0
  170. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/rds/rds_model.py +0 -0
  171. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/route/__init__.py +0 -0
  172. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/route/route_client.py +0 -0
  173. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/route/route_model.py +0 -0
  174. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/scs/__init__.py +0 -0
  175. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/scs/model.py +0 -0
  176. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/scs/scs_client.py +0 -0
  177. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/sms/__init__.py +0 -0
  178. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/sms/model.py +0 -0
  179. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/sms/sms_client.py +0 -0
  180. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/sts/__init__.py +0 -0
  181. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/sts/sts_client.py +0 -0
  182. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/subnet/__init__.py +0 -0
  183. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/subnet/subnet_client.py +0 -0
  184. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/tsdb/__init__.py +0 -0
  185. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/tsdb/tsdb_admin_client.py +0 -0
  186. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/tsdb/tsdb_client.py +0 -0
  187. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/tsdb/tsdb_handler.py +0 -0
  188. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vca/__init__.py +0 -0
  189. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vca/vca_client.py +0 -0
  190. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vcr/__init__.py +0 -0
  191. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vcr/vcr_client.py +0 -0
  192. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/__init__.py +0 -0
  193. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/acl_client.py +0 -0
  194. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/nat_client.py +0 -0
  195. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/nat_model.py +0 -0
  196. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/peerconn_client.py +0 -0
  197. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/peerconn_model.py +0 -0
  198. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/template_client.py +0 -0
  199. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpc/template_model.py +0 -0
  200. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpn/__init__.py +0 -0
  201. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpn/vpn_client.py +0 -0
  202. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/services/vpn/vpn_model.py +0 -0
  203. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/baidubce/utils.py +0 -0
  204. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/bce_python_sdk.egg-info/dependency_links.txt +0 -0
  205. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/bce_python_sdk.egg-info/requires.txt +0 -0
  206. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/bce_python_sdk.egg-info/top_level.txt +0 -0
  207. {bce_python_sdk-0.9.50 → bce_python_sdk-0.9.52}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bce-python-sdk
3
- Version: 0.9.50
3
+ Version: 0.9.52
4
4
  Summary: BCE SDK for python
5
5
  Home-page: http://bce.baidu.com
6
6
  Author:
@@ -18,7 +18,7 @@ from builtins import bytes
18
18
  from . import protocol
19
19
 
20
20
 
21
- SDK_VERSION = b'0.9.50'
21
+ SDK_VERSION = b'0.9.52'
22
22
  DEFAULT_SERVICE_DOMAIN = b'bcebos.com'
23
23
  URL_PREFIX = b'/v1'
24
24
  DEFAULT_ENCODING = 'UTF-8'
@@ -14,8 +14,6 @@
14
14
  This module provides authentication functions for bce services.
15
15
  """
16
16
  from __future__ import absolute_import
17
- from builtins import str
18
- from builtins import bytes
19
17
  import hashlib
20
18
  import hmac
21
19
  import logging
@@ -74,7 +72,7 @@ def sign(credentials, http_method, path, headers, params,
74
72
 
75
73
  canonical_headers = _get_canonical_headers(headers, headers_to_sign)
76
74
  string_to_sign = (b'\n').join([
77
- http_method, canonical_uri,
75
+ http_method, canonical_uri,
78
76
  canonical_querystring, canonical_headers
79
77
  ])
80
78
  sign_result = hmac.new(compat.convert_to_bytes(sign_key), string_to_sign, hashlib.sha256).hexdigest()
@@ -90,3 +88,54 @@ def sign(credentials, http_method, path, headers, params,
90
88
  (sign_key, len(string_to_sign), string_to_sign))
91
89
  _logger.debug('result=%s' % result)
92
90
  return result
91
+
92
+
93
+ def resource_pool_sign(credentials, http_method, path, headers, params,
94
+ timestamp=0, expiration_in_seconds=1800, headers_to_sign=None):
95
+ """
96
+ 资源池接口签名适配方法,与普通接口签名不同的是,资源池接口需要额外处理host头
97
+ """
98
+
99
+ _logger.debug('Sign params: %s %s %s %s %d %d %s' % (
100
+ http_method, path, headers, params, timestamp, expiration_in_seconds, headers_to_sign))
101
+
102
+ headers = headers or {}
103
+ params = params or {}
104
+
105
+ sign_key_info = b'bce-auth-v1/%s/%s/%d' % (
106
+ credentials.access_key_id,
107
+ utils.get_canonical_time(timestamp),
108
+ expiration_in_seconds)
109
+ sign_key = hmac.new(
110
+ credentials.secret_access_key,
111
+ sign_key_info,
112
+ hashlib.sha256).hexdigest()
113
+
114
+ canonical_uri = path
115
+ canonical_querystring = utils.get_canonical_querystring(params, True)
116
+
117
+ # 从headers中提取host
118
+ host_header = None
119
+ for key, value in headers.items():
120
+ if key.lower() == b'host':
121
+ host_header = utils.convert_to_standard_string(value).strip()
122
+ break
123
+
124
+ canonical_headers = b'host:' + utils.normalize_string(host_header)
125
+ string_to_sign = (b'\n').join([
126
+ http_method, canonical_uri,
127
+ canonical_querystring, canonical_headers
128
+ ])
129
+ sign_result = hmac.new(compat.convert_to_bytes(sign_key), string_to_sign, hashlib.sha256).hexdigest()
130
+ # convert to bytes
131
+ sign_result = compat.convert_to_bytes(sign_result)
132
+
133
+ if headers_to_sign:
134
+ result = b'%s/%s/%s' % (sign_key_info, (b';').join(headers_to_sign), sign_result)
135
+ else:
136
+ result = b'%s/host/%s' % (sign_key_info, sign_result)
137
+
138
+ _logger.debug('sign_key=[%s] sign_string=[%d bytes][ %s ]' %
139
+ (sign_key, len(string_to_sign), string_to_sign))
140
+ _logger.debug('result=%s' % result)
141
+ return result
@@ -0,0 +1,18 @@
1
+ # Copyright 2014 Baidu, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4
+ # except in compliance with the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software distributed under the
9
+ # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10
+ # either express or implied. See the License for the specific language governing permissions
11
+ # and limitations under the License.
12
+
13
+ """
14
+ AIHC V2 service module.
15
+ """
16
+ from baidubce.services.aihc.aihc_client import AihcClient
17
+
18
+ __all__ = ['AihcClient']
@@ -0,0 +1,171 @@
1
+ # Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4
+ # except in compliance with the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software distributed under the
9
+ # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10
+ # either express or implied. See the License for the specific language governing permissions
11
+ # and limitations under the License.
12
+
13
+ """
14
+ This module provides a client class for AIHC V2.
15
+ """
16
+ import inspect
17
+ from functools import wraps
18
+ from typing import Any, Dict, Optional, Union, List, get_type_hints
19
+
20
+ from baidubce.services.aihc.modules.job.job_client import JobClient
21
+ from baidubce.services.aihc.modules.dataset.dataset_client import DatasetClient
22
+ from baidubce.services.aihc.modules.model.model_client import ModelClient
23
+ from baidubce.services.aihc.modules.service.service_client import ServiceClient
24
+ from baidubce.services.aihc.modules.dev_instance.dev_instance_client import DevInstanceClient
25
+ from baidubce.services.aihc.modules.resource_pool.resource_pool_client import ResourcePoolClient
26
+
27
+
28
+ def create_typed_proxy_method(target_client, method_name):
29
+ """
30
+ 创建带有完整类型信息的代理方法
31
+
32
+ 这个函数会:
33
+ 1. 获取原始方法的完整签名和类型注解
34
+ 2. 创建一个新的代理方法,保持所有类型信息
35
+ 3. 确保IDE能够正确识别类型提示
36
+ """
37
+ original_method = getattr(target_client, method_name)
38
+
39
+ # 获取原始方法的完整信息
40
+ sig = inspect.signature(original_method)
41
+
42
+ # 创建代理方法
43
+ @wraps(original_method)
44
+ def proxy_method(*args, **kwargs):
45
+ """
46
+ 代理方法,用于调用原始目标方法并保持类型信息
47
+ """
48
+ return original_method(*args, **kwargs)
49
+
50
+ # 设置完整的类型信息
51
+ proxy_method.__signature__ = sig
52
+ proxy_method.__annotations__ = original_method.__annotations__
53
+
54
+ # 确保IDE能够识别类型信息
55
+ if hasattr(original_method, '__module__'):
56
+ proxy_method.__module__ = original_method.__module__
57
+ if hasattr(original_method, '__qualname__'):
58
+ proxy_method.__qualname__ = original_method.__qualname__
59
+ if hasattr(original_method, '__name__'):
60
+ proxy_method.__name__ = original_method.__name__
61
+
62
+ # 使用 typing.get_type_hints 确保类型信息正确
63
+ try:
64
+ type_hints = get_type_hints(original_method)
65
+ proxy_method.__annotations__ = type_hints
66
+ except Exception:
67
+ # 如果获取类型提示失败,使用原始注解
68
+ proxy_method.__annotations__ = original_method.__annotations__
69
+
70
+ return proxy_method
71
+
72
+
73
+ class AihcClient:
74
+ """
75
+ AIHC主客户端,适配V2版本OpenAPI
76
+
77
+ 该客户端提供了对AIHC各个模块功能的统一访问接口,
78
+ 包括任务管理、数据集管理、模型管理、在线服务和开发机管理等功能。
79
+
80
+ 使用示例:
81
+ >>> from baidubce.services.aihc.aihc_client import AihcClient
82
+ >>> client = AihcClient(config)
83
+ >>> jobs = client.DescribeJobs(resourcePoolId="xxx")
84
+ """
85
+
86
+ def __init__(self, config=None):
87
+ """
88
+ 初始化AIHC V2客户端
89
+
90
+ Args:
91
+ config: 配置对象
92
+ baidubce.bce_client_configuration.BceClientConfiguration实例
93
+ """
94
+ self.job = JobClient(config)
95
+ self.dataset = DatasetClient(config)
96
+ self.model = ModelClient(config)
97
+ self.service = ServiceClient(config)
98
+ self.dev_instance = DevInstanceClient(config)
99
+ self.resource_pool = ResourcePoolClient(config)
100
+
101
+ # 动态创建代理方法
102
+ self._setup_proxy_methods()
103
+
104
+ def _setup_proxy_methods(self):
105
+ """
106
+ 设置代理方法
107
+
108
+ 为各个子模块的方法创建代理,使主客户端可以直接调用子模块的方法
109
+ """
110
+ # 任务相关接口
111
+ job_methods = [
112
+ 'DescribeJobs', 'DescribeJob', 'DeleteJob', 'ModifyJob',
113
+ 'DescribeJobEvents', 'DescribeJobLogs', 'DescribeJobPodEvents',
114
+ 'StopJob', 'DescribeJobNodes', 'DescribeJobWebterminal', 'CreateJob',
115
+ 'DescribeJobMetrics'
116
+ ]
117
+
118
+ # 数据集相关接口
119
+ dataset_methods = [
120
+ 'DescribeDatasets', 'DescribeDataset', 'ModifyDataset', 'DeleteDataset',
121
+ 'CreateDataset', 'DescribeDatasetVersions', 'DescribeDatasetVersion',
122
+ 'DeleteDatasetVersion', 'CreateDatasetVersion'
123
+ ]
124
+
125
+ # 模型相关接口
126
+ model_methods = [
127
+ 'DescribeModels', 'CreateModel', 'DeleteModel', 'ModifyModel',
128
+ 'DescribeModel', 'DescribeModelVersions', 'DescribeModelVersion',
129
+ 'CreateModelVersion', 'DeleteModelVersion'
130
+ ]
131
+
132
+ # 在线服务相关接口
133
+ service_methods = [
134
+ 'DescribeServices', 'DescribeService', 'DescribeServiceStatus',
135
+ 'CreateService', 'DeleteService', 'ModifyService', 'ModifyServiceReplicas', 'UpgradeService',
136
+ 'DescribeServicePods', 'DeleteServicePod', 'DisableServicePod', 'ModifyServiceNetConfig',
137
+ 'DescribeServicePodGroups', 'DescribeServiceChangelogs', 'DescribeServiceChangelog'
138
+ ]
139
+
140
+ # 开发机相关接口
141
+ dev_instance_methods = [
142
+ 'DescribeDevInstances', 'DescribeDevInstance', 'StartDevInstance', 'StopDevInstance',
143
+ 'CreateDevInstance', 'DeleteDevInstance', 'ModifyDevInstance',
144
+ 'DescribeDevInstanceEvents', 'CreateDevInstanceImagePackJob',
145
+ 'DescribeDevInstanceImagePackJob', 'TimedStopDevInstance'
146
+ ]
147
+
148
+ # 资源池相关接口
149
+ resource_pool_methods = [
150
+ 'DescribeResourcePools', 'DescribeResourcePool', 'DescribeResourcePoolOverview',
151
+ 'DescribeResourcePoolConfiguration', 'DescribeQueues', 'DescribeQueue'
152
+ ]
153
+
154
+ # 为每个方法创建代理
155
+ for method_name in job_methods:
156
+ setattr(self, method_name, create_typed_proxy_method(self.job, method_name))
157
+
158
+ for method_name in dataset_methods:
159
+ setattr(self, method_name, create_typed_proxy_method(self.dataset, method_name))
160
+
161
+ for method_name in model_methods:
162
+ setattr(self, method_name, create_typed_proxy_method(self.model, method_name))
163
+
164
+ for method_name in service_methods:
165
+ setattr(self, method_name, create_typed_proxy_method(self.service, method_name))
166
+
167
+ for method_name in dev_instance_methods:
168
+ setattr(self, method_name, create_typed_proxy_method(self.dev_instance, method_name))
169
+
170
+ for method_name in resource_pool_methods:
171
+ setattr(self, method_name, create_typed_proxy_method(self.resource_pool, method_name))
@@ -0,0 +1,145 @@
1
+ # Copyright 2014 Baidu, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4
+ # except in compliance with the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software distributed under the
9
+ # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10
+ # either express or implied. See the License for the specific language governing permissions
11
+ # and limitations under the License.
12
+
13
+ """
14
+ This module provides general http handler functions for processing http responses from AIHC V2 services.
15
+
16
+ This module contains utility functions for parsing HTTP responses from AIHC (AI Hosting Cloud) services,
17
+ including JSON parsing, error handling, and response object conversion. The functions are designed
18
+ to work with the BCE (Baidu Cloud Engine) SDK framework.
19
+
20
+ Functions:
21
+ parse_json: Parse JSON response and convert to Python object
22
+ dict_to_python_object: Convert dictionary to Python object with Expando
23
+ parse_json_list: Parse JSON list response
24
+ parse_error: Handle error responses and raise appropriate exceptions
25
+ """
26
+
27
+ import http.client
28
+ import json
29
+ from baidubce import compat, utils
30
+ from baidubce.utils import Expando
31
+ from baidubce.exception import BceClientError
32
+ from baidubce.exception import BceServerError
33
+
34
+
35
+ def parse_json(http_response, response):
36
+ """
37
+ Parse JSON response and convert to Python object.
38
+
39
+ If the response body is not empty, convert it to a Python object and update
40
+ the response object's attributes. The http_response is always closed if no error occurs.
41
+
42
+ Args:
43
+ http_response: The http_response object returned by HTTPConnection.getresponse()
44
+ response: General response object which will be returned to the caller
45
+
46
+ Returns:
47
+ bool: Always returns True
48
+
49
+ Note:
50
+ This function removes the 'metadata' key from the response if it exists.
51
+ """
52
+ body = http_response.read()
53
+ if body:
54
+ response.__dict__.update(json.loads(
55
+ body, object_hook=dict_to_python_object).__dict__)
56
+
57
+ # 移除metadata key(如果存在)
58
+ if 'metadata' in response.__dict__:
59
+ del response.__dict__['metadata']
60
+ http_response.close()
61
+ return True
62
+
63
+
64
+ def dict_to_python_object(d):
65
+ """
66
+ Convert dictionary to Python object with Expando.
67
+
68
+ Args:
69
+ d: Dictionary to convert
70
+
71
+ Returns:
72
+ Expando: Python object with dictionary attributes
73
+ """
74
+ attr = {}
75
+ for k, v in list(d.items()):
76
+ k = str(k)
77
+ attr[k] = v
78
+ return Expando(attr)
79
+
80
+
81
+ def parse_json_list(http_response, response):
82
+ """
83
+ Parse JSON list response and convert to Python object.
84
+
85
+ If the body is not empty, convert it to a Python object and set as the value of
86
+ response.result. The http_response is always closed if no error occurs.
87
+
88
+ Args:
89
+ http_response: The http_response object returned by HTTPConnection.getresponse()
90
+ response: General response object which will be returned to the caller
91
+
92
+ Returns:
93
+ bool: Always returns True
94
+ """
95
+ body = http_response.read()
96
+ if body:
97
+ body = compat.convert_to_string(body)
98
+ response.__dict__["result"] = json.loads(body, object_hook=utils.dict_to_python_object)
99
+ response.__dict__["raw_data"] = body
100
+ http_response.close()
101
+ return True
102
+
103
+
104
+ def parse_error(http_response, response):
105
+ """
106
+ Handle error responses and raise appropriate exceptions.
107
+
108
+ If the HTTP status code is not 2xx, parse the error response and raise
109
+ appropriate BCE exceptions. The http_response is always closed.
110
+
111
+ Args:
112
+ http_response: The http_response object returned by HTTPConnection.getresponse()
113
+ response: General response object which will be returned to the caller
114
+
115
+ Returns:
116
+ bool: False if HTTP status code is 2xx
117
+
118
+ Raises:
119
+ BceClientError: If HTTP status code is 1xx (not handled)
120
+ BceServerError: If HTTP status code is not 2xx (error response)
121
+ """
122
+ if http_response.status // 100 == http.client.OK // 100:
123
+ return False
124
+ if http_response.status // 100 == http.client.CONTINUE // 100:
125
+ raise BceClientError(b'Can not handle 1xx http status code')
126
+ body = http_response.read()
127
+ if not body:
128
+ bse = BceServerError(http_response.reason, request_id=response.metadata.bce_request_id)
129
+ bse.status_code = http_response.status
130
+ raise bse
131
+
132
+ error_dict = json.loads(compat.convert_to_string(body))
133
+ message = str(error_dict)
134
+ if 'message' in error_dict and error_dict['message'] is not None:
135
+ message = error_dict['message']
136
+ code = "Exception"
137
+ if 'code' in error_dict and error_dict['code'] is not None:
138
+ code = error_dict['code']
139
+ request_id = response.metadata.bce_request_id
140
+ if 'request_id' in error_dict and error_dict['request_id'] is not None:
141
+ request_id = error_dict['request_id']
142
+
143
+ bse = BceServerError(message, code=code, request_id=request_id)
144
+ bse.status_code = http_response.status
145
+ raise bse
@@ -0,0 +1,37 @@
1
+ # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
2
+ # Copyright 2010 United States Government as represented by the
3
+ # Administrator of the National Aeronautics and Space Administration.
4
+ # Copyright 2011 Piston Cloud Computing, Inc.
5
+ # All Rights Reserved.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
8
+ # not use this file except in compliance with the License. You may obtain
9
+ # a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ """
19
+ This module provides common models for AIHC-SDK.
20
+ """
21
+
22
+
23
+ class DemoModel(object):
24
+ """
25
+ This class defines the configuration for a demo.
26
+ """
27
+
28
+ def __init__(self, demo_name, demo_config):
29
+ """
30
+ 初始化演示模型
31
+
32
+ Args:
33
+ demo_name: 演示名称
34
+ demo_config: 演示配置
35
+ """
36
+ self.demo_name = demo_name
37
+ self.demo_config = demo_config
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4
+ # except in compliance with the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software distributed under the
9
+ # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10
+ # either express or implied. See the License for the specific language governing permissions
11
+ # and limitations under the License.
12
+
13
+ """
14
+ AIHC base module.
15
+ """
@@ -0,0 +1,174 @@
1
+ # Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4
+ # except in compliance with the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software distributed under the
9
+ # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10
+ # either express or implied. See the License for the specific language governing permissions
11
+ # and limitations under the License.
12
+
13
+ """
14
+ AIHC base client module.
15
+ """
16
+ import copy
17
+
18
+ from baidubce import bce_base_client
19
+ from baidubce.auth import bce_v1_signer
20
+ from baidubce.http import handler, bce_http_client
21
+ from baidubce.services.aihc import aihc_handler
22
+
23
+
24
+ class AIHCBaseClient(bce_base_client.BceBaseClient):
25
+ """
26
+ AIHC基础客户端类,提供公共方法
27
+ """
28
+
29
+ version = b'v2'
30
+
31
+ def __init__(self, config=None):
32
+ """
33
+ 初始化AIHC基础客户端
34
+
35
+ Args:
36
+ config: 配置对象,baidubce.bce_client_configuration.BceClientConfiguration实例
37
+ """
38
+ bce_base_client.BceBaseClient.__init__(self, config)
39
+
40
+ def _merge_config(self, config=None):
41
+ """
42
+ 合并配置对象
43
+
44
+ Args:
45
+ config: 要合并的配置对象,如果为None则返回当前配置
46
+
47
+ Returns:
48
+ baidubce.bce_client_configuration.BceClientConfiguration: 合并后的配置对象
49
+ """
50
+ if config is None:
51
+ return self.config
52
+ else:
53
+ new_config = copy.copy(self.config)
54
+ new_config.merge_non_none_values(config)
55
+ return new_config
56
+
57
+ def _send_request(self, http_method, path,
58
+ body=None, headers=None, params=None,
59
+ config=None, body_parser=None):
60
+ """
61
+ 发送HTTP请求
62
+
63
+ Args:
64
+ http_method: HTTP方法
65
+ path: 请求路径
66
+ body: 请求体(可选)
67
+ headers: 请求头(可选)
68
+ params: 请求参数(可选)
69
+ config: 配置对象(可选)
70
+ body_parser: 响应体解析器(可选)
71
+
72
+ Returns:
73
+ baidubce.bce_response.BceResponse: 响应对象
74
+ """
75
+ config = self._merge_config(config)
76
+ if body_parser is None:
77
+ body_parser = aihc_handler.parse_json
78
+
79
+ if headers is None:
80
+ headers = {
81
+ b'version': AIHCBaseClient.version,
82
+ b'Content-Type': b'application/json'
83
+ }
84
+ else:
85
+ headers[b'version'] = AIHCBaseClient.version
86
+ headers[b'Content-Type'] = b'application/json'
87
+
88
+ return bce_http_client.send_request(
89
+ config, bce_v1_signer.sign, [handler.parse_error, body_parser],
90
+ http_method, path, body, headers, params)
91
+
92
+ def _send_job_request(
93
+ self,
94
+ http_method,
95
+ path,
96
+ body=None,
97
+ headers=None,
98
+ params=None,
99
+ config=None,
100
+ body_parser=None
101
+ ):
102
+ """
103
+ 发送任务相关HTTP请求
104
+
105
+ Args:
106
+ http_method: HTTP方法
107
+ path: 请求路径
108
+ body: 请求体(可选)
109
+ headers: 请求头(可选)
110
+ params: 请求参数(可选)
111
+ config: 配置对象(可选)
112
+ body_parser: 响应体解析器(可选)
113
+
114
+ Returns:
115
+ baidubce.bce_response.BceResponse: 响应对象
116
+ """
117
+ config = self._merge_config(config)
118
+ if body_parser is None:
119
+ body_parser = aihc_handler.parse_json
120
+
121
+ if headers is None:
122
+ headers = {
123
+ b'X-API-Version': AIHCBaseClient.version,
124
+ b'Content-Type': b'application/json'
125
+ }
126
+ else:
127
+ headers[b'X-API-Version'] = AIHCBaseClient.version
128
+ headers[b'Content-Type'] = b'application/json'
129
+
130
+ return bce_http_client.send_request(
131
+ config, bce_v1_signer.sign, [handler.parse_error, body_parser],
132
+ http_method, path, body, headers, params)
133
+
134
+ def _send_resource_pool_request(
135
+ self,
136
+ http_method,
137
+ path,
138
+ body=None,
139
+ headers=None,
140
+ params=None,
141
+ config=None,
142
+ body_parser=None
143
+ ):
144
+ """
145
+ 适配资源池接口,发送请求时使用bce_v1_signer.resource_pool_sign方法签名
146
+
147
+ Args:
148
+ http_method: HTTP方法
149
+ path: 请求路径
150
+ body: 请求体(可选)
151
+ headers: 请求头(可选)
152
+ params: 请求参数(可选)
153
+ config: 配置对象(可选)
154
+ body_parser: 响应体解析器(可选)
155
+
156
+ Returns:
157
+ baidubce.bce_response.BceResponse: 响应对象
158
+ """
159
+ config = self._merge_config(config)
160
+ if body_parser is None:
161
+ body_parser = aihc_handler.parse_json
162
+
163
+ if headers is None:
164
+ headers = {
165
+ b'version': AIHCBaseClient.version,
166
+ b'Content-Type': b'application/json'
167
+ }
168
+ else:
169
+ headers[b'version'] = AIHCBaseClient.version
170
+ headers[b'Content-Type'] = b'application/json'
171
+
172
+ return bce_http_client.send_request(
173
+ config, bce_v1_signer.resource_pool_sign, [handler.parse_error, body_parser],
174
+ http_method, path, body, headers, params)