import * as API from "@distilled.cloud/core/api"; import * as C from "@distilled.cloud/core/category"; // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-dokploy/specs/openapi.json). Do not edit. import * as S from "@distilled.cloud/core/schema-lite"; import * as __L from "@distilled.cloud/core/schema-lite"; import { DokployServiceErrors } from "../errors.ts"; import { DokployProtocol, type DokployOpError, type DokployOpContext } from "../protocol.ts"; import * as Retry from "../retry.ts"; import * as T from "../traits.ts"; // Schema table, filled on first reach (see __S at the end). const __s: any[] = []; export type { DokployOpError, DokployOpContext }; /** Span facts shared by every operation (com.distilled.telemetry#service). */ const TELEMETRY = { system: "dokploy-api", responseHeaders: [ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" }, { header: "request-id", name: "http.response.header.request-id", transform: "list" }, ], prefix: "Dokploy", service: "ServerSecurity", propagate: "w3c", } as const; export class BadRequest extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("BadRequest", { code: S.Number, message: S.String, body: /*@__PURE__*/ S.optional( /*@__PURE__*/ S.Union([/*@__PURE__*/ S.suspend(() => __S(2, __c0, 2)), S.String]), ), headers: /*@__PURE__*/ S.optional(/*@__PURE__*/ S.Record(S.String, S.String)), }).pipe(C.withBadRequestError), [{ status: 400 }], ) { declare readonly body?: ErrorBADREQUEST | string; } export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, body: /*@__PURE__*/ S.optional( /*@__PURE__*/ S.Union([/*@__PURE__*/ S.suspend(() => __S(2, __c0, 2)), S.String]), ), headers: /*@__PURE__*/ S.optional(/*@__PURE__*/ S.Record(S.String, S.String)), }).pipe(C.withAuthError), [{ status: 403 }], ) { declare readonly body?: ErrorFORBIDDEN | string; } export class NotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("NotFound", { code: S.Number, message: S.String, body: /*@__PURE__*/ S.optional( /*@__PURE__*/ S.Union([/*@__PURE__*/ S.suspend(() => __S(2, __c0, 2)), S.String]), ), headers: /*@__PURE__*/ S.optional(/*@__PURE__*/ S.Record(S.String, S.String)), }).pipe(C.withBadRequestError), [{ status: 404 }], ) { declare readonly body?: ErrorNOTFOUND | string; } export interface BanServerSecurityIpRequest { serverId: string; ip: string; } export type BanServerSecurityIpResponse = unknown; export type ConfigureServerSecurityFail2banRequestBantime = number | number; export type ConfigureServerSecurityFail2banRequestIgnoreipList = Array; export interface ConfigureServerSecurityFail2banRequest { serverId: string; bantime: ConfigureServerSecurityFail2banRequestBantime; findtime: number; maxretry: number; ignoreip: ConfigureServerSecurityFail2banRequestIgnoreipList; } export type ConfigureServerSecurityFail2banResponse = unknown; export interface DisconnectServerSecuritySessionRequest { serverId: string; terminal: string; banIp?: string | undefined; } export type DisconnectServerSecuritySessionResponse = unknown; export interface GetServerSecurityActivityRequest { serverId: string; } export type GetServerSecurityActivityResponse = unknown; export interface GetServerSecurityExposedPortsRequest { serverId: string; } export type GetServerSecurityExposedPortsResponse = unknown; export interface GetServerSecurityFail2banStatusRequest { serverId: string; } export type GetServerSecurityFail2banStatusResponse = unknown; export interface GetServerSecurityPendingUpdatesRequest { serverId: string; } export type GetServerSecurityPendingUpdatesResponse = unknown; export interface GetServerSecuritySshSecurityRequest { serverId: string; } export type GetServerSecuritySshSecurityResponse = unknown; export interface RemoveServerSecurityAuthorizedKeyRequest { serverId: string; fingerprint: string; } export type RemoveServerSecurityAuthorizedKeyResponse = unknown; export interface SetServerSecurityFail2banEnabledRequest { serverId: string; enabled: boolean; } export type SetServerSecurityFail2banEnabledResponse = unknown; export interface UnbanServerSecurityIpRequest { serverId: string; jail: string; ip: string; } export type UnbanServerSecurityIpResponse = unknown; export type UpdateServerSecuritySshSettingsRequestPermitRootLogin = | "yes" | "prohibit-password" | "no"; export interface UpdateServerSecuritySshSettingsRequest { serverId: string; passwordAuthentication: boolean; permitRootLogin: UpdateServerSecuritySshSettingsRequestPermitRootLogin | (string & {}); maxAuthTries: number; } export type UpdateServerSecuritySshSettingsResponse = unknown; export interface ErrorBADREQUESTIssuesItem { message: string; } /** An array of issues that were responsible for the error */ export type ErrorBADREQUESTIssuesList = Array; /** The error information */ export interface ErrorBADREQUEST { /** The error message */ message: string; /** The error code */ code: string; /** An array of issues that were responsible for the error */ issues?: ErrorBADREQUESTIssuesList | undefined; } export type ErrorFORBIDDENIssuesItem = ErrorBADREQUESTIssuesItem; /** An array of issues that were responsible for the error */ export type ErrorFORBIDDENIssuesList = Array; /** The error information */ export interface ErrorFORBIDDEN { /** The error message */ message: string; /** The error code */ code: string; /** An array of issues that were responsible for the error */ issues?: ErrorFORBIDDENIssuesList | undefined; } export type ErrorNOTFOUNDIssuesItem = ErrorBADREQUESTIssuesItem; /** An array of issues that were responsible for the error */ export type ErrorNOTFOUNDIssuesList = Array; /** The error information */ export interface ErrorNOTFOUND { /** The error message */ message: string; /** The error code */ code: string; /** An array of issues that were responsible for the error */ issues?: ErrorNOTFOUNDIssuesList | undefined; } export type BanServerSecurityIpError = BadRequest | Forbidden | DokployOpError; export const banServerSecurityIp: API.OperationMethod< BanServerSecurityIpRequest, BanServerSecurityIpResponse, BanServerSecurityIpError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(24, __c6, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "BanServerSecurityIp", })); export type ConfigureServerSecurityFail2banError = BadRequest | Forbidden | DokployOpError; export const configureServerSecurityFail2ban: API.OperationMethod< ConfigureServerSecurityFail2banRequest, ConfigureServerSecurityFail2banResponse, ConfigureServerSecurityFail2banError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(33, __c8, 1) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "ConfigureServerSecurityFail2ban", })); export type DisconnectServerSecuritySessionError = BadRequest | Forbidden | DokployOpError; export const disconnectServerSecuritySession: API.OperationMethod< DisconnectServerSecuritySessionRequest, DisconnectServerSecuritySessionResponse, DisconnectServerSecuritySessionError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(36, __c9, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "DisconnectServerSecuritySession", })); export type GetServerSecurityActivityError = BadRequest | Forbidden | NotFound | DokployOpError; export const getServerSecurityActivity: API.OperationMethod< GetServerSecurityActivityRequest, GetServerSecurityActivityResponse, GetServerSecurityActivityError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(40, __c10, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden, NotFound], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "GetServerSecurityActivity", })); export type GetServerSecurityExposedPortsError = BadRequest | Forbidden | NotFound | DokployOpError; export const getServerSecurityExposedPorts: API.OperationMethod< GetServerSecurityExposedPortsRequest, GetServerSecurityExposedPortsResponse, GetServerSecurityExposedPortsError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(44, __c11, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden, NotFound], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "GetServerSecurityExposedPorts", })); export type GetServerSecurityFail2banStatusError = | BadRequest | Forbidden | NotFound | DokployOpError; export const getServerSecurityFail2banStatus: API.OperationMethod< GetServerSecurityFail2banStatusRequest, GetServerSecurityFail2banStatusResponse, GetServerSecurityFail2banStatusError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(48, __c12, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden, NotFound], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "GetServerSecurityFail2banStatus", })); export type GetServerSecurityPendingUpdatesError = | BadRequest | Forbidden | NotFound | DokployOpError; export const getServerSecurityPendingUpdates: API.OperationMethod< GetServerSecurityPendingUpdatesRequest, GetServerSecurityPendingUpdatesResponse, GetServerSecurityPendingUpdatesError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(52, __c13, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden, NotFound], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "GetServerSecurityPendingUpdates", })); export type GetServerSecuritySshSecurityError = BadRequest | Forbidden | NotFound | DokployOpError; export const getServerSecuritySshSecurity: API.OperationMethod< GetServerSecuritySshSecurityRequest, GetServerSecuritySshSecurityResponse, GetServerSecuritySshSecurityError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(4, __c1, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden, NotFound], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "GetServerSecuritySshSecurity", })); export type RemoveServerSecurityAuthorizedKeyError = BadRequest | Forbidden | DokployOpError; export const removeServerSecurityAuthorizedKey: API.OperationMethod< RemoveServerSecurityAuthorizedKeyRequest, RemoveServerSecurityAuthorizedKeyResponse, RemoveServerSecurityAuthorizedKeyError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(8, __c2, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "RemoveServerSecurityAuthorizedKey", })); export type SetServerSecurityFail2banEnabledError = BadRequest | Forbidden | DokployOpError; export const setServerSecurityFail2banEnabled: API.OperationMethod< SetServerSecurityFail2banEnabledRequest, SetServerSecurityFail2banEnabledResponse, SetServerSecurityFail2banEnabledError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(12, __c3, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "SetServerSecurityFail2banEnabled", })); export type UnbanServerSecurityIpError = BadRequest | Forbidden | DokployOpError; export const unbanServerSecurityIp: API.OperationMethod< UnbanServerSecurityIpRequest, UnbanServerSecurityIpResponse, UnbanServerSecurityIpError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(16, __c4, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "UnbanServerSecurityIp", })); export type UpdateServerSecuritySshSettingsError = BadRequest | Forbidden | DokployOpError; export const updateServerSecuritySshSettings: API.OperationMethod< UpdateServerSecuritySshSettingsRequest, UpdateServerSecuritySshSettingsResponse, UpdateServerSecuritySshSettingsError, DokployOpContext > = /*@__PURE__*/ API.make(() => ({ input: __S(20, __c5, 0) as any as S.Schema, output: __S(28, __c7, 0) as any as S.Schema, errors: [BadRequest, Forbidden], serviceErrors: DokployServiceErrors, protocol: DokployProtocol, retry: Retry.Retry, telemetry: TELEMETRY, span: "UpdateServerSecuritySshSettings", })); // Schema builders: each runs one schema initializer, on that schema's first use. function __c0(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ message: S.String, }), ).annotate({ identifier: "ErrorBADREQUESTIssuesItem" }); case 1: return S.Array(__S(0, __c0, 0)); case 2: return S.suspend(() => S.Struct({ message: S.String, code: S.String, issues: S.optional(__S(1, __c0, 1)), }), ).annotate({ identifier: "ErrorBADREQUEST" }); } } function __c1(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String.pipe(T.Query()), }).pipe(T.Http({ method: "GET", uri: "/serverSecurity.sshSecurity", code: 200 })), ).annotate({ identifier: "GetServerSecuritySshSecurityRequest" }); } } function __c2(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String, fingerprint: S.String, }).pipe(T.Http({ method: "POST", uri: "/serverSecurity.removeAuthorizedKey", code: 200 })), ).annotate({ identifier: "RemoveServerSecurityAuthorizedKeyRequest" }); } } function __c3(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String, enabled: S.Boolean, }).pipe(T.Http({ method: "POST", uri: "/serverSecurity.setFail2banEnabled", code: 200 })), ).annotate({ identifier: "SetServerSecurityFail2banEnabledRequest" }); } } function __c4(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String, jail: S.String, ip: S.String, }).pipe(T.Http({ method: "POST", uri: "/serverSecurity.unbanIp", code: 200 })), ).annotate({ identifier: "UnbanServerSecurityIpRequest" }); } } function __c5(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String, passwordAuthentication: S.Boolean, permitRootLogin: S.String, maxAuthTries: S.Number, }).pipe(T.Http({ method: "POST", uri: "/serverSecurity.updateSshSettings", code: 200 })), ).annotate({ identifier: "UpdateServerSecuritySshSettingsRequest" }); } } function __c6(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String, ip: S.String, }).pipe(T.Http({ method: "POST", uri: "/serverSecurity.banIp", code: 200 })), ).annotate({ identifier: "BanServerSecurityIpRequest" }); } } function __c7(j: number): any { switch (j) { case 0: return S.suspend(() => S.Unknown.pipe(T.RawResponseRoot())).annotate({ identifier: "BanServerSecurityIpResponse", }); } } function __c8(j: number): any { switch (j) { case 0: return S.Array(S.String); case 1: return S.suspend(() => S.Struct({ serverId: S.String, bantime: S.Unknown, findtime: S.Number, maxretry: S.Number, ignoreip: __S(32, __c8, 0), }).pipe(T.Http({ method: "POST", uri: "/serverSecurity.configureFail2ban", code: 200 })), ).annotate({ identifier: "ConfigureServerSecurityFail2banRequest" }); } } function __c9(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String, terminal: S.String, banIp: S.optional(S.String), }).pipe(T.Http({ method: "POST", uri: "/serverSecurity.disconnectSession", code: 200 })), ).annotate({ identifier: "DisconnectServerSecuritySessionRequest" }); } } function __c10(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String.pipe(T.Query()), }).pipe(T.Http({ method: "GET", uri: "/serverSecurity.activity", code: 200 })), ).annotate({ identifier: "GetServerSecurityActivityRequest" }); } } function __c11(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String.pipe(T.Query()), }).pipe(T.Http({ method: "GET", uri: "/serverSecurity.exposedPorts", code: 200 })), ).annotate({ identifier: "GetServerSecurityExposedPortsRequest" }); } } function __c12(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String.pipe(T.Query()), }).pipe(T.Http({ method: "GET", uri: "/serverSecurity.fail2banStatus", code: 200 })), ).annotate({ identifier: "GetServerSecurityFail2banStatusRequest" }); } } function __c13(j: number): any { switch (j) { case 0: return S.suspend(() => S.Struct({ serverId: S.String.pipe(T.Query()), }).pipe(T.Http({ method: "GET", uri: "/serverSecurity.pendingUpdates", code: 200 })), ).annotate({ identifier: "GetServerSecurityPendingUpdatesRequest" }); } } // Schema table: entry i is schema j of builder f, made on first reach. function __S(i: number, f: (j: number) => unknown, j: number): any { return (__s[i] ??= __L.at(f, j)); }