mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 21:00:06 +01:00
440 lines
13 KiB
TypeScript
440 lines
13 KiB
TypeScript
/* 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 {
|
|
DtoAnnotationResponse,
|
|
DtoCreateAnnotationRequest,
|
|
DtoUpdateAnnotationRequest,
|
|
} from "../models/index";
|
|
import {
|
|
DtoAnnotationResponseFromJSON,
|
|
DtoAnnotationResponseToJSON,
|
|
DtoCreateAnnotationRequestFromJSON,
|
|
DtoCreateAnnotationRequestToJSON,
|
|
DtoUpdateAnnotationRequestFromJSON,
|
|
DtoUpdateAnnotationRequestToJSON,
|
|
} from "../models/index";
|
|
|
|
export interface CreateAnnotationRequest {
|
|
dtoCreateAnnotationRequest: DtoCreateAnnotationRequest;
|
|
xOrgID?: string;
|
|
}
|
|
|
|
export interface DeleteAnnotationRequest {
|
|
id: string;
|
|
xOrgID?: string;
|
|
}
|
|
|
|
export interface GetAnnotationRequest {
|
|
id: string;
|
|
xOrgID?: string;
|
|
}
|
|
|
|
export interface ListAnnotationsRequest {
|
|
xOrgID?: string;
|
|
key?: string;
|
|
value?: string;
|
|
q?: string;
|
|
}
|
|
|
|
export interface UpdateAnnotationRequest {
|
|
id: string;
|
|
dtoUpdateAnnotationRequest: DtoUpdateAnnotationRequest;
|
|
xOrgID?: string;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export class AnnotationsApi extends runtime.BaseAPI {
|
|
/**
|
|
* Creates an annotation.
|
|
* Create annotation (org scoped)
|
|
*/
|
|
async createAnnotationRaw(
|
|
requestParameters: CreateAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<runtime.ApiResponse<DtoAnnotationResponse>> {
|
|
if (requestParameters["dtoCreateAnnotationRequest"] == null) {
|
|
throw new runtime.RequiredError(
|
|
"dtoCreateAnnotationRequest",
|
|
'Required parameter "dtoCreateAnnotationRequest" was null or undefined when calling createAnnotation().',
|
|
);
|
|
}
|
|
|
|
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 = `/annotations`;
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: urlPath,
|
|
method: "POST",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: DtoCreateAnnotationRequestToJSON(
|
|
requestParameters["dtoCreateAnnotationRequest"],
|
|
),
|
|
},
|
|
initOverrides,
|
|
);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
DtoAnnotationResponseFromJSON(jsonValue),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Creates an annotation.
|
|
* Create annotation (org scoped)
|
|
*/
|
|
async createAnnotation(
|
|
requestParameters: CreateAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<DtoAnnotationResponse> {
|
|
const response = await this.createAnnotationRaw(
|
|
requestParameters,
|
|
initOverrides,
|
|
);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Permanently deletes the annotation.
|
|
* Delete annotation (org scoped)
|
|
*/
|
|
async deleteAnnotationRaw(
|
|
requestParameters: DeleteAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters["id"] == null) {
|
|
throw new runtime.RequiredError(
|
|
"id",
|
|
'Required parameter "id" was null or undefined when calling deleteAnnotation().',
|
|
);
|
|
}
|
|
|
|
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 = `/annotations/{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);
|
|
}
|
|
|
|
/**
|
|
* Permanently deletes the annotation.
|
|
* Delete annotation (org scoped)
|
|
*/
|
|
async deleteAnnotation(
|
|
requestParameters: DeleteAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<void> {
|
|
await this.deleteAnnotationRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* Returns one annotation. Add `include=node_pools` to include node pools.
|
|
* Get annotation by ID (org scoped)
|
|
*/
|
|
async getAnnotationRaw(
|
|
requestParameters: GetAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<runtime.ApiResponse<DtoAnnotationResponse>> {
|
|
if (requestParameters["id"] == null) {
|
|
throw new runtime.RequiredError(
|
|
"id",
|
|
'Required parameter "id" was null or undefined when calling getAnnotation().',
|
|
);
|
|
}
|
|
|
|
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 = `/annotations/{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) =>
|
|
DtoAnnotationResponseFromJSON(jsonValue),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns one annotation. Add `include=node_pools` to include node pools.
|
|
* Get annotation by ID (org scoped)
|
|
*/
|
|
async getAnnotation(
|
|
requestParameters: GetAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<DtoAnnotationResponse> {
|
|
const response = await this.getAnnotationRaw(
|
|
requestParameters,
|
|
initOverrides,
|
|
);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Returns annotations for the organization in X-Org-ID. Filters: `key`, `value`, and `q` (key contains). Add `include=node_pools` to include linked node pools.
|
|
* List annotations (org scoped)
|
|
*/
|
|
async listAnnotationsRaw(
|
|
requestParameters: ListAnnotationsRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<runtime.ApiResponse<Array<DtoAnnotationResponse>>> {
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters["key"] != null) {
|
|
queryParameters["key"] = requestParameters["key"];
|
|
}
|
|
|
|
if (requestParameters["value"] != null) {
|
|
queryParameters["value"] = requestParameters["value"];
|
|
}
|
|
|
|
if (requestParameters["q"] != null) {
|
|
queryParameters["q"] = requestParameters["q"];
|
|
}
|
|
|
|
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 = `/annotations`;
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: urlPath,
|
|
method: "GET",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
},
|
|
initOverrides,
|
|
);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
jsonValue.map(DtoAnnotationResponseFromJSON),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns annotations for the organization in X-Org-ID. Filters: `key`, `value`, and `q` (key contains). Add `include=node_pools` to include linked node pools.
|
|
* List annotations (org scoped)
|
|
*/
|
|
async listAnnotations(
|
|
requestParameters: ListAnnotationsRequest = {},
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<Array<DtoAnnotationResponse>> {
|
|
const response = await this.listAnnotationsRaw(
|
|
requestParameters,
|
|
initOverrides,
|
|
);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Partially update annotation fields.
|
|
* Update annotation (org scoped)
|
|
*/
|
|
async updateAnnotationRaw(
|
|
requestParameters: UpdateAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<runtime.ApiResponse<DtoAnnotationResponse>> {
|
|
if (requestParameters["id"] == null) {
|
|
throw new runtime.RequiredError(
|
|
"id",
|
|
'Required parameter "id" was null or undefined when calling updateAnnotation().',
|
|
);
|
|
}
|
|
|
|
if (requestParameters["dtoUpdateAnnotationRequest"] == null) {
|
|
throw new runtime.RequiredError(
|
|
"dtoUpdateAnnotationRequest",
|
|
'Required parameter "dtoUpdateAnnotationRequest" was null or undefined when calling updateAnnotation().',
|
|
);
|
|
}
|
|
|
|
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 = `/annotations/{id}`;
|
|
urlPath = urlPath.replace(
|
|
`{${"id"}}`,
|
|
encodeURIComponent(String(requestParameters["id"])),
|
|
);
|
|
|
|
const response = await this.request(
|
|
{
|
|
path: urlPath,
|
|
method: "PATCH",
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: DtoUpdateAnnotationRequestToJSON(
|
|
requestParameters["dtoUpdateAnnotationRequest"],
|
|
),
|
|
},
|
|
initOverrides,
|
|
);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
DtoAnnotationResponseFromJSON(jsonValue),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Partially update annotation fields.
|
|
* Update annotation (org scoped)
|
|
*/
|
|
async updateAnnotation(
|
|
requestParameters: UpdateAnnotationRequest,
|
|
initOverrides?: RequestInit | runtime.InitOverrideFunction,
|
|
): Promise<DtoAnnotationResponse> {
|
|
const response = await this.updateAnnotationRaw(
|
|
requestParameters,
|
|
initOverrides,
|
|
);
|
|
return await response.value();
|
|
}
|
|
}
|