@alauda/doom
Version:
Doctor Doom making docs.
21 lines (20 loc) • 14.4 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { FallbackHeading } from '@rspress/core/theme';
import virtual from 'doom-@api-virtual';
import { plural } from 'pluralize';
import { APIReferenceLink } from './_APIReferenceLink.js';
import { X } from './_X.js';
const QueryParameters = ({ fieldValidation = true, }) => {
return (_jsxs(_Fragment, { children: [_jsx("dl", { children: _jsx("dt", { children: "Query parameters" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Parameter" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "dryRun" }) }), _jsx("td", { children: _jsx("code", { children: "string" }) }), _jsx("td", { children: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed" })] }), fieldValidation && (_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "fieldValidation" }) }), _jsx("td", { children: _jsx("code", { children: "string" }) }), _jsx("td", { children: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered." })] }))] })] })] }));
};
const BodyParameters = ({ kind }) => {
return (_jsxs(_Fragment, { children: [_jsx("dl", { children: _jsx("dt", { children: "Body parameters" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Parameter" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "body" }) }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] }), _jsxs("td", { children: [_jsx("code", { children: "application/json" }), " formatted"] })] }) })] })] }));
};
const K8sAPIListEndpoint = ({ kind }) => (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "DELETE" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["delete collection of ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["list objects of kind ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsxs("code", { children: [kind, "List"] }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "POST" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["create a new ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "202 - Accepted" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
const K8sAPIItemEndpoint = ({ kind }) => (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "DELETE" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["delete the specified ", kind] })] }), _jsx(QueryParameters, { fieldValidation: false }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "202 - Accepted" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["read the specified ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PATCH" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["partially update the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PUT" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["replace the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
const K8sAPIStatusEndpoint = ({ kind }) => (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["read status of the specified ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PATCH" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["partially update status of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PUT" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["replace status of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
export const K8sAPIEndpoints = ({ hasStatus, group, version, kind, pathPrefix: pathPrefix_, namespaced = true, }) => {
const pathPrefix = pathPrefix_ ?? (virtual.pathPrefix || '');
const apiPath = `${pathPrefix}/${group ? `apis/${group}` : 'api'}/${version}/${namespaced ? `namespaces/{namespace}/` : ''}${plural(kind).toLocaleLowerCase()}`;
return (_jsxs(_Fragment, { children: [_jsx(FallbackHeading, { level: 2, title: "API Endpoints" }), _jsx(X.p, { children: "The following API endpoints are available:" }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: apiPath }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "DELETE" }), ": delete collection of ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": list objects of kind ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "POST" }), ": create a new ", kind] })] })] }), _jsxs(X.li, { children: [_jsx("code", { children: `${apiPath}/{name}` }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "DELETE" }), ": delete the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": read the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PATCH" }), ": partially update the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PUT" }), ": replace the specified ", kind] })] })] }), hasStatus && (_jsxs(X.li, { children: [_jsx("code", { children: `${apiPath}/{name}/status` }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": read status of the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PATCH" }), ": partially update status of the specified", ' ', kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PUT" }), ": replace status of the specified ", kind] })] })] }))] }), _jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: apiPath }) }), _jsx(K8sAPIListEndpoint, { kind: kind }), _jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${apiPath}/{name}` }) }), _jsx(K8sAPIItemEndpoint, { kind: kind }), hasStatus && (_jsxs(_Fragment, { children: [_jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${apiPath}/{name}/status` }) }), _jsx(K8sAPIStatusEndpoint, { kind: kind })] }))] }));
};