text: "use strict";
  /**
   * Kubernetes
   * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
   *
   * The version of the OpenAPI document: v1.21.1
   *
   *
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.AuthorizationV1Api = exports.AuthorizationV1ApiApiKeys = void 0;
  const localVarRequest = require("request");
  const models_1 = require("../model/models");
  const models_2 = require("../model/models");
  const apis_1 = require("./apis");
  let defaultBasePath = 'http://localhost';
  // ===============================================
  // This file is autogenerated - Please do not edit
  // ===============================================
  var AuthorizationV1ApiApiKeys;
  (function (AuthorizationV1ApiApiKeys) {
      AuthorizationV1ApiApiKeys[AuthorizationV1ApiApiKeys["BearerToken"] = 0] = "BearerToken";
  })(AuthorizationV1ApiApiKeys = exports.AuthorizationV1ApiApiKeys || (exports.AuthorizationV1ApiApiKeys = {}));
  class AuthorizationV1Api {
      constructor(basePathOrUsername, password, basePath) {
          this._basePath = defaultBasePath;
          this._defaultHeaders = {};
          this._useQuerystring = false;
          this.authentications = {
              'default': new models_1.VoidAuth(),
              'BearerToken': new models_2.ApiKeyAuth('header', 'authorization'),
          };
          this.interceptors = [];
          if (password) {
              if (basePath) {
                  this.basePath = basePath;
              }
          }
          else {
              if (basePathOrUsername) {
                  this.basePath = basePathOrUsername;
              }
          }
      }
      set useQuerystring(value) {
          this._useQuerystring = value;
      }
      set basePath(basePath) {
          this._basePath = basePath;
      }
      set defaultHeaders(defaultHeaders) {
          this._defaultHeaders = defaultHeaders;
      }
      get defaultHeaders() {
          return this._defaultHeaders;
      }
      get basePath() {
          return this._basePath;
      }
      setDefaultAuthentication(auth) {
          this.authentications.default = auth;
      }
      setApiKey(key, value) {
          this.authentications[AuthorizationV1ApiApiKeys[key]].apiKey = value;
      }
      addInterceptor(interceptor) {
          this.interceptors.push(interceptor);
      }
      /**
       * create a LocalSubjectAccessReview
       * @param namespace object name and auth scope, such as for teams and projects
       * @param body
       * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
       * @param fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
       * @param pretty If \&#39;true\&#39;, then the output is pretty printed.
       */
      async createNamespacedLocalSubjectAccessReview(namespace, body, dryRun, fieldManager, pretty, options = { headers: {} }) {
          const localVarPath = this.basePath + '/apis/authorization.k8s.io/v1/namespaces/{namespace}/localsubjectaccessreviews'
              .replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
          let localVarQueryParameters = {};
          let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
          const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
          // give precedence to 'application/json'
          if (produces.indexOf('application/json') >= 0) {
              localVarHeaderParams.Accept = 'application/json';
          }
          else {
              localVarHeaderParams.Accept = produces.join(',');
          }
          let localVarFormParams = {};
          // verify required parameter 'namespace' is not null or undefined
          if (namespace === null || namespace === undefined) {
              throw new Error('Required parameter namespace was null or undefined when calling createNamespacedLocalSubjectAccessReview.');
          }
          // verify required parameter 'body' is not null or undefined
          if (body === null || body === undefined) {
              throw new Error('Required parameter body was null or undefined when calling createNamespacedLocalSubjectAccessReview.');
          }
          if (dryRun !== undefined) {
              localVarQueryParameters['dryRun'] = models_1.ObjectSerializer.serialize(dryRun, "string");
          }
          if (fieldManager !== undefined) {
              localVarQueryParameters['fieldManager'] = models_1.ObjectSerializer.serialize(fieldManager, "string");
          }
          if (pretty !== undefined) {
              localVarQueryParameters['pretty'] = models_1.ObjectSerializer.serialize(pretty, "string");
          }
          Object.assign(localVarHeaderParams, options.headers);
          let localVarUseFormData = false;
          let localVarRequestOptions = {
              method: 'POST',
              qs: localVarQueryParameters,
              headers: localVarHeaderParams,
              uri: localVarPath,
              useQuerystring: this._useQuerystring,
              json: true,
              body: models_1.ObjectSerializer.serialize(body, "V1LocalSubjectAccessReview")
          };
          let authenticationPromise = Promise.resolve();
          if (this.authentications.BearerToken.apiKey) {
              authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
          }
          authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
          let interceptorPromise = authenticationPromise;
          for (const interceptor of this.interceptors) {
              interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
          }
          return interceptorPromise.then(() => {
              if (Object.keys(localVarFormParams).length) {
                  if (localVarUseFormData) {
                      localVarRequestOptions.formData = localVarFormParams;
                  }
                  else {
                      localVarRequestOptions.form = localVarFormParams;
                  }
              }
              return new Promise((resolve, reject) => {
                  localVarRequest(localVarRequestOptions, (error, response, body) => {
                      if (error) {
                          reject(error);
                      }
                      else {
                          body = models_1.ObjectSerializer.deserialize(body, "V1LocalSubjectAccessReview");
                          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                              resolve({ response: response, body: body });
                          }
                          else {
                              reject(new apis_1.HttpError(response, body, response.statusCode));
                          }
                      }
                  });
              });
          });
      }
      /**
       * create a SelfSubjectAccessReview
       * @param body
       * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
       * @param fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
       * @param pretty If \&#39;true\&#39;, then the output is pretty printed.
       */
      async createSelfSubjectAccessReview(body, dryRun, fieldManager, pretty, options = { headers: {} }) {
          const localVarPath = this.basePath + '/apis/authorization.k8s.io/v1/selfsubjectaccessreviews';
          let localVarQueryParameters = {};
          let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
          const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
          // give precedence to 'application/json'
          if (produces.indexOf('application/json') >= 0) {
              localVarHeaderParams.Accept = 'application/json';
          }
          else {
              localVarHeaderParams.Accept = produces.join(',');
          }
          let localVarFormParams = {};
          // verify required parameter 'body' is not null or undefined
          if (body === null || body === undefined) {
              throw new Error('Required parameter body was null or undefined when calling createSelfSubjectAccessReview.');
          }
          if (dryRun !== undefined) {
              localVarQueryParameters['dryRun'] = models_1.ObjectSerializer.serialize(dryRun, "string");
          }
          if (fieldManager !== undefined) {
              localVarQueryParameters['fieldManager'] = models_1.ObjectSerializer.serialize(fieldManager, "string");
          }
          if (pretty !== undefined) {
              localVarQueryParameters['pretty'] = models_1.ObjectSerializer.serialize(pretty, "string");
          }
          Object.assign(localVarHeaderParams, options.headers);
          let localVarUseFormData = false;
          let localVarRequestOptions = {
              method: 'POST',
              qs: localVarQueryParameters,
              headers: localVarHeaderParams,
              uri: localVarPath,
              useQuerystring: this._useQuerystring,
              json: true,
              body: models_1.ObjectSerializer.serialize(body, "V1SelfSubjectAccessReview")
          };
          let authenticationPromise = Promise.resolve();
          if (this.authentications.BearerToken.apiKey) {
              authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
          }
          authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
          let interceptorPromise = authenticationPromise;
          for (const interceptor of this.interceptors) {
              interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
          }
          return interceptorPromise.then(() => {
              if (Object.keys(localVarFormParams).length) {
                  if (localVarUseFormData) {
                      localVarRequestOptions.formData = localVarFormParams;
                  }
                  else {
                      localVarRequestOptions.form = localVarFormParams;
                  }
              }
              return new Promise((resolve, reject) => {
                  localVarRequest(localVarRequestOptions, (error, response, body) => {
                      if (error) {
                          reject(error);
                      }
                      else {
                          body = models_1.ObjectSerializer.deserialize(body, "V1SelfSubjectAccessReview");
                          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                              resolve({ response: response, body: body });
                          }
                          else {
                              reject(new apis_1.HttpError(response, body, response.statusCode));
                          }
                      }
                  });
              });
          });
      }
      /**
       * create a SelfSubjectRulesReview
       * @param body
       * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
       * @param fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
       * @param pretty If \&#39;true\&#39;, then the output is pretty printed.
       */
      async createSelfSubjectRulesReview(body, dryRun, fieldManager, pretty, options = { headers: {} }) {
          const localVarPath = this.basePath + '/apis/authorization.k8s.io/v1/selfsubjectrulesreviews';
          let localVarQueryParameters = {};
          let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
          const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
          // give precedence to 'application/json'
          if (produces.indexOf('application/json') >= 0) {
              localVarHeaderParams.Accept = 'application/json';
          }
          else {
              localVarHeaderParams.Accept = produces.join(',');
          }
          let localVarFormParams = {};
          // verify required parameter 'body' is not null or undefined
          if (body === null || body === undefined) {
              throw new Error('Required parameter body was null or undefined when calling createSelfSubjectRulesReview.');
          }
          if (dryRun !== undefined) {
              localVarQueryParameters['dryRun'] = models_1.ObjectSerializer.serialize(dryRun, "string");
          }
          if (fieldManager !== undefined) {
              localVarQueryParameters['fieldManager'] = models_1.ObjectSerializer.serialize(fieldManager, "string");
          }
          if (pretty !== undefined) {
              localVarQueryParameters['pretty'] = models_1.ObjectSerializer.serialize(pretty, "string");
          }
          Object.assign(localVarHeaderParams, options.headers);
          let localVarUseFormData = false;
          let localVarRequestOptions = {
              method: 'POST',
              qs: localVarQueryParameters,
              headers: localVarHeaderParams,
              uri: localVarPath,
              useQuerystring: this._useQuerystring,
              json: true,
              body: models_1.ObjectSerializer.serialize(body, "V1SelfSubjectRulesReview")
          };
          let authenticationPromise = Promise.resolve();
          if (this.authentications.BearerToken.apiKey) {
              authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
          }
          authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
          let interceptorPromise = authenticationPromise;
          for (const interceptor of this.interceptors) {
              interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
          }
          return interceptorPromise.then(() => {
              if (Object.keys(localVarFormParams).length) {
                  if (localVarUseFormData) {
                      localVarRequestOptions.formData = localVarFormParams;
                  }
                  else {
                      localVarRequestOptions.form = localVarFormParams;
                  }
              }
              return new Promise((resolve, reject) => {
                  localVarRequest(localVarRequestOptions, (error, response, body) => {
                      if (error) {
                          reject(error);
                      }
                      else {
                          body = models_1.ObjectSerializer.deserialize(body, "V1SelfSubjectRulesReview");
                          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                              resolve({ response: response, body: body });
                          }
                          else {
                              reject(new apis_1.HttpError(response, body, response.statusCode));
                          }
                      }
                  });
              });
          });
      }
      /**
       * create a SubjectAccessReview
       * @param body
       * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
       * @param fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
       * @param pretty If \&#39;true\&#39;, then the output is pretty printed.
       */
      async createSubjectAccessReview(body, dryRun, fieldManager, pretty, options = { headers: {} }) {
          const localVarPath = this.basePath + '/apis/authorization.k8s.io/v1/subjectaccessreviews';
          let localVarQueryParameters = {};
          let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
          const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
          // give precedence to 'application/json'
          if (produces.indexOf('application/json') >= 0) {
              localVarHeaderParams.Accept = 'application/json';
          }
          else {
              localVarHeaderParams.Accept = produces.join(',');
          }
          let localVarFormParams = {};
          // verify required parameter 'body' is not null or undefined
          if (body === null || body === undefined) {
              throw new Error('Required parameter body was null or undefined when calling createSubjectAccessReview.');
          }
          if (dryRun !== undefined) {
              localVarQueryParameters['dryRun'] = models_1.ObjectSerializer.serialize(dryRun, "string");
          }
          if (fieldManager !== undefined) {
              localVarQueryParameters['fieldManager'] = models_1.ObjectSerializer.serialize(fieldManager, "string");
          }
          if (pretty !== undefined) {
              localVarQueryParameters['pretty'] = models_1.ObjectSerializer.serialize(pretty, "string");
          }
          Object.assign(localVarHeaderParams, options.headers);
          let localVarUseFormData = false;
          let localVarRequestOptions = {
              method: 'POST',
              qs: localVarQueryParameters,
              headers: localVarHeaderParams,
              uri: localVarPath,
              useQuerystring: this._useQuerystring,
              json: true,
              body: models_1.ObjectSerializer.serialize(body, "V1SubjectAccessReview")
          };
          let authenticationPromise = Promise.resolve();
          if (this.authentications.BearerToken.apiKey) {
              authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
          }
          authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
          let interceptorPromise = authenticationPromise;
          for (const interceptor of this.interceptors) {
              interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
          }
          return interceptorPromise.then(() => {
              if (Object.keys(localVarFormParams).length) {
                  if (localVarUseFormData) {
                      localVarRequestOptions.formData = localVarFormParams;
                  }
                  else {
                      localVarRequestOptions.form = localVarFormParams;
                  }
              }
              return new Promise((resolve, reject) => {
                  localVarRequest(localVarRequestOptions, (error, response, body) => {
                      if (error) {
                          reject(error);
                      }
                      else {
                          body = models_1.ObjectSerializer.deserialize(body, "V1SubjectAccessReview");
                          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                              resolve({ response: response, body: body });
                          }
                          else {
                              reject(new apis_1.HttpError(response, body, response.statusCode));
                          }
                      }
                  });
              });
          });
      }
      /**
       * get available resources
       */
      async getAPIResources(options = { headers: {} }) {
          const localVarPath = this.basePath + '/apis/authorization.k8s.io/v1/';
          let localVarQueryParameters = {};
          let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
          const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
          // give precedence to 'application/json'
          if (produces.indexOf('application/json') >= 0) {
              localVarHeaderParams.Accept = 'application/json';
          }
          else {
              localVarHeaderParams.Accept = produces.join(',');
          }
          let localVarFormParams = {};
          Object.assign(localVarHeaderParams, options.headers);
          let localVarUseFormData = false;
          let localVarRequestOptions = {
              method: 'GET',
              qs: localVarQueryParameters,
              headers: localVarHeaderParams,
              uri: localVarPath,
              useQuerystring: this._useQuerystring,
              json: true,
          };
          let authenticationPromise = Promise.resolve();
          if (this.authentications.BearerToken.apiKey) {
              authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
          }
          authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
          let interceptorPromise = authenticationPromise;
          for (const interceptor of this.interceptors) {
              interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
          }
          return interceptorPromise.then(() => {
              if (Object.keys(localVarFormParams).length) {
                  if (localVarUseFormData) {
                      localVarRequestOptions.formData = localVarFormParams;
                  }
                  else {
                      localVarRequestOptions.form = localVarFormParams;
                  }
              }
              return new Promise((resolve, reject) => {
                  localVarRequest(localVarRequestOptions, (error, response, body) => {
                      if (error) {
                          reject(error);
                      }
                      else {
                          body = models_1.ObjectSerializer.deserialize(body, "V1APIResourceList");
                          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                              resolve({ response: response, body: body });
                          }
                          else {
                              reject(new apis_1.HttpError(response, body, response.statusCode));
                          }
                      }
                  });
              });
          });
      }
  }
  exports.AuthorizationV1Api = AuthorizationV1Api;
  //# sourceMappingURL=authorizationV1Api.js.map