UNPKG

@anansi-lineage/anansi-azure-import

Version:

Client code to get Azure Resources via REST API.

131 lines (126 loc) 10.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 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); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /** * REST_API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. * */ /** * Default service. * @module api/DefaultApi * @version 1.0.0 */ var DefaultApi = exports["default"] = /*#__PURE__*/function () { /** * Constructs a new DefaultApi. * @alias module:api/DefaultApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function DefaultApi(apiClient) { _classCallCheck(this, DefaultApi); this.apiClient = apiClient || _ApiClient["default"].instance; } /** * Callback function to receive the result of the subscriptionsSubscriptionIdResourcesGet operation. * @callback module:api/DefaultApi~subscriptionsSubscriptionIdResourcesGetCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Json * @param {String} subscriptionId * @param {Object} opts Optional parameters * @param {String} [apiVersion] * @param {module:api/DefaultApi~subscriptionsSubscriptionIdResourcesGetCallback} callback The callback function, accepting three arguments: error, data, response */ _createClass(DefaultApi, [{ key: "subscriptionsSubscriptionIdResourcesGet", value: function subscriptionsSubscriptionIdResourcesGet(subscriptionId, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'subscriptionId' is set if (subscriptionId === undefined || subscriptionId === null) { throw new Error("Missing the required parameter 'subscriptionId' when calling subscriptionsSubscriptionIdResourcesGet"); } var pathParams = { 'subscription-id': subscriptionId }; var queryParams = { 'api-version': opts['apiVersion'] }; var headerParams = { 'Access-Control-Allow-Origin': '*' }; var formParams = {}; var authNames = ['bearerAuth']; var contentTypes = []; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/subscriptions/{subscription-id}/resources', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the tenentIdOauth2TokenPost operation. * @callback module:api/DefaultApi~tenentIdOauth2TokenPostCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * access token * @param {String} tenentId * @param {Object} opts Optional parameters * @param {String} [grantType] * @param {String} [clientId] * @param {String} [clientSecret] new1 * @param {String} [resource] * @param {module:api/DefaultApi~tenentIdOauth2TokenPostCallback} callback The callback function, accepting three arguments: error, data, response */ }, { key: "tenentIdOauth2TokenPost", value: function tenentIdOauth2TokenPost(tenentId, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'tenentId' is set if (tenentId === undefined || tenentId === null) { throw new Error("Missing the required parameter 'tenentId' when calling tenentIdOauth2TokenPost"); } var pathParams = { 'tenent-id': tenentId }; var queryParams = {}; var headerParams = {}; var formParams = { 'grant_type': opts['grantType'], 'client_id': opts['clientId'], 'client_secret': opts['clientSecret'], 'resource': opts['resource'] }; var authNames = []; var contentTypes = ['application/x-www-form-urlencoded']; var accepts = ['application/json; charset=utf-8']; var returnType = null; return this.apiClient.callApi('/{tenent-id}/oauth2/token', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } }]); return DefaultApi; }();