mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 04:40:05 +01:00
fix: rename sdk to match repo & introduce git subtree
This commit is contained in:
435
sdk/ts/src/apis/ServersApi.ts
Normal file
435
sdk/ts/src/apis/ServersApi.ts
Normal file
@@ -0,0 +1,435 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* AutoGlue API
|
||||
* API for managing K3s clusters across cloud providers
|
||||
*
|
||||
* The version of the OpenAPI document: 1.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 * as runtime from "../runtime";
|
||||
import type {
|
||||
DtoCreateServerRequest,
|
||||
DtoServerResponse,
|
||||
DtoUpdateServerRequest,
|
||||
} from "../models/index";
|
||||
import {
|
||||
DtoCreateServerRequestFromJSON,
|
||||
DtoCreateServerRequestToJSON,
|
||||
DtoServerResponseFromJSON,
|
||||
DtoServerResponseToJSON,
|
||||
DtoUpdateServerRequestFromJSON,
|
||||
DtoUpdateServerRequestToJSON,
|
||||
} from "../models/index";
|
||||
|
||||
export interface CreateServerRequest {
|
||||
body: DtoCreateServerRequest;
|
||||
xOrgID?: string;
|
||||
}
|
||||
|
||||
export interface DeleteServerRequest {
|
||||
id: string;
|
||||
xOrgID?: string;
|
||||
}
|
||||
|
||||
export interface GetServerRequest {
|
||||
id: string;
|
||||
xOrgID?: string;
|
||||
}
|
||||
|
||||
export interface ListServersRequest {
|
||||
xOrgID?: string;
|
||||
status?: string;
|
||||
role?: string;
|
||||
}
|
||||
|
||||
export interface UpdateServerRequest {
|
||||
id: string;
|
||||
body: DtoUpdateServerRequest;
|
||||
xOrgID?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export class ServersApi extends runtime.BaseAPI {
|
||||
/**
|
||||
* Creates a server bound to the org in X-Org-ID. Validates that ssh_key_id belongs to the org.
|
||||
* Create server (org scoped)
|
||||
*/
|
||||
async createServerRaw(
|
||||
requestParameters: CreateServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<runtime.ApiResponse<DtoServerResponse>> {
|
||||
if (requestParameters["body"] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
"body",
|
||||
'Required parameter "body" was null or undefined when calling createServer().',
|
||||
);
|
||||
}
|
||||
|
||||
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 = `/servers`;
|
||||
|
||||
const response = await this.request(
|
||||
{
|
||||
path: urlPath,
|
||||
method: "POST",
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
body: DtoCreateServerRequestToJSON(requestParameters["body"]),
|
||||
},
|
||||
initOverrides,
|
||||
);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
||||
DtoServerResponseFromJSON(jsonValue),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a server bound to the org in X-Org-ID. Validates that ssh_key_id belongs to the org.
|
||||
* Create server (org scoped)
|
||||
*/
|
||||
async createServer(
|
||||
requestParameters: CreateServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<DtoServerResponse> {
|
||||
const response = await this.createServerRaw(
|
||||
requestParameters,
|
||||
initOverrides,
|
||||
);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Permanently deletes the server.
|
||||
* Delete server (org scoped)
|
||||
*/
|
||||
async deleteServerRaw(
|
||||
requestParameters: DeleteServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<runtime.ApiResponse<string>> {
|
||||
if (requestParameters["id"] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
"id",
|
||||
'Required parameter "id" was null or undefined when calling deleteServer().',
|
||||
);
|
||||
}
|
||||
|
||||
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 = `/servers/{id}`;
|
||||
urlPath = urlPath.replace(
|
||||
`{${"id"}}`,
|
||||
encodeURIComponent(String(requestParameters["id"])),
|
||||
);
|
||||
|
||||
const response = await this.request(
|
||||
{
|
||||
path: urlPath,
|
||||
method: "DELETE",
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
},
|
||||
initOverrides,
|
||||
);
|
||||
|
||||
if (this.isJsonMime(response.headers.get("content-type"))) {
|
||||
return new runtime.JSONApiResponse<string>(response);
|
||||
} else {
|
||||
return new runtime.TextApiResponse(response) as any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Permanently deletes the server.
|
||||
* Delete server (org scoped)
|
||||
*/
|
||||
async deleteServer(
|
||||
requestParameters: DeleteServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<string> {
|
||||
const response = await this.deleteServerRaw(
|
||||
requestParameters,
|
||||
initOverrides,
|
||||
);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one server in the given organization.
|
||||
* Get server by ID (org scoped)
|
||||
*/
|
||||
async getServerRaw(
|
||||
requestParameters: GetServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<runtime.ApiResponse<DtoServerResponse>> {
|
||||
if (requestParameters["id"] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
"id",
|
||||
'Required parameter "id" was null or undefined when calling getServer().',
|
||||
);
|
||||
}
|
||||
|
||||
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 = `/servers/{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) =>
|
||||
DtoServerResponseFromJSON(jsonValue),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one server in the given organization.
|
||||
* Get server by ID (org scoped)
|
||||
*/
|
||||
async getServer(
|
||||
requestParameters: GetServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<DtoServerResponse> {
|
||||
const response = await this.getServerRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns servers for the organization in X-Org-ID. Optional filters: status, role.
|
||||
* List servers (org scoped)
|
||||
*/
|
||||
async listServersRaw(
|
||||
requestParameters: ListServersRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<runtime.ApiResponse<Array<DtoServerResponse>>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
if (requestParameters["status"] != null) {
|
||||
queryParameters["status"] = requestParameters["status"];
|
||||
}
|
||||
|
||||
if (requestParameters["role"] != null) {
|
||||
queryParameters["role"] = requestParameters["role"];
|
||||
}
|
||||
|
||||
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 = `/servers`;
|
||||
|
||||
const response = await this.request(
|
||||
{
|
||||
path: urlPath,
|
||||
method: "GET",
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
},
|
||||
initOverrides,
|
||||
);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
||||
jsonValue.map(DtoServerResponseFromJSON),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns servers for the organization in X-Org-ID. Optional filters: status, role.
|
||||
* List servers (org scoped)
|
||||
*/
|
||||
async listServers(
|
||||
requestParameters: ListServersRequest = {},
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<Array<DtoServerResponse>> {
|
||||
const response = await this.listServersRaw(
|
||||
requestParameters,
|
||||
initOverrides,
|
||||
);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Partially update fields; changing ssh_key_id validates ownership.
|
||||
* Update server (org scoped)
|
||||
*/
|
||||
async updateServerRaw(
|
||||
requestParameters: UpdateServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<runtime.ApiResponse<DtoServerResponse>> {
|
||||
if (requestParameters["id"] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
"id",
|
||||
'Required parameter "id" was null or undefined when calling updateServer().',
|
||||
);
|
||||
}
|
||||
|
||||
if (requestParameters["body"] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
"body",
|
||||
'Required parameter "body" was null or undefined when calling updateServer().',
|
||||
);
|
||||
}
|
||||
|
||||
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 = `/servers/{id}`;
|
||||
urlPath = urlPath.replace(
|
||||
`{${"id"}}`,
|
||||
encodeURIComponent(String(requestParameters["id"])),
|
||||
);
|
||||
|
||||
const response = await this.request(
|
||||
{
|
||||
path: urlPath,
|
||||
method: "PATCH",
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
body: DtoUpdateServerRequestToJSON(requestParameters["body"]),
|
||||
},
|
||||
initOverrides,
|
||||
);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
||||
DtoServerResponseFromJSON(jsonValue),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Partially update fields; changing ssh_key_id validates ownership.
|
||||
* Update server (org scoped)
|
||||
*/
|
||||
async updateServer(
|
||||
requestParameters: UpdateServerRequest,
|
||||
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
||||
): Promise<DtoServerResponse> {
|
||||
const response = await this.updateServerRaw(
|
||||
requestParameters,
|
||||
initOverrides,
|
||||
);
|
||||
return await response.value();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user