/* tslint:disable */
/* eslint-disable */
/**
 * AssistedInstall
 * Assisted installation
 *
 * 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.
 */

import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import {
  DUMMY_BASE_URL,
  assertParamExists,
  setApiKeyToObject,
  setBasicAuthToObject,
  setBearerAuthToObject,
  setOAuthToObject,
  setSearchParams,
  serializeDataIfNeeded,
  toPathString,
  createRequestFunction,
} from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
// @ts-ignore
import { InfraError } from '../models';
// @ts-ignore
import { ModelError } from '../models';
// @ts-ignore
import { MonitoredOperatorsList } from '../models';
// @ts-ignore
import { OperatorMonitorReport } from '../models';
// @ts-ignore
import { OperatorProperties } from '../models';
/**
 * OperatorsApi - axios parameter creator
 * @export
 */
export const OperatorsApiAxiosParamCreator = function (configuration?: Configuration) {
  return {
    /**
     * Lists operators to be monitored for a cluster.
     * @param {string} clusterId The cluster to return operators for.
     * @param {string} [operatorName] An operator in the specified cluster to return its data.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListOfClusterOperators: async (
      clusterId: string,
      operatorName?: string,
      options: AxiosRequestConfig = {},
    ): Promise<RequestArgs> => {
      // verify required parameter 'clusterId' is not null or undefined
      assertParamExists('v2ListOfClusterOperators', 'clusterId', clusterId);
      const localVarPath = `/v2/clusters/{cluster_id}/monitored-operators`.replace(
        `{${'cluster_id'}}`,
        encodeURIComponent(String(clusterId)),
      );
      // use dummy base URL string because the URL constructor only accepts absolute URLs.
      const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
      let baseOptions;
      if (configuration) {
        baseOptions = configuration.baseOptions;
      }

      const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication agentAuth required
      await setApiKeyToObject(localVarHeaderParameter, 'X-Secret-Key', configuration);

      if (operatorName !== undefined) {
        localVarQueryParameter['operator_name'] = operatorName;
      }

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers,
      };

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Lists properties for an operator.
     * @param {string} operatorName The operator name.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListOperatorProperties: async (
      operatorName: string,
      options: AxiosRequestConfig = {},
    ): Promise<RequestArgs> => {
      // verify required parameter 'operatorName' is not null or undefined
      assertParamExists('v2ListOperatorProperties', 'operatorName', operatorName);
      const localVarPath = `/v2/supported-operators/{operator_name}`.replace(
        `{${'operator_name'}}`,
        encodeURIComponent(String(operatorName)),
      );
      // use dummy base URL string because the URL constructor only accepts absolute URLs.
      const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
      let baseOptions;
      if (configuration) {
        baseOptions = configuration.baseOptions;
      }

      const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication userAuth required
      await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers,
      };

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Retrieves the list of supported operators.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListSupportedOperators: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
      const localVarPath = `/v2/supported-operators`;
      // use dummy base URL string because the URL constructor only accepts absolute URLs.
      const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
      let baseOptions;
      if (configuration) {
        baseOptions = configuration.baseOptions;
      }

      const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication userAuth required
      await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers,
      };

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Controller API to report of monitored operators.
     * @param {string} clusterId The cluster whose operators are being monitored.
     * @param {OperatorMonitorReport} reportParams The operators monitor report.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ReportMonitoredOperatorStatus: async (
      clusterId: string,
      reportParams: OperatorMonitorReport,
      options: AxiosRequestConfig = {},
    ): Promise<RequestArgs> => {
      // verify required parameter 'clusterId' is not null or undefined
      assertParamExists('v2ReportMonitoredOperatorStatus', 'clusterId', clusterId);
      // verify required parameter 'reportParams' is not null or undefined
      assertParamExists('v2ReportMonitoredOperatorStatus', 'reportParams', reportParams);
      const localVarPath = `/v2/clusters/{cluster_id}/monitored-operators`.replace(
        `{${'cluster_id'}}`,
        encodeURIComponent(String(clusterId)),
      );
      // use dummy base URL string because the URL constructor only accepts absolute URLs.
      const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
      let baseOptions;
      if (configuration) {
        baseOptions = configuration.baseOptions;
      }

      const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options };
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      // authentication agentAuth required
      await setApiKeyToObject(localVarHeaderParameter, 'X-Secret-Key', configuration);

      localVarHeaderParameter['Content-Type'] = 'application/json';

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers,
      };
      localVarRequestOptions.data = serializeDataIfNeeded(
        reportParams,
        localVarRequestOptions,
        configuration,
      );

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
  };
};

/**
 * OperatorsApi - functional programming interface
 * @export
 */
export const OperatorsApiFp = function (configuration?: Configuration) {
  const localVarAxiosParamCreator = OperatorsApiAxiosParamCreator(configuration);
  return {
    /**
     * Lists operators to be monitored for a cluster.
     * @param {string} clusterId The cluster to return operators for.
     * @param {string} [operatorName] An operator in the specified cluster to return its data.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async v2ListOfClusterOperators(
      clusterId: string,
      operatorName?: string,
      options?: AxiosRequestConfig,
    ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<MonitoredOperatorsList>> {
      const localVarAxiosArgs = await localVarAxiosParamCreator.v2ListOfClusterOperators(
        clusterId,
        operatorName,
        options,
      );
      return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
    },
    /**
     * Lists properties for an operator.
     * @param {string} operatorName The operator name.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async v2ListOperatorProperties(
      operatorName: string,
      options?: AxiosRequestConfig,
    ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OperatorProperties>> {
      const localVarAxiosArgs = await localVarAxiosParamCreator.v2ListOperatorProperties(
        operatorName,
        options,
      );
      return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
    },
    /**
     * Retrieves the list of supported operators.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async v2ListSupportedOperators(
      options?: AxiosRequestConfig,
    ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<string>>> {
      const localVarAxiosArgs = await localVarAxiosParamCreator.v2ListSupportedOperators(options);
      return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
    },
    /**
     * Controller API to report of monitored operators.
     * @param {string} clusterId The cluster whose operators are being monitored.
     * @param {OperatorMonitorReport} reportParams The operators monitor report.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async v2ReportMonitoredOperatorStatus(
      clusterId: string,
      reportParams: OperatorMonitorReport,
      options?: AxiosRequestConfig,
    ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
      const localVarAxiosArgs = await localVarAxiosParamCreator.v2ReportMonitoredOperatorStatus(
        clusterId,
        reportParams,
        options,
      );
      return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
    },
  };
};

/**
 * OperatorsApi - factory interface
 * @export
 */
export const OperatorsApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance,
) {
  const localVarFp = OperatorsApiFp(configuration);
  return {
    /**
     * Lists operators to be monitored for a cluster.
     * @param {OperatorsApiV2ListOfClusterOperatorsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListOfClusterOperators(
      requestParameters: OperatorsApiV2ListOfClusterOperatorsRequest,
      options?: AxiosRequestConfig,
    ): AxiosPromise<MonitoredOperatorsList> {
      return localVarFp
        .v2ListOfClusterOperators(
          requestParameters.clusterId,
          requestParameters.operatorName,
          options,
        )
        .then((request) => request(axios, basePath));
    },
    /**
     * Lists properties for an operator.
     * @param {OperatorsApiV2ListOperatorPropertiesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListOperatorProperties(
      requestParameters: OperatorsApiV2ListOperatorPropertiesRequest,
      options?: AxiosRequestConfig,
    ): AxiosPromise<OperatorProperties> {
      return localVarFp
        .v2ListOperatorProperties(requestParameters.operatorName, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Retrieves the list of supported operators.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListSupportedOperators(options?: AxiosRequestConfig): AxiosPromise<Array<string>> {
      return localVarFp
        .v2ListSupportedOperators(options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Controller API to report of monitored operators.
     * @param {OperatorsApiV2ReportMonitoredOperatorStatusRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ReportMonitoredOperatorStatus(
      requestParameters: OperatorsApiV2ReportMonitoredOperatorStatusRequest,
      options?: AxiosRequestConfig,
    ): AxiosPromise<void> {
      return localVarFp
        .v2ReportMonitoredOperatorStatus(
          requestParameters.clusterId,
          requestParameters.reportParams,
          options,
        )
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for v2ListOfClusterOperators operation in OperatorsApi.
 * @export
 * @interface OperatorsApiV2ListOfClusterOperatorsRequest
 */
export interface OperatorsApiV2ListOfClusterOperatorsRequest {
  /**
   * The cluster to return operators for.
   * @type {string}
   * @memberof OperatorsApiV2ListOfClusterOperators
   */
  readonly clusterId: string;

  /**
   * An operator in the specified cluster to return its data.
   * @type {string}
   * @memberof OperatorsApiV2ListOfClusterOperators
   */
  readonly operatorName?: string;
}

/**
 * Request parameters for v2ListOperatorProperties operation in OperatorsApi.
 * @export
 * @interface OperatorsApiV2ListOperatorPropertiesRequest
 */
export interface OperatorsApiV2ListOperatorPropertiesRequest {
  /**
   * The operator name.
   * @type {string}
   * @memberof OperatorsApiV2ListOperatorProperties
   */
  readonly operatorName: string;
}

/**
 * Request parameters for v2ReportMonitoredOperatorStatus operation in OperatorsApi.
 * @export
 * @interface OperatorsApiV2ReportMonitoredOperatorStatusRequest
 */
export interface OperatorsApiV2ReportMonitoredOperatorStatusRequest {
  /**
   * The cluster whose operators are being monitored.
   * @type {string}
   * @memberof OperatorsApiV2ReportMonitoredOperatorStatus
   */
  readonly clusterId: string;

  /**
   * The operators monitor report.
   * @type {OperatorMonitorReport}
   * @memberof OperatorsApiV2ReportMonitoredOperatorStatus
   */
  readonly reportParams: OperatorMonitorReport;
}

/**
 * OperatorsApi - object-oriented interface
 * @export
 * @class OperatorsApi
 * @extends {BaseAPI}
 */
export class OperatorsApi extends BaseAPI {
  /**
   * Lists operators to be monitored for a cluster.
   * @param {OperatorsApiV2ListOfClusterOperatorsRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof OperatorsApi
   */
  public v2ListOfClusterOperators(
    requestParameters: OperatorsApiV2ListOfClusterOperatorsRequest,
    options?: AxiosRequestConfig,
  ) {
    return OperatorsApiFp(this.configuration)
      .v2ListOfClusterOperators(
        requestParameters.clusterId,
        requestParameters.operatorName,
        options,
      )
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Lists properties for an operator.
   * @param {OperatorsApiV2ListOperatorPropertiesRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof OperatorsApi
   */
  public v2ListOperatorProperties(
    requestParameters: OperatorsApiV2ListOperatorPropertiesRequest,
    options?: AxiosRequestConfig,
  ) {
    return OperatorsApiFp(this.configuration)
      .v2ListOperatorProperties(requestParameters.operatorName, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Retrieves the list of supported operators.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof OperatorsApi
   */
  public v2ListSupportedOperators(options?: AxiosRequestConfig) {
    return OperatorsApiFp(this.configuration)
      .v2ListSupportedOperators(options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Controller API to report of monitored operators.
   * @param {OperatorsApiV2ReportMonitoredOperatorStatusRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof OperatorsApi
   */
  public v2ReportMonitoredOperatorStatus(
    requestParameters: OperatorsApiV2ReportMonitoredOperatorStatusRequest,
    options?: AxiosRequestConfig,
  ) {
    return OperatorsApiFp(this.configuration)
      .v2ReportMonitoredOperatorStatus(
        requestParameters.clusterId,
        requestParameters.reportParams,
        options,
      )
      .then((request) => request(this.axios, this.basePath));
  }
}
