/* tslint:disable */ /* eslint-disable */ /** * AutoGlue API * API for managing K3s clusters across cloud providers * * The version of the OpenAPI document: dev * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from "../runtime"; import type { DtoCreateLoadBalancerRequest, DtoLoadBalancerResponse, DtoUpdateLoadBalancerRequest, } from "../models/index"; import { DtoCreateLoadBalancerRequestFromJSON, DtoCreateLoadBalancerRequestToJSON, DtoLoadBalancerResponseFromJSON, DtoLoadBalancerResponseToJSON, DtoUpdateLoadBalancerRequestFromJSON, DtoUpdateLoadBalancerRequestToJSON, } from "../models/index"; export interface CreateLoadBalancerRequest { dtoCreateLoadBalancerRequest: DtoCreateLoadBalancerRequest; xOrgID?: string; } export interface DeleteLoadBalancerRequest { id: string; xOrgID?: string; } export interface GetLoadBalancersRequest { id: string; xOrgID?: string; } export interface ListLoadBalancersRequest { xOrgID?: string; } export interface UpdateLoadBalancerRequest { id: string; dtoUpdateLoadBalancerRequest: DtoUpdateLoadBalancerRequest; xOrgID?: string; } /** * */ export class LoadBalancersApi extends runtime.BaseAPI { /** * Create a load balancer */ async createLoadBalancerRaw( requestParameters: CreateLoadBalancerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise> { if (requestParameters["dtoCreateLoadBalancerRequest"] == null) { throw new runtime.RequiredError( "dtoCreateLoadBalancerRequest", 'Required parameter "dtoCreateLoadBalancerRequest" was null or undefined when calling createLoadBalancer().', ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Content-Type"] = "application/json"; if (requestParameters["xOrgID"] != null) { headerParameters["X-Org-ID"] = String(requestParameters["xOrgID"]); } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-KEY"] = await this.configuration.apiKey("X-ORG-KEY"); // OrgKeyAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-SECRET"] = await this.configuration.apiKey("X-ORG-SECRET"); // OrgSecretAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication } let urlPath = `/load-balancers`; const response = await this.request( { path: urlPath, method: "POST", headers: headerParameters, query: queryParameters, body: DtoCreateLoadBalancerRequestToJSON( requestParameters["dtoCreateLoadBalancerRequest"], ), }, initOverrides, ); return new runtime.JSONApiResponse(response, (jsonValue) => DtoLoadBalancerResponseFromJSON(jsonValue), ); } /** * Create a load balancer */ async createLoadBalancer( requestParameters: CreateLoadBalancerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise { const response = await this.createLoadBalancerRaw( requestParameters, initOverrides, ); return await response.value(); } /** * Delete a load balancer */ async deleteLoadBalancerRaw( requestParameters: DeleteLoadBalancerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise> { if (requestParameters["id"] == null) { throw new runtime.RequiredError( "id", 'Required parameter "id" was null or undefined when calling deleteLoadBalancer().', ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters["xOrgID"] != null) { headerParameters["X-Org-ID"] = String(requestParameters["xOrgID"]); } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-KEY"] = await this.configuration.apiKey("X-ORG-KEY"); // OrgKeyAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-SECRET"] = await this.configuration.apiKey("X-ORG-SECRET"); // OrgSecretAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication } let urlPath = `/load-balancers/{id}`; urlPath = urlPath.replace( `{${"id"}}`, encodeURIComponent(String(requestParameters["id"])), ); const response = await this.request( { path: urlPath, method: "DELETE", headers: headerParameters, query: queryParameters, }, initOverrides, ); return new runtime.VoidApiResponse(response); } /** * Delete a load balancer */ async deleteLoadBalancer( requestParameters: DeleteLoadBalancerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise { await this.deleteLoadBalancerRaw(requestParameters, initOverrides); } /** * Returns load balancer for the organization in X-Org-ID. * Get a load balancer (org scoped) */ async getLoadBalancersRaw( requestParameters: GetLoadBalancersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise>> { if (requestParameters["id"] == null) { throw new runtime.RequiredError( "id", 'Required parameter "id" was null or undefined when calling getLoadBalancers().', ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters["xOrgID"] != null) { headerParameters["X-Org-ID"] = String(requestParameters["xOrgID"]); } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-KEY"] = await this.configuration.apiKey("X-ORG-KEY"); // OrgKeyAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-SECRET"] = await this.configuration.apiKey("X-ORG-SECRET"); // OrgSecretAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication } let urlPath = `/load-balancers/{id}`; urlPath = urlPath.replace( `{${"id"}}`, encodeURIComponent(String(requestParameters["id"])), ); const response = await this.request( { path: urlPath, method: "GET", headers: headerParameters, query: queryParameters, }, initOverrides, ); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(DtoLoadBalancerResponseFromJSON), ); } /** * Returns load balancer for the organization in X-Org-ID. * Get a load balancer (org scoped) */ async getLoadBalancers( requestParameters: GetLoadBalancersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise> { const response = await this.getLoadBalancersRaw( requestParameters, initOverrides, ); return await response.value(); } /** * Returns load balancers for the organization in X-Org-ID. * List load balancers (org scoped) */ async listLoadBalancersRaw( requestParameters: ListLoadBalancersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters["xOrgID"] != null) { headerParameters["X-Org-ID"] = String(requestParameters["xOrgID"]); } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-KEY"] = await this.configuration.apiKey("X-ORG-KEY"); // OrgKeyAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-SECRET"] = await this.configuration.apiKey("X-ORG-SECRET"); // OrgSecretAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication } let urlPath = `/load-balancers`; const response = await this.request( { path: urlPath, method: "GET", headers: headerParameters, query: queryParameters, }, initOverrides, ); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(DtoLoadBalancerResponseFromJSON), ); } /** * Returns load balancers for the organization in X-Org-ID. * List load balancers (org scoped) */ async listLoadBalancers( requestParameters: ListLoadBalancersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise> { const response = await this.listLoadBalancersRaw( requestParameters, initOverrides, ); return await response.value(); } /** * Update a load balancer (org scoped) */ async updateLoadBalancerRaw( requestParameters: UpdateLoadBalancerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise> { if (requestParameters["id"] == null) { throw new runtime.RequiredError( "id", 'Required parameter "id" was null or undefined when calling updateLoadBalancer().', ); } if (requestParameters["dtoUpdateLoadBalancerRequest"] == null) { throw new runtime.RequiredError( "dtoUpdateLoadBalancerRequest", 'Required parameter "dtoUpdateLoadBalancerRequest" was null or undefined when calling updateLoadBalancer().', ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters["Content-Type"] = "application/json"; if (requestParameters["xOrgID"] != null) { headerParameters["X-Org-ID"] = String(requestParameters["xOrgID"]); } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-KEY"] = await this.configuration.apiKey("X-ORG-KEY"); // OrgKeyAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["X-ORG-SECRET"] = await this.configuration.apiKey("X-ORG-SECRET"); // OrgSecretAuth authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication } let urlPath = `/load-balancers/{id}`; urlPath = urlPath.replace( `{${"id"}}`, encodeURIComponent(String(requestParameters["id"])), ); const response = await this.request( { path: urlPath, method: "PATCH", headers: headerParameters, query: queryParameters, body: DtoUpdateLoadBalancerRequestToJSON( requestParameters["dtoUpdateLoadBalancerRequest"], ), }, initOverrides, ); return new runtime.JSONApiResponse(response, (jsonValue) => DtoLoadBalancerResponseFromJSON(jsonValue), ); } /** * Update a load balancer (org scoped) */ async updateLoadBalancer( requestParameters: UpdateLoadBalancerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction, ): Promise { const response = await this.updateLoadBalancerRaw( requestParameters, initOverrides, ); return await response.value(); } }