'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _regeneratorRuntime = require('@babel/runtime/regenerator');
var tslib_es6 = require('../../tslib.es6-0d92ef81.js');
var tencentCloud_base_base = require('../base/base.js');
require('axios');
require('../../nodejs/crypto.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);

function createPrefetchTask(_ref) {
  var secretId = _ref.secretId,
    secretKey = _ref.secretKey,
    targets = _ref.targets,
    zoneId = _ref.zoneId;
  return tslib_es6.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
    return _regeneratorRuntime__default["default"].wrap(function (_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          return _context.abrupt("return", tencentCloud_base_base.fetchCloudData({
            secretId: secretId,
            secretKey: secretKey,
            action: 'CreatePrefetchTask',
            version: '2022-09-01',
            endpoint: 'teo.tencentcloudapi.com',
            service: 'teo',
            payload: JSON.stringify({
              ZoneId: zoneId,
              Targets: targets
            })
          }));
        case 1:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
}

exports.createPrefetchTask = createPrefetchTask;
