"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SubnetMigrationsApi = void 0;
var _ApiClient = require("../ApiClient");
var _TaskReferenceApiResponse = _interopRequireDefault(require("../models/networking/v4/config/TaskReferenceApiResponse"));
var _VnicMigrationItemSpec = _interopRequireDefault(require("../models/networking/v4/config/VnicMigrationItemSpec"));
var _VlanSubnetMigrationSpec = _interopRequireDefault(require("../models/networking/v4/config/VlanSubnetMigrationSpec"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } /*
 * Nutanix Networking APIs
 *
 * OpenAPI spec version: 4.0.1
 *
 * NOTE: This class is auto generated by the Open API Dev Platform.
 *
 * Open API Dev Platform Codegen version: 16.9.0.8546-RELEASE
 *
 * Do not edit the class manually.
 *
 */
/**
 * SubnetMigrations service.
 * @version 4.0.1
 * @class SubnetMigrationsApi
 */
var _headersToSkip = /*#__PURE__*/new WeakMap();
var SubnetMigrationsApi = exports.SubnetMigrationsApi = /*#__PURE__*/function () {
  /**
   * Constructs a new SubnetMigrationsApi. 
   * @alias module:api/SubnetMigrationsApi
   * @class
   * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
   * default to {@link module:ApiClient#instance} if unspecified.
   */
  function SubnetMigrationsApi(apiClient) {
    _classCallCheck(this, SubnetMigrationsApi);
    _classPrivateFieldInitSpec(this, _headersToSkip, void 0);
    this.apiClient = apiClient || _ApiClient.ApiClient.instance;
    _classPrivateFieldSet(_headersToSkip, this, new Set());
    _classPrivateFieldGet(_headersToSkip, this).add('authorization');
    _classPrivateFieldGet(_headersToSkip, this).add('cookie');
    _classPrivateFieldGet(_headersToSkip, this).add('host');
    _classPrivateFieldGet(_headersToSkip, this).add('user-agent');
  }

  /**
   * Migrate VLAN subnets from VLAN basic to VLAN advanced.
   * Migrate VLAN subnets from VLAN basic to VLAN advanced.
   * @param { Required<Pick<VlanSubnetMigrationSpec, 'subnets'>> & Partial<VlanSubnetMigrationSpec> } body specification
   * @param {Object} args Additional Arguments
   * @return {Promise<ConfigTaskReferenceApiResponse>} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link ConfigTaskReferenceApiResponse } and HTTP response
   */
  return _createClass(SubnetMigrationsApi, [{
    key: "migrateSubnets",
    value: function migrateSubnets(body) {
      var _this = this;
      var argMap = (arguments.length <= 1 ? 0 : arguments.length - 1) > 0 ? arguments.length <= 1 ? undefined : arguments[1] : {};
      var postBody = null;
      if (body instanceof _VlanSubnetMigrationSpec["default"] && typeof body.toJson === 'function') {
        postBody = body.toJson();
      } else {
        postBody = body;
      }
      // verify the required parameter 'body' is set
      if (typeof postBody === 'undefined' || postBody === null) {
        throw new Error("Invalid body when calling migrateSubnets");
      }
      var pathParams = {};
      var queryParams = {};
      var headersToInclude = {};
      Object.keys(argMap).forEach(function (header) {
        if (!_classPrivateFieldGet(_headersToSkip, _this).has(header.toLowerCase())) {
          headersToInclude[header] = argMap[header];
        }
      });
      var headerParams = _objectSpread({}, headersToInclude);
      var formParams = {};
      _ApiClient.ApiClient.addEtagReferenceToHeader(body, headerParams);
      var authNames = ['apiKeyAuthScheme', 'basicAuthScheme'];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = _TaskReferenceApiResponse["default"];
      return this.apiClient.callApi('/api/networking/v4.0/config/$actions/migrate-subnets', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType);
    }

    /**
     * Migrate vNICs from Acropolis to Atlas or vice-versa.
     * Migrate vNICs from Acropolis to Atlas or vice-versa.
     * @param { Partial<VnicMigrationItemSpec> } body specification
     * @param { String } extId UUID of NIC to be migrated.
     * @param {Object} args Additional Arguments
     * @return {Promise<ConfigTaskReferenceApiResponse>} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link ConfigTaskReferenceApiResponse } and HTTP response
     */
  }, {
    key: "migrateVnicById",
    value: function migrateVnicById(extId, body) {
      var _this2 = this;
      var argMap = (arguments.length <= 2 ? 0 : arguments.length - 2) > 0 ? arguments.length <= 2 ? undefined : arguments[2] : {};
      var postBody = null;
      if (body instanceof _VnicMigrationItemSpec["default"] && typeof body.toJson === 'function') {
        postBody = body.toJson();
      } else {
        postBody = body;
      }
      // verify the required parameter 'extId' is set
      if (typeof extId === 'undefined' || extId === null) {
        throw new Error("Missing the required parameter 'extId' when calling migrateVnicById");
      }
      // verify the required parameter 'body' is set
      if (typeof postBody === 'undefined' || postBody === null) {
        throw new Error("Invalid body when calling migrateVnicById");
      }
      var pathParams = {
        'extId': extId
      };
      var queryParams = {};
      var headersToInclude = {};
      Object.keys(argMap).forEach(function (header) {
        if (!_classPrivateFieldGet(_headersToSkip, _this2).has(header.toLowerCase())) {
          headersToInclude[header] = argMap[header];
        }
      });
      var headerParams = _objectSpread({}, headersToInclude);
      var formParams = {};
      _ApiClient.ApiClient.addEtagReferenceToHeader(body, headerParams);
      var authNames = ['apiKeyAuthScheme', 'basicAuthScheme'];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = _TaskReferenceApiResponse["default"];
      return this.apiClient.callApi('/api/networking/v4.0/config/vnics/{extId}/$actions/migrate', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType);
    }
  }], [{
    key: "ApiClient",
    get:
    /**
    * Make the default {@link ApiClient} class available for developers to be able to extend it and bring
    * their own fetch methods into the SDK
    */
    function get() {
      return _ApiClient.ApiClient;
    }
  }]);
}();