From 79544bb2c5e9d9e0efc217554c051b46994beca1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 2 Sep 2026 22:58:44 +0000 Subject: [PATCH 1/5] feat: add protobuf transport and generated runtime/meta protos Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com> --- package-lock.json | 80 + package.json | 2 + src/index.ts | 2 + src/proto-client.ts | 223 +- src/proto-client_test.ts | 200 + src/proto.ts | 2 + .../pkg/apis/meta/v1/generated.ts | 7077 +++++++++++++++++ .../apimachinery/pkg/runtime/generated.ts | 455 ++ .../pkg/runtime/schema/generated.ts | 9 + 9 files changed, 8027 insertions(+), 23 deletions(-) create mode 100644 src/proto-client_test.ts create mode 100644 src/proto.ts create mode 100644 src/proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.ts create mode 100644 src/proto/generated/k8s.io/apimachinery/pkg/runtime/generated.ts create mode 100644 src/proto/generated/k8s.io/apimachinery/pkg/runtime/schema/generated.ts diff --git a/package-lock.json b/package-lock.json index fcbe5ccc3c1..2fa64bb9208 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "2.0.0", "license": "Apache-2.0", "dependencies": { + "@bufbuild/protobuf": "^2.14.1", "@types/js-yaml": "^4.0.1", "@types/node": "^26.0.0", "@types/stream-buffers": "^3.0.3", @@ -34,6 +35,7 @@ "prettier": "^3.0.0", "pretty-quick": "^4.0.0", "ts-mockito": "^2.3.1", + "ts-proto": "^2.12.1", "tsx": "^4.21.0", "typescript": "~7.0.2" } @@ -48,6 +50,12 @@ "node": ">=18" } }, + "node_modules/@bufbuild/protobuf": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.14.1.tgz", + "integrity": "sha512-agRJn3+EJDUe8AvxTx/LnHA/GErvLE62pSaSk7+MwFOtOv8eWBu/qCq2qoZjBjVZ3C2aiFJCveuSs17KMkYGOw==", + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.28.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", @@ -1168,6 +1176,19 @@ "node": ">= 0.4" } }, + "node_modules/case-anything": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/cliui": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", @@ -1243,6 +1264,29 @@ "node": ">=0.4.0" } }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/dprint-node": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz", + "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-libc": "^1.0.3" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -2303,6 +2347,42 @@ "lodash": "^4.17.5" } }, + "node_modules/ts-poet": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.12.0.tgz", + "integrity": "sha512-xo+iRNMWqyvXpFTaOAvLPA5QAWO6TZrSUs5s4Odaya3epqofBu/fMLHEWl8jPmjhA0s9sgj9sNvF1BmaQlmQkA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dprint-node": "^1.0.8" + } + }, + "node_modules/ts-proto": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.12.1.tgz", + "integrity": "sha512-IEFvmib22yVlXbagL/UXcfliCPilgqXs3J0/ajDhUslfezMRhhhZvwgc63W0ZrKxCj+8jMHxvrN6G13A5UGFVg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.10.2", + "case-anything": "^2.1.13", + "ts-poet": "^6.12.0", + "ts-proto-descriptors": "2.1.0" + }, + "bin": { + "protoc-gen-ts_proto": "protoc-gen-ts_proto" + } + }, + "node_modules/ts-proto-descriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-2.1.0.tgz", + "integrity": "sha512-S5EZYEQ6L9KLFfjSRpZWDIXDV/W7tAj8uW7pLsihIxyr62EAVSiKuVPwE8iWnr849Bqa53enex1jhDUcpgquzA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.0.0" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", diff --git a/package.json b/package.json index aacd3598c31..dac62b6d905 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "author": "Kubernetes Authors", "license": "Apache-2.0", "dependencies": { + "@bufbuild/protobuf": "^2.14.1", "@types/js-yaml": "^4.0.1", "@types/node": "^26.0.0", "@types/stream-buffers": "^3.0.3", @@ -81,6 +82,7 @@ "prettier": "^3.0.0", "pretty-quick": "^4.0.0", "ts-mockito": "^2.3.1", + "ts-proto": "^2.12.1", "tsx": "^4.21.0", "typescript": "~7.0.2" }, diff --git a/src/index.ts b/src/index.ts index 746abcb71c2..4a3f2d08b73 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,4 +18,6 @@ export * from './object.js'; export * from './health.js'; export * from './middleware.js'; export * from './patch.js'; +export * from './proto-client.js'; +export * from './proto.js'; export { type ConfigOptions, type User, type Cluster, type Context } from './config_types.js'; diff --git a/src/proto-client.ts b/src/proto-client.ts index 98203d8e1a9..bdf3f66b041 100644 --- a/src/proto-client.ts +++ b/src/proto-client.ts @@ -1,35 +1,212 @@ import http from 'node:http'; +import https from 'node:https'; import { KubeConfig } from './config.js'; +import { DeleteOptions, Status } from './proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.js'; +import { Unknown } from './proto/generated/k8s.io/apimachinery/pkg/runtime/generated.js'; + +const MAGIC_PREFIX = Uint8Array.from([0x6b, 0x38, 0x73, 0x00]); +const PROTO_MEDIA_TYPE = 'application/vnd.kubernetes.protobuf'; + +export type ProtoRequestBody = Uint8Array | { serializeBinary(): Uint8Array }; + +export type ProtoDecoder = + | ((input: Uint8Array) => T) + | { decode(input: Uint8Array): T } + | { deserializeBinary(input: Uint8Array): T }; + +export interface ObjectOrStatus { + object: T | null; + status: Status | null; +} export class ProtoClient { - public readonly 'config': KubeConfig; - - public async get(msgType: any, requestPath: string): Promise { - const server = this.config.getCurrentCluster()!.server; - const u = new URL(server); - const options = { - path: requestPath, - hostname: u.hostname, - protocol: u.protocol, + public readonly config: KubeConfig; + + constructor(config: KubeConfig) { + this.config = config; + } + + public async get(decoder: ProtoDecoder, requestPath: string): Promise> { + return this.request('GET', decoder, requestPath); + } + + public async list(decoder: ProtoDecoder, requestPath: string): Promise> { + return this.get(decoder, requestPath); + } + + public async create( + decoder: ProtoDecoder, + requestPath: string, + body: ProtoRequestBody, + apiVersion: string, + kind: string, + ): Promise> { + return this.request('POST', decoder, requestPath, body, apiVersion, kind); + } + + public async update( + decoder: ProtoDecoder, + requestPath: string, + body: ProtoRequestBody, + apiVersion: string, + kind: string, + ): Promise> { + return this.request('PUT', decoder, requestPath, body, apiVersion, kind); + } + + public async merge( + decoder: ProtoDecoder, + requestPath: string, + body: ProtoRequestBody, + apiVersion: string, + kind: string, + ): Promise> { + return this.request('PATCH', decoder, requestPath, body, apiVersion, kind); + } + + public async delete( + decoder: ProtoDecoder, + requestPath: string, + deleteOptions?: Partial, + ): Promise> { + if (!deleteOptions) { + return this.request('DELETE', decoder, requestPath); + } + + const normalizedDeleteOptions = DeleteOptions.fromPartial({ dryRun: [], ...deleteOptions }); + const deleteBody = DeleteOptions.encode(normalizedDeleteOptions).finish(); + return this.request('DELETE', decoder, requestPath, deleteBody, 'v1', 'DeleteOptions'); + } + + public async request( + method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', + decoder: ProtoDecoder, + requestPath: string, + body?: ProtoRequestBody, + apiVersion?: string, + kind?: string, + ): Promise> { + const cluster = this.config.getCurrentCluster(); + if (!cluster) { + throw new Error('No active cluster!'); + } + + const url = new URL(requestPath, cluster.server); + const headers: Record = { + Accept: PROTO_MEDIA_TYPE, + }; + + let encodedBody: Uint8Array | undefined; + if (body !== undefined) { + if (!apiVersion || !kind) { + throw new Error('apiVersion and kind are required when a request body is provided.'); + } + headers['Content-Type'] = PROTO_MEDIA_TYPE; + encodedBody = this.encode(body, apiVersion, kind); + } + + const options: https.RequestOptions = { + protocol: url.protocol, + hostname: url.hostname, + port: url.port, + path: `${url.pathname}${url.search}`, + method, + headers, }; + await this.config.applyToHTTPSOptions(options); - const req = http.request(options); - const result = await new Promise((resolve, reject) => { - let data = ''; - req.on('data', (chunk) => { - data = data + chunk; - }); - req.on('end', () => { - const obj = msgType.deserializeBinary(data); - resolve(obj); - }); - req.on('error', (err) => { - reject(err); + const data = await new Promise<{ body: Buffer; contentType: string | undefined }>((resolve, reject) => { + const requestFn = url.protocol === 'https:' ? https.request : http.request; + const req = requestFn(options, (res) => { + const chunks: Buffer[] = []; + res.on('data', (chunk: Buffer | string) => { + chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)); + }); + res.on('end', () => { + resolve({ + body: Buffer.concat(chunks), + contentType: asStringHeader(res.headers['content-type']), + }); + }); + res.on('error', reject); }); + + req.on('error', reject); + if (encodedBody !== undefined) { + req.write(encodedBody); + } + req.end(); }); - req.end(); - return result; + + if (!data.contentType?.includes(PROTO_MEDIA_TYPE)) { + const bodyAsText = data.body.toString('utf8').trim(); + const contentType = data.contentType ?? 'unknown'; + throw new Error(`Unexpected content type '${contentType}' from API server: ${bodyAsText}`); + } + + const response = this.parseResponse(data.body); + if (response.typeMeta?.apiVersion === 'v1' && response.typeMeta?.kind === 'Status') { + return { + object: null, + status: Status.decode(response.raw ?? new Uint8Array()), + }; + } + + if (!response.raw) { + throw new Error('Protocol buffer response did not include a raw payload.'); + } + + return { + object: decode(decoder, response.raw), + status: null, + }; + } + + private encode(message: ProtoRequestBody, apiVersion: string, kind: string): Uint8Array { + const raw = message instanceof Uint8Array ? message : message.serializeBinary(); + const unknown = Unknown.encode({ + typeMeta: { apiVersion, kind }, + raw, + }).finish(); + + const encoded = new Uint8Array(MAGIC_PREFIX.length + unknown.length); + encoded.set(MAGIC_PREFIX, 0); + encoded.set(unknown, MAGIC_PREFIX.length); + return encoded; + } + + private parseResponse(data: Buffer): Unknown { + if (data.length < MAGIC_PREFIX.length) { + throw new Error('Truncated protocol buffer response: missing magic prefix.'); + } + + for (let i = 0; i < MAGIC_PREFIX.length; i++) { + if (data[i] !== MAGIC_PREFIX[i]) { + throw new Error('Unexpected protocol buffer response: magic prefix mismatch.'); + } + } + + return Unknown.decode(data.subarray(MAGIC_PREFIX.length)); + } +} + +function decode(decoder: ProtoDecoder, raw: Uint8Array): T { + if (typeof decoder === 'function') { + return decoder(raw); + } + + if ('deserializeBinary' in decoder) { + return decoder.deserializeBinary(raw); + } + + return decoder.decode(raw); +} + +function asStringHeader(value: string | string[] | undefined): string | undefined { + if (Array.isArray(value)) { + return value.join(','); } + return value; } diff --git a/src/proto-client_test.ts b/src/proto-client_test.ts new file mode 100644 index 00000000000..85cd40bd1b1 --- /dev/null +++ b/src/proto-client_test.ts @@ -0,0 +1,200 @@ +import { strictEqual, deepStrictEqual, ok, rejects } from 'node:assert'; +import http, { IncomingMessage, ServerResponse } from 'node:http'; +import { AddressInfo } from 'node:net'; +import { describe, it } from 'node:test'; + +import { KubeConfig } from './config.js'; +import { ProtoClient } from './proto-client.js'; +import { Status } from './proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.js'; +import { Unknown } from './proto/generated/k8s.io/apimachinery/pkg/runtime/generated.js'; + +const MAGIC_PREFIX = Uint8Array.from([0x6b, 0x38, 0x73, 0x00]); +const PROTO_MEDIA_TYPE = 'application/vnd.kubernetes.protobuf'; + +describe('ProtoClient', () => { + it('decodes regular protobuf object responses', async () => { + const expectedBody = 'hello-proto'; + const responseBody = wrapUnknown({ + apiVersion: 'v1', + kind: 'ConfigMap', + raw: Buffer.from(expectedBody, 'utf8'), + }); + + await withProtoServer( + (req, res) => { + strictEqual(req.method, 'GET'); + strictEqual(req.headers.accept, PROTO_MEDIA_TYPE); + res.writeHead(200, { 'Content-Type': PROTO_MEDIA_TYPE }); + res.end(responseBody); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + const result = await client.get((bytes: Uint8Array) => Buffer.from(bytes).toString('utf8'), '/api/v1'); + + strictEqual(result.object, expectedBody); + strictEqual(result.status, null); + }, + ); + }); + + it('decodes status responses into status objects', async () => { + const statusPayload = Status.encode({ + status: 'Failure', + reason: 'NotFound', + code: 404, + message: 'pods "missing" not found', + }).finish(); + + await withProtoServer( + (_req, res) => { + res.writeHead(404, { 'Content-Type': PROTO_MEDIA_TYPE }); + res.end( + wrapUnknown({ + apiVersion: 'v1', + kind: 'Status', + raw: statusPayload, + }), + ); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + const result = await client.get(() => { + throw new Error('decoder should not be called for Status responses'); + }, '/api/v1/namespaces/default/pods/missing'); + + strictEqual(result.object, null); + ok(result.status); + strictEqual(result.status?.status, 'Failure'); + strictEqual(result.status?.reason, 'NotFound'); + strictEqual(result.status?.code, 404); + }, + ); + }); + + it('encodes create requests with Kubernetes protobuf envelope', async () => { + const requestBody = Uint8Array.from([9, 8, 7]); + + await withProtoServer( + async (req, res) => { + strictEqual(req.method, 'POST'); + strictEqual(req.headers.accept, PROTO_MEDIA_TYPE); + strictEqual(req.headers['content-type'], PROTO_MEDIA_TYPE); + + const body = await readBody(req); + const parsed = parseUnknown(body); + strictEqual(parsed.typeMeta?.apiVersion, 'v1'); + strictEqual(parsed.typeMeta?.kind, 'ConfigMap'); + deepStrictEqual(Array.from(parsed.raw ?? []), Array.from(requestBody)); + + res.writeHead(201, { 'Content-Type': PROTO_MEDIA_TYPE }); + res.end( + wrapUnknown({ + apiVersion: 'v1', + kind: 'ConfigMap', + raw: Buffer.from('created', 'utf8'), + }), + ); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + const result = await client.create( + (bytes: Uint8Array) => Buffer.from(bytes).toString('utf8'), + '/api/v1/namespaces/default/configmaps', + requestBody, + 'v1', + 'ConfigMap', + ); + + strictEqual(result.status, null); + strictEqual(result.object, 'created'); + }, + ); + }); + + it('throws for non-protobuf responses', async () => { + await withProtoServer( + (_req, res) => { + res.writeHead(500, { 'Content-Type': 'application/json' }); + res.end('{"kind":"Status","message":"boom"}'); + }, + async (url) => { + const client = new ProtoClient(makeKubeConfig(url)); + await rejects( + client.get(() => 'ignored', '/api/v1'), + /Unexpected content type 'application\/json' from API server/, + ); + }, + ); + }); +}); + +function wrapUnknown(input: { apiVersion: string; kind: string; raw: Uint8Array }): Buffer { + const unknown = Unknown.encode({ + typeMeta: { + apiVersion: input.apiVersion, + kind: input.kind, + }, + raw: input.raw, + }).finish(); + + return Buffer.concat([Buffer.from(MAGIC_PREFIX), Buffer.from(unknown)]); +} + +function parseUnknown(data: Buffer) { + for (let i = 0; i < MAGIC_PREFIX.length; i++) { + strictEqual(data[i], MAGIC_PREFIX[i]); + } + return Unknown.decode(data.subarray(MAGIC_PREFIX.length)); +} + +async function withProtoServer( + handler: (req: IncomingMessage, res: ServerResponse) => Promise | void, + fn: (url: string) => Promise, +): Promise { + const server = http.createServer((req, res) => { + Promise.resolve(handler(req, res)).catch((err: Error) => { + res.statusCode = 500; + res.end(err.message); + }); + }); + + await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); + + try { + const address = server.address() as AddressInfo; + await fn(`http://127.0.0.1:${address.port}`); + } finally { + await new Promise((resolve, reject) => server.close((err) => (err ? reject(err) : resolve()))); + } +} + +function makeKubeConfig(serverUrl: string): KubeConfig { + const kc = new KubeConfig(); + kc.loadFromOptions({ + clusters: [ + { + name: 'cluster', + server: serverUrl, + skipTLSVerify: true, + }, + ], + users: [{ name: 'user' }], + contexts: [ + { + name: 'context', + cluster: 'cluster', + user: 'user', + }, + ], + currentContext: 'context', + }); + return kc; +} + +async function readBody(req: IncomingMessage): Promise { + const chunks: Buffer[] = []; + for await (const chunk of req) { + chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)); + } + return Buffer.concat(chunks); +} diff --git a/src/proto.ts b/src/proto.ts new file mode 100644 index 00000000000..580f7ba2f3e --- /dev/null +++ b/src/proto.ts @@ -0,0 +1,2 @@ +export * as MetaV1 from './proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.js'; +export * as Runtime from './proto/generated/k8s.io/apimachinery/pkg/runtime/generated.js'; diff --git a/src/proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.ts b/src/proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.ts new file mode 100644 index 00000000000..e2f58d52820 --- /dev/null +++ b/src/proto/generated/k8s.io/apimachinery/pkg/apis/meta/v1/generated.ts @@ -0,0 +1,7077 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.12.1 +// protoc v3.21.12 +// source: k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { RawExtension } from "../../../runtime/generated"; + +/** + * APIGroup contains the name, the supported versions, and the preferred version + * of a group. + */ +export interface APIGroup { + /** name is the name of the group. */ + name?: + | string + | undefined; + /** + * versions are the versions supported in this group. + * +listType=atomic + */ + versions: GroupVersionForDiscovery[]; + /** + * preferredVersion is the version preferred by the API server, which + * probably is the storage version. + * +optional + */ + preferredVersion?: + | GroupVersionForDiscovery + | undefined; + /** + * a map of client CIDR to server address that is serving this group. + * This is to help clients reach servers in the most network-efficient way possible. + * Clients can use the appropriate server address as per the CIDR that they match. + * In case of multiple matches, clients should use the longest matching CIDR. + * The server returns only those CIDRs that it thinks that the client can match. + * For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. + * Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP. + * +optional + * +listType=atomic + */ + serverAddressByClientCIDRs: ServerAddressByClientCIDR[]; +} + +/** + * APIGroupList is a list of APIGroup, to allow clients to discover the API at + * /apis. + */ +export interface APIGroupList { + /** + * groups is a list of APIGroup. + * +listType=atomic + */ + groups: APIGroup[]; +} + +/** APIResource specifies the name of a resource and whether it is namespaced. */ +export interface APIResource { + /** name is the plural name of the resource. */ + name?: + | string + | undefined; + /** + * singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. + * The singularName is more correct for reporting status on a single item and both singular and plural are allowed + * from the kubectl CLI interface. + */ + singularName?: + | string + | undefined; + /** namespaced indicates if a resource is namespaced or not. */ + namespaced?: + | boolean + | undefined; + /** + * group is the preferred group of the resource. Empty implies the group of the containing resource list. + * For subresources, this may have a different value, for example: Scale". + */ + group?: + | string + | undefined; + /** + * version is the preferred version of the resource. Empty implies the version of the containing resource list + * For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)". + */ + version?: + | string + | undefined; + /** kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo') */ + kind?: + | string + | undefined; + /** + * verbs is a list of supported kube verbs (this includes get, list, watch, create, + * update, patch, delete, deletecollection, and proxy) + */ + verbs?: + | Verbs + | undefined; + /** + * shortNames is a list of suggested short names of the resource. + * +listType=atomic + */ + shortNames: string[]; + /** + * categories is a list of the grouped resources this resource belongs to (e.g. 'all') + * +listType=atomic + */ + categories: string[]; + /** + * The hash value of the storage version, the version this resource is + * converted to when written to the data store. Value must be treated + * as opaque by clients. Only equality comparison on the value is valid. + * This is an alpha feature and may change or be removed in the future. + * The field is populated by the apiserver only if the + * StorageVersionHash feature gate is enabled. + * This field will remain optional even if it graduates. + * +optional + */ + storageVersionHash?: string | undefined; +} + +/** + * APIResourceList is a list of APIResource, it is used to expose the name of the + * resources supported in a specific group and version, and if the resource + * is namespaced. + */ +export interface APIResourceList { + /** groupVersion is the group and version this APIResourceList is for. */ + groupVersion?: + | string + | undefined; + /** + * resources contains the name of the resources and if they are namespaced. + * +listType=atomic + */ + resources: APIResource[]; +} + +/** + * APIVersions lists the versions that are available, to allow clients to + * discover the API at /api, which is the root path of the legacy v1 API. + * + * +protobuf.options.(gogoproto.goproto_stringer)=false + * +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + */ +export interface APIVersions { + /** + * versions are the api versions that are available. + * +listType=atomic + */ + versions: string[]; + /** + * a map of client CIDR to server address that is serving this group. + * This is to help clients reach servers in the most network-efficient way possible. + * Clients can use the appropriate server address as per the CIDR that they match. + * In case of multiple matches, clients should use the longest matching CIDR. + * The server returns only those CIDRs that it thinks that the client can match. + * For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. + * Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP. + * +listType=atomic + */ + serverAddressByClientCIDRs: ServerAddressByClientCIDR[]; +} + +/** + * ApplyOptions may be provided when applying an API object. + * FieldManager is required for apply requests. + * ApplyOptions is equivalent to PatchOptions. It is provided as a convenience with documentation + * that speaks specifically to how the options fields relate to apply. + */ +export interface ApplyOptions { + /** + * 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 + * +optional + * +listType=atomic + */ + dryRun: string[]; + /** + * Force is going to "force" Apply requests. It means user will + * re-acquire conflicting fields owned by other people. + */ + force?: + | boolean + | undefined; + /** + * fieldManager is a name associated with the actor or entity + * that is making these changes. The value must be less than or + * 128 characters long, and only contain printable characters, + * as defined by https://golang.org/pkg/unicode/#IsPrint. This + * field is required. + */ + fieldManager?: string | undefined; +} + +/** + * Condition contains details for one aspect of the current state of this API Resource. + * --- + * This struct is intended for direct use as an array at the field path .status.conditions. For example, + * + * type FooStatus struct{ + * // Represents the observations of a foo's current state. + * // Known .status.conditions.type are: "Available", "Progressing", and "Degraded" + * // +patchMergeKey=type + * // +patchStrategy=merge + * // +listType=map + * // +listMapKey=type + * // +k8s:alpha(since: "1.37")=+k8s:optional + * // +k8s:alpha(since: "1.37")=+k8s:listType=map + * // +k8s:alpha(since: "1.37")=+k8s:listMapKey=type + * Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + * + * // other fields + * } + */ +export interface Condition { + /** + * type of condition in CamelCase or in foo.example.com/CamelCase. + * --- + * Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + * useful (see .node.status.conditions), the ability to deconflict is important. + * The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + * +required + * +kubebuilder:validation:Required + * +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)* /)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` + * +kubebuilder:validation:MaxLength=316 + * +k8s:alpha(since: "1.37")=+k8s:required + * +k8s:alpha(since: "1.37")=+k8s:format=k8s-label-key + */ + type?: + | string + | undefined; + /** + * status of the condition, one of True, False, Unknown. + * +required + * +kubebuilder:validation:Required + * +kubebuilder:validation:Enum=True;False;Unknown + * +k8s:alpha(since: "1.37")=+k8s:required + */ + status?: + | string + | undefined; + /** + * observedGeneration represents the .metadata.generation that the condition was set based upon. + * For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + * with respect to the current state of the instance. + * +optional + * +kubebuilder:validation:Minimum=0 + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:minimum=0 + */ + observedGeneration?: + | number + | undefined; + /** + * lastTransitionTime is the last time the condition transitioned from one status to another. + * This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + * +required + * +kubebuilder:validation:Required + * +kubebuilder:validation:Type=string + * +kubebuilder:validation:Format=date-time + * +k8s:alpha(since: "1.37")=+k8s:customValidation + */ + lastTransitionTime?: + | Time + | undefined; + /** + * reason contains a programmatic identifier indicating the reason for the condition's last transition. + * Producers of specific condition types may define expected values and meanings for this field, + * and whether the values are considered a guaranteed API. + * The value should be a CamelCase string. + * This field may not be empty. + * +required + * +kubebuilder:validation:Required + * +kubebuilder:validation:MaxLength=1024 + * +kubebuilder:validation:MinLength=1 + * +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$` + * +k8s:alpha(since: "1.37")=+k8s:required + * +k8s:alpha(since: "1.38")=+k8s:maxBytes=1024 + */ + reason?: + | string + | undefined; + /** + * message is a human readable message indicating details about the transition. + * This may be an empty string. + * +required + * +kubebuilder:validation:Required + * +kubebuilder:validation:MaxLength=32768 + */ + message?: string | undefined; +} + +/** CreateOptions may be provided when creating an API object. */ +export interface CreateOptions { + /** + * 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 + * +optional + * +listType=atomic + */ + dryRun: string[]; + /** + * fieldManager is a name associated with the actor or entity + * that is making these changes. The value must be less than or + * 128 characters long, and only contain printable characters, + * as defined by https://golang.org/pkg/unicode/#IsPrint. + * +optional + */ + fieldManager?: + | string + | undefined; + /** + * 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. + * +optional + */ + fieldValidation?: string | undefined; +} + +/** DeleteOptions may be provided when deleting an API object. */ +export interface DeleteOptions { + /** + * The duration in seconds before the object should be deleted. Value must be non-negative integer. + * The value zero indicates delete immediately. If this value is nil, the default grace period for the + * specified type will be used. + * Defaults to a per object value if not specified. zero means delete immediately. + * +optional + */ + gracePeriodSeconds?: + | number + | undefined; + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be + * returned. + * +k8s:conversion-gen=false + * +optional + */ + preconditions?: + | Preconditions + | undefined; + /** + * Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. + * Should the dependent objects be orphaned. If true/false, the "orphan" + * finalizer will be added to/removed from the object's finalizers list. + * Either this field or PropagationPolicy may be set, but not both. + * +optional + */ + orphanDependents?: + | boolean + | undefined; + /** + * Whether and how garbage collection will be performed. + * Either this field or OrphanDependents may be set, but not both. + * The default policy is decided by the existing finalizer set in the + * metadata.finalizers and the resource-specific default policy. + * Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - + * allow the garbage collector to delete the dependents in the background; + * 'Foreground' - a cascading policy that deletes all dependents in the + * foreground. + * +optional + */ + propagationPolicy?: + | string + | undefined; + /** + * 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 + * +optional + * +listType=atomic + */ + dryRun: string[]; + /** + * if set to true, it will trigger an unsafe deletion of the resource in + * case the normal deletion flow fails with a corrupt object error. + * A resource is considered corrupt if it can not be retrieved from + * the underlying storage successfully because of a) its data can + * not be transformed e.g. decryption failure, or b) it fails + * to decode into an object. + * NOTE: unsafe deletion ignores finalizer constraints, skips + * precondition checks, and removes the object from the storage. + * WARNING: This may potentially break the cluster if the workload + * associated with the resource being unsafe-deleted relies on normal + * deletion flow. Use only if you REALLY know what you are doing. + * The default value is false, and the user must opt in to enable it + * +optional + */ + ignoreStoreReadErrorWithClusterBreakingPotential?: boolean | undefined; +} + +/** + * Duration is a wrapper around time.Duration which supports correct + * marshaling to YAML and JSON. In particular, it marshals into strings, which + * can be used as map keys in json. + */ +export interface Duration { + duration?: number | undefined; +} + +/** + * FieldSelectorRequirement is a selector that contains values, a key, and an operator that + * relates the key and values. + */ +export interface FieldSelectorRequirement { + /** key is the field selector key that the requirement applies to. */ + key?: + | string + | undefined; + /** + * operator represents a key's relationship to a set of values. + * Valid operators are In, NotIn, Exists, DoesNotExist. + * The list of operators may grow in the future. + */ + operator?: + | string + | undefined; + /** + * values is an array of string values. + * If the operator is In or NotIn, the values array must be non-empty. + * If the operator is Exists or DoesNotExist, the values array must be empty. + * +optional + * +listType=atomic + */ + values: string[]; +} + +/** + * FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format. + * + * Each key is either a '.' representing the field itself, and will always map to an empty set, + * or a string representing a sub-field or item. The string will follow one of these four formats: + * 'f:', where is the name of a field in a struct, or key in a map + * 'v:', where is the exact json formatted value of a list item + * 'i:', where is position of a item in a list + * 'k:', where is a map of a list item's key fields to their unique values + * If a key maps to an empty Fields value, the field that key represents is part of the set. + * + * The exact format is defined in sigs.k8s.io/structured-merge-diff + * +k8s:deepcopy-gen=false + * +protobuf.options.marshal=false + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface FieldsV1 { + /** + * Raw is the underlying serialization of this object. + * + * Deprecated: Direct access to this field is deprecated. Use GetRawBytes, GetRawString, SetRawBytes, SetRawString, GetRawReader, NewFieldsV1 instead. + */ + Raw?: Uint8Array | undefined; +} + +/** GetOptions is the standard query options to the standard REST get call. */ +export interface GetOptions { + /** + * resourceVersion sets a constraint on what resource versions a request may be served from. + * See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for + * details. + * + * Defaults to unset + * +optional + */ + resourceVersion?: string | undefined; +} + +/** + * GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying + * concepts during lookup stages without having partially valid types + * + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface GroupKind { + group?: string | undefined; + kind?: string | undefined; +} + +/** + * GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying + * concepts during lookup stages without having partially valid types + * + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface GroupResource { + group?: string | undefined; + resource?: string | undefined; +} + +/** + * GroupVersion contains the "group" and the "version", which uniquely identifies the API. + * + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface GroupVersion { + group?: string | undefined; + version?: string | undefined; +} + +/** + * GroupVersion contains the "group/version" and "version" string of a version. + * It is made a struct to keep extensibility. + */ +export interface GroupVersionForDiscovery { + /** groupVersion specifies the API group and version in the form "group/version" */ + groupVersion?: + | string + | undefined; + /** + * version specifies the version in the form of "version". This is to save + * the clients the trouble of splitting the GroupVersion. + */ + version?: string | undefined; +} + +/** + * GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion + * to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling + * + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface GroupVersionKind { + group?: string | undefined; + version?: string | undefined; + kind?: string | undefined; +} + +/** + * GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion + * to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling + * + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface GroupVersionResource { + group?: string | undefined; + version?: string | undefined; + resource?: string | undefined; +} + +/** + * A label selector is a label query over a set of resources. The result of matchLabels and + * matchExpressions are ANDed. An empty label selector matches all objects. A null + * label selector matches no objects. + * +structType=atomic + */ +export interface LabelSelector { + /** + * matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + * map is equivalent to an element of matchExpressions, whose key field is "key", the + * operator is "In", and the values array contains only "value". The requirements are ANDed. + * +optional + */ + matchLabels: { [key: string]: string }; + /** + * matchExpressions is a list of label selector requirements. The requirements are ANDed. + * +optional + * +listType=atomic + */ + matchExpressions: LabelSelectorRequirement[]; +} + +export interface LabelSelector_MatchLabelsEntry { + key: string; + value: string; +} + +/** + * A label selector requirement is a selector that contains values, a key, and an operator that + * relates the key and values. + */ +export interface LabelSelectorRequirement { + /** key is the label key that the selector applies to. */ + key?: + | string + | undefined; + /** + * operator represents a key's relationship to a set of values. + * Valid operators are In, NotIn, Exists and DoesNotExist. + */ + operator?: + | string + | undefined; + /** + * values is an array of string values. If the operator is In or NotIn, + * the values array must be non-empty. If the operator is Exists or DoesNotExist, + * the values array must be empty. This array is replaced during a strategic + * merge patch. + * +optional + * +listType=atomic + */ + values: string[]; +} + +/** List holds a list of objects, which may not be known by the server. */ +export interface List { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: + | ListMeta + | undefined; + /** List of objects */ + items: RawExtension[]; +} + +/** + * ListMeta describes metadata that synthetic resources must have, including lists and + * various status objects. A resource may have only one of {ObjectMeta, ListMeta}. + */ +export interface ListMeta { + /** + * Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * +optional + */ + selfLink?: + | string + | undefined; + /** + * String that identifies the server's internal version of this object that + * can be used by clients to determine when objects have changed. + * Value must be treated as opaque by clients and passed unmodified back to the server. + * Populated by the system. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * +optional + */ + resourceVersion?: + | string + | undefined; + /** + * continue may be set if the user set a limit on the number of items returned, and indicates that + * the server has more data available. The value is opaque and may be used to issue another request + * to the endpoint that served this list to retrieve the next set of available objects. Continuing a + * consistent list may not be possible if the server configuration has changed or more than a few + * minutes have passed. The resourceVersion field returned when using this continue value will be + * identical to the value in the first response, unless you have received this token from an error + * message. + */ + continue?: + | string + | undefined; + /** + * remainingItemCount is the number of subsequent items in the list which are not included in this + * list response. If the list request contained label or field selectors, then the number of + * remaining items is unknown and the field will be left unset and omitted during serialization. + * If the list is complete (either because it is not chunking or because this is the last chunk), + * then there are no more remaining items and this field will be left unset and omitted during + * serialization. + * Servers older than v1.15 do not set this field. + * The intended use of the remainingItemCount is *estimating* the size of a collection. Clients + * should not rely on the remainingItemCount to be set or to be exact. + * +optional + */ + remainingItemCount?: + | number + | undefined; + /** + * shardInfo is set when the list is a filtered subset of the full collection, + * as selected by a shard selector on the request. It echoes back the selector + * so clients can verify which shard they received and merge sharded responses. + * Clients should not cache sharded list responses as a full representation + * of the collection. + * + * This is an alpha field and requires enabling the ShardedListAndWatch feature gate. + * +featureGate=ShardedListAndWatch + * +optional + */ + shardInfo?: ShardInfo | undefined; +} + +/** ListOptions is the query options to a standard REST list call. */ +export interface ListOptions { + /** + * A selector to restrict the list of returned objects by their labels. + * Defaults to everything. + * +optional + */ + labelSelector?: + | string + | undefined; + /** + * A selector to restrict the list of returned objects by their fields. + * Defaults to everything. + * +optional + */ + fieldSelector?: + | string + | undefined; + /** + * Watch for changes to the described resources and return them as a stream of + * add, update, and remove notifications. Specify resourceVersion. + * +optional + */ + watch?: + | boolean + | undefined; + /** + * allowWatchBookmarks requests watch events with type "BOOKMARK". + * Servers that do not implement bookmarks may ignore this flag and + * bookmarks are sent at the server's discretion. Clients should not + * assume bookmarks are returned at any specific interval, nor may they + * assume the server will send any BOOKMARK event during a session. + * If this is not a watch, this field is ignored. + * +optional + */ + allowWatchBookmarks?: + | boolean + | undefined; + /** + * resourceVersion sets a constraint on what resource versions a request may be served from. + * See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for + * details. + * + * Defaults to unset + * +optional + */ + resourceVersion?: + | string + | undefined; + /** + * resourceVersionMatch determines how resourceVersion is applied to list calls. + * It is highly recommended that resourceVersionMatch be set for list calls where + * resourceVersion is set + * See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for + * details. + * + * Defaults to unset + * +optional + */ + resourceVersionMatch?: + | string + | undefined; + /** + * Timeout for the list/watch call. + * This limits the duration of the call, regardless of any activity or inactivity. + * +optional + */ + timeoutSeconds?: + | number + | undefined; + /** + * limit is a maximum number of responses to return for a list call. If more items exist, the + * server will set the `continue` field on the list metadata to a value that can be used with the + * same initial query to retrieve the next set of results. Setting a limit may return fewer than + * the requested amount of items (up to zero items) in the event all requested objects are + * filtered out and clients should only use the presence of the continue field to determine whether + * more results are available. Servers may choose not to support the limit argument and will return + * all of the available results. If limit is specified and the continue field is empty, clients may + * assume that no more results are available. This field is not supported if watch is true. + * + * The server guarantees that the objects returned when using continue will be identical to issuing + * a single list call without a limit - that is, no objects created, modified, or deleted after the + * first request is issued will be included in any subsequent continued requests. This is sometimes + * referred to as a consistent snapshot, and ensures that a client that is using limit to receive + * smaller chunks of a very large result can ensure they see all possible objects. If objects are + * updated during a chunked list the version of the object that was present at the time the first list + * result was calculated is returned. + */ + limit?: + | number + | undefined; + /** + * The continue option should be set when retrieving more results from the server. Since this value is + * server defined, clients may only use the continue value from a previous query result with identical + * query parameters (except for the value of continue) and the server may reject a continue value it + * does not recognize. If the specified continue value is no longer valid whether due to expiration + * (generally five to fifteen minutes) or a configuration change on the server, the server will + * respond with a 410 ResourceExpired error together with a continue token. If the client needs a + * consistent list, it must restart their list without the continue field. Otherwise, the client may + * send another list request with the token received with the 410 error, the server will respond with + * a list starting from the next key, but from the latest snapshot, which is inconsistent from the + * previous list results - objects that are created, modified, or deleted after the first list request + * will be included in the response, as long as their keys are after the "next key". + * + * This field is not supported when watch is true. Clients may start a watch from the last + * resourceVersion value returned by the server and not miss any modifications. + */ + continue?: + | string + | undefined; + /** + * `sendInitialEvents=true` may be set together with `watch=true`. + * In that case, the watch stream will begin with synthetic events to + * produce the current state of objects in the collection. Once all such + * events have been sent, a synthetic "Bookmark" event will be sent. + * The bookmark will report the ResourceVersion (RV) corresponding to the + * set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation. + * Afterwards, the watch stream will proceed as usual, sending watch events + * corresponding to changes (subsequent to the RV) to objects watched. + * + * When `sendInitialEvents` option is set, we require `resourceVersionMatch` + * option to also be set. The semantic of the watch request is as following: + * - `resourceVersionMatch` = NotOlderThan + * is interpreted as "data at least as new as the provided `resourceVersion`" + * and the bookmark event is send when the state is synced + * to a `resourceVersion` at least as fresh as the one provided by the ListOptions. + * If `resourceVersion` is unset, this is interpreted as "consistent read" and the + * bookmark event is send when the state is synced at least to the moment + * when request started being processed. + * - `resourceVersionMatch` set to any other value or unset + * Invalid error is returned. + * + * Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward + * compatibility reasons) and to false otherwise. + * +optional + */ + sendInitialEvents?: + | boolean + | undefined; + /** + * shardSelector restricts the list of returned objects using a CEL-based + * shard selector expression. The format uses the shardRange() function + * combined with || (logical OR) to specify one or more hash ranges: + * + * shardRange(object.metadata.uid, '0x0', '0x8000000000000000') + * shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000') + * + * Field paths use CEL-style object-rooted syntax (e.g. "object.metadata.uid"), + * NOT the fieldSelector format ("metadata.uid"). Currently supported paths: + * - object.metadata.uid + * - object.metadata.namespace + * + * hexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, + * defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a + * hash space. The full range is [0x0, 0x10000000000000000), where the exclusive + * upper bound equals 2^64. + * + * Examples: + * 2-shard split: + * shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000') + * shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000') + * 4-shard split: + * shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000') + * shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000') + * shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000') + * shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000') + * + * This is an alpha field and requires enabling the ShardedListAndWatch feature gate. + * +featureGate=ShardedListAndWatch + * +optional + */ + shardSelector?: string | undefined; +} + +/** + * ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource + * that the fieldset applies to. + */ +export interface ManagedFieldsEntry { + /** Manager is an identifier of the workflow managing these fields. */ + manager?: + | string + | undefined; + /** + * Operation is the type of operation which lead to this ManagedFieldsEntry being created. + * The only valid values for this field are 'Apply' and 'Update'. + * +k8s:alpha(since: "1.37")=+k8s:required + */ + operation?: + | string + | undefined; + /** + * APIVersion defines the version of this resource that this field set + * applies to. The format is "group/version" just like the top-level + * APIVersion field. It is necessary to track the version of a field + * set because it cannot be automatically converted. + */ + apiVersion?: + | string + | undefined; + /** + * Time is the timestamp of when the ManagedFields entry was added. The + * timestamp will also be updated if a field is added, the manager + * changes any of the owned fields value or removes a field. The + * timestamp does not update when a field is removed from the entry + * because another manager took it over. + * +optional + */ + time?: + | Time + | undefined; + /** + * FieldsType is the discriminator for the different fields format and version. + * There is currently only one possible value: "FieldsV1" + */ + fieldsType?: + | string + | undefined; + /** + * FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + * +optional + */ + fieldsV1?: + | FieldsV1 + | undefined; + /** + * Subresource is the name of the subresource used to update that object, or + * empty string if the object was updated through the main resource. The + * value of this field is used to distinguish between managers, even if they + * share the same name. For example, a status update will be distinct from a + * regular update using the same manager name. + * Note that the APIVersion field is not related to the Subresource field and + * it always corresponds to the version of the main resource. + */ + subresource?: string | undefined; +} + +/** + * MicroTime is version of Time with microsecond level precision. + * + * +protobuf.options.marshal=false + * +protobuf.as=Timestamp + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface MicroTime { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds?: + | number + | undefined; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. This field may be limited in precision depending on context. + */ + nanos?: number | undefined; +} + +/** + * ObjectMeta is metadata that all persisted resources must have, which includes all objects + * users must create. + */ +export interface ObjectMeta { + /** + * Name must be unique within a namespace. Is required when creating resources, although + * some resources may allow a client to request the generation of an appropriate name + * automatically. Name is primarily intended for creation idempotence and configuration + * definition. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * +optional + */ + name?: + | string + | undefined; + /** + * GenerateName is an optional prefix, used by the server, to generate a unique + * name ONLY IF the Name field has not been provided. + * If this field is used, the name returned to the client will be different + * than the name passed. This value will also be combined with a unique suffix. + * The provided value has the same validation rules as the Name field, + * and may be truncated by the length of the suffix required to make the value + * unique on the server. + * + * If this field is specified and the generated name exists, the server will return a 409. + * + * Applied only if Name is not specified. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + * +optional + */ + generateName?: + | string + | undefined; + /** + * Namespace defines the space within which each name must be unique. An empty namespace is + * equivalent to the "default" namespace, but "default" is the canonical representation. + * Not all objects are required to be scoped to a namespace - the value of this field for + * those objects will be empty. + * + * Must be a DNS_LABEL. + * Cannot be updated. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + * +optional + */ + namespace?: + | string + | undefined; + /** + * Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * +optional + */ + selfLink?: + | string + | undefined; + /** + * UID is the unique in time and space value for this object. It is typically generated by + * the server on successful creation of a resource and is not allowed to change on PUT + * operations. + * + * Populated by the system. + * Read-only. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + */ + uid?: + | string + | undefined; + /** + * An opaque value that represents the internal version of this object that can + * be used by clients to determine when objects have changed. May be used for optimistic + * concurrency, change detection, and the watch operation on a resource or set of resources. + * Clients must treat these values as opaque and passed unmodified back to the server. + * They may only be valid for a particular resource or set of resources. + * + * Populated by the system. + * Read-only. + * Value must be treated as opaque by clients and . + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * +optional + */ + resourceVersion?: + | string + | undefined; + /** + * A sequence number representing a specific generation of the desired state. + * Populated by the system. Read-only. + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:minimum=0 + */ + generation?: + | number + | undefined; + /** + * CreationTimestamp is a timestamp representing the server time when this object was + * created. It is not guaranteed to be set in happens-before order across separate operations. + * Clients may not set this value. It is represented in RFC3339 form and is in UTC. + * + * Populated by the system. + * Read-only. + * Null for lists. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + */ + creationTimestamp?: + | Time + | undefined; + /** + * DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This + * field is set by the server when a graceful deletion is requested by the user, and is not + * directly settable by a client. The resource is expected to be deleted (no longer visible + * from resource lists, and not reachable by name) after the time in this field, once the + * finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. + * Once the deletionTimestamp is set, this value may not be unset or be set further into the + * future, although it may be shortened or the resource may be deleted prior to this time. + * For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react + * by sending a graceful termination signal to the containers in the pod. After that 30 seconds, + * the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, + * remove the pod from the API. In the presence of network partitions, this object may still + * exist after this timestamp, until an administrator or automated process can determine the + * resource is fully terminated. + * If not set, graceful deletion of the object has not been requested. + * + * Populated by the system when a graceful deletion is requested. + * Read-only. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + */ + deletionTimestamp?: + | Time + | undefined; + /** + * Number of seconds allowed for this object to gracefully terminate before + * it will be removed from the system. Only set when deletionTimestamp is also set. + * May only be shortened. + * Read-only. + * +optional + * +k8s:alpha(since: "1.37")=+k8s:optional + * +k8s:alpha(since: "1.37")=+k8s:immutable + */ + deletionGracePeriodSeconds?: + | number + | undefined; + /** + * Map of string keys and values that can be used to organize and categorize + * (scope and select) objects. May match selectors of replication controllers + * and services. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * +optional + */ + labels: { [key: string]: string }; + /** + * Annotations is an unstructured key value map stored with a resource that may be + * set by external tools to store and retrieve arbitrary metadata. They are not + * queryable and should be preserved when modifying objects. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + * +optional + */ + annotations: { [key: string]: string }; + /** + * List of objects depended by this object. If ALL objects in the list have + * been deleted, this object will be garbage collected. If this object is managed by a controller, + * then an entry in this list will point to this controller, with the controller field set to true. + * There cannot be more than one managing controller. + * +optional + * +patchMergeKey=uid + * +patchStrategy=merge + * +listType=map + * +listMapKey=uid + * +k8s:alpha(since:"1.37")=+k8s:optional + */ + ownerReferences: OwnerReference[]; + /** + * Must be empty before the object is deleted from the registry. Each entry + * is an identifier for the responsible component that will remove the entry + * from the list. If the deletionTimestamp of the object is non-nil, entries + * in this list can only be removed. + * Finalizers may be processed and removed in any order. Order is NOT enforced + * because it introduces significant risk of stuck finalizers. + * finalizers is a shared field, any actor with permission can reorder it. + * If the finalizer list is processed in order, then this can lead to a situation + * in which the component responsible for the first finalizer in the list is + * waiting for a signal (field value, external system, or other) produced by a + * component responsible for a finalizer later in the list, resulting in a deadlock. + * Without enforced ordering finalizers are free to order amongst themselves and + * are not vulnerable to ordering changes in the list. + * +optional + * +patchStrategy=merge + * +listType=set + */ + finalizers: string[]; + /** + * ManagedFields maps workflow-id and version to the set of fields + * that are managed by that workflow. This is mostly for internal + * housekeeping, and users typically shouldn't need to set or + * understand this field. A workflow can be the user's name, a + * controller's name, or the name of a specific apply path like + * "ci-cd". The set of fields is always in the version that the + * workflow used when modifying the object. + * + * +optional + * +listType=atomic + * +k8s:alpha(since: "1.37")=+k8s:optional + */ + managedFields: ManagedFieldsEntry[]; +} + +export interface ObjectMeta_LabelsEntry { + key: string; + value: string; +} + +export interface ObjectMeta_AnnotationsEntry { + key: string; + value: string; +} + +/** + * OwnerReference contains enough information to let you identify an owning + * object. An owning object must be in the same namespace as the dependent, or + * be cluster-scoped, so there is no namespace field. + * +structType=atomic + */ +export interface OwnerReference { + /** + * API version of the referent. + * +k8s:alpha(since:"1.37")=+k8s:required + */ + apiVersion?: + | string + | undefined; + /** + * Kind of the referent. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +k8s:alpha(since:"1.37")=+k8s:required + */ + kind?: + | string + | undefined; + /** + * Name of the referent. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * +k8s:alpha(since:"1.37")=+k8s:required + */ + name?: + | string + | undefined; + /** + * UID of the referent. + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * +k8s:alpha(since:"1.37")=+k8s:required + */ + uid?: + | string + | undefined; + /** + * If true, this reference points to the managing controller. + * +optional + */ + controller?: + | boolean + | undefined; + /** + * If true, AND if the owner has the "foregroundDeletion" finalizer, then + * the owner cannot be deleted from the key-value store until this + * reference is removed. + * See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion + * for how the garbage collector interacts with this field and enforces the foreground deletion. + * Defaults to false. + * To set this field, a user needs "delete" permission of the owner, + * otherwise 422 (Unprocessable Entity) will be returned. + * +optional + */ + blockOwnerDeletion?: boolean | undefined; +} + +/** + * PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients + * to get access to a particular ObjectMeta schema without knowing the details of the version. + * +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + */ +export interface PartialObjectMetadata { + /** + * Standard object's metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * +optional + * +k8s:opaqueType + */ + metadata?: ObjectMeta | undefined; +} + +/** + * PartialObjectMetadataList contains a list of objects containing only their metadata + * +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + */ +export interface PartialObjectMetadataList { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: + | ListMeta + | undefined; + /** items contains each of the included items. */ + items: PartialObjectMetadata[]; +} + +/** Patch is provided to give a concrete name and type to the Kubernetes PATCH request body. */ +export interface Patch { +} + +/** + * PatchOptions may be provided when patching an API object. + * PatchOptions is meant to be a superset of UpdateOptions. + */ +export interface PatchOptions { + /** + * 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 + * +optional + * +listType=atomic + */ + dryRun: string[]; + /** + * Force is going to "force" Apply requests. It means user will + * re-acquire conflicting fields owned by other people. Force + * flag must be unset for non-apply patch requests. + * +optional + */ + force?: + | boolean + | undefined; + /** + * fieldManager is a name associated with the actor or entity + * that is making these changes. The value must be less than or + * 128 characters long, and only contain printable characters, + * as defined by https://golang.org/pkg/unicode/#IsPrint. This + * field is required for apply requests + * (application/apply-patch) but optional for non-apply patch + * types (JsonPatch, MergePatch, StrategicMergePatch). + * +optional + */ + fieldManager?: + | string + | undefined; + /** + * 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. + * +optional + */ + fieldValidation?: string | undefined; +} + +/** Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out. */ +export interface Preconditions { + /** + * Specifies the target UID. + * +optional + */ + uid?: + | string + | undefined; + /** + * Specifies the target ResourceVersion + * +optional + */ + resourceVersion?: string | undefined; +} + +/** + * RootPaths lists the paths available at root. + * For example: "/healthz", "/apis". + */ +export interface RootPaths { + /** + * paths are the paths available at root. + * +listType=atomic + */ + paths: string[]; +} + +/** ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match. */ +export interface ServerAddressByClientCIDR { + /** The CIDR with which clients can match their IP to figure out the server address that they should use. */ + clientCIDR?: + | string + | undefined; + /** + * Address of this server, suitable for a client that matches the above CIDR. + * This can be a hostname, hostname:port, IP or IP:port. + */ + serverAddress?: string | undefined; +} + +/** + * ShardInfo describes the shard selector that was applied to produce a list response. + * Its presence on a list response indicates the list is a filtered subset. + */ +export interface ShardInfo { + /** + * selector is the shard selector string from the request, echoed back so clients + * can verify which shard they received and merge responses from multiple shards. + * +required + */ + selector?: string | undefined; +} + +/** Status is a return value for calls that don't return other objects. */ +export interface Status { + /** + * Standard list metadata. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + metadata?: + | ListMeta + | undefined; + /** + * Status of the operation. + * One of: "Success" or "Failure". + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + * +optional + */ + status?: + | string + | undefined; + /** + * A human-readable description of the status of this operation. + * +optional + */ + message?: + | string + | undefined; + /** + * A machine-readable description of why this operation is in the + * "Failure" status. If this value is empty there + * is no information available. A Reason clarifies an HTTP status + * code but does not override it. + * +optional + */ + reason?: + | string + | undefined; + /** + * Extended data associated with the reason. Each reason may define its + * own extended details. This field is optional and the data returned + * is not guaranteed to conform to any schema except that defined by + * the reason type. + * +optional + */ + details?: + | StatusDetails + | undefined; + /** + * Suggested HTTP return code for this status, 0 if not set. + * +optional + */ + code?: number | undefined; +} + +/** + * StatusCause provides more information about an api.Status failure, including + * cases when multiple errors are encountered. + */ +export interface StatusCause { + /** + * A machine-readable description of the cause of the error. If this value is + * empty there is no information available. + * +optional + */ + reason?: + | string + | undefined; + /** + * A human-readable description of the cause of the error. This field may be + * presented as-is to a reader. + * +optional + */ + message?: + | string + | undefined; + /** + * The field of the resource that has caused this error, as named by its JSON + * serialization. May include dot and postfix notation for nested attributes. + * Arrays are zero-indexed. Fields may appear more than once in an array of + * causes due to fields having multiple errors. + * Optional. + * + * Examples: + * "name" - the field "name" on the current resource + * "items[0].name" - the field "name" on the first array entry in "items" + * +optional + */ + field?: string | undefined; +} + +/** + * StatusDetails is a set of additional properties that MAY be set by the + * server to provide additional information about a response. The Reason + * field of a Status object defines what attributes will be set. Clients + * must ignore fields that do not match the defined type of each attribute, + * and should assume that any attribute may be empty, invalid, or under + * defined. + */ +export interface StatusDetails { + /** + * The name attribute of the resource associated with the status StatusReason + * (when there is a single name which can be described). + * +optional + */ + name?: + | string + | undefined; + /** + * The group attribute of the resource associated with the status StatusReason. + * +optional + */ + group?: + | string + | undefined; + /** + * The kind attribute of the resource associated with the status StatusReason. + * On some operations may differ from the requested resource Kind. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + kind?: + | string + | undefined; + /** + * UID of the resource. + * (when there is a single resource which can be described). + * More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * +optional + */ + uid?: + | string + | undefined; + /** + * The Causes array includes more details associated with the StatusReason + * failure. Not all StatusReasons may provide detailed causes. + * +optional + * +listType=atomic + */ + causes: StatusCause[]; + /** + * If specified, the time in seconds before the operation should be retried. Some errors may indicate + * the client must take an alternate action - for those errors this field may indicate how long to wait + * before taking the alternate action. + * +optional + */ + retryAfterSeconds?: number | undefined; +} + +/** + * TableOptions are used when a Table is requested by the caller. + * +k8s:conversion-gen:explicit-from=net/url.Values + * +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + */ +export interface TableOptions { + /** + * includeObject decides whether to include each object along with its columnar information. + * Specifying "None" will return no object, specifying "Object" will return the full object contents, and + * specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind + * in version v1beta1 of the meta.k8s.io API group. + */ + includeObject?: string | undefined; +} + +/** + * Time is a wrapper around time.Time which supports correct + * marshaling to YAML and JSON. Wrappers are provided for many + * of the factory methods that the time package offers. + * + * +protobuf.options.marshal=false + * +protobuf.as=Timestamp + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface Time { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds?: + | number + | undefined; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. This field may be limited in precision depending on context. + */ + nanos?: number | undefined; +} + +/** + * Timestamp is a struct that is equivalent to Time, but intended for + * protobuf marshalling/unmarshalling. It is generated into a serialization + * that matches Time. Do not use in Go structs. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds?: + | number + | undefined; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. This field may be limited in precision depending on context. + */ + nanos?: number | undefined; +} + +/** + * TypeMeta describes an individual object in an API response or request + * with strings representing the type of the object and its API schema version. + * Structures that are versioned or persisted should inline TypeMeta. + * + * +k8s:deepcopy-gen=false + */ +export interface TypeMeta { + /** + * Kind is a string value representing the REST resource this object represents. + * Servers may infer this from the endpoint the client submits requests to. + * Cannot be updated. + * In CamelCase. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * +optional + */ + kind?: + | string + | undefined; + /** + * APIVersion defines the versioned schema of this representation of an object. + * Servers should convert recognized schemas to the latest internal value, and + * may reject unrecognized values. + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * +optional + */ + apiVersion?: string | undefined; +} + +/** + * UpdateOptions may be provided when updating an API object. + * All fields in UpdateOptions should also be present in PatchOptions. + */ +export interface UpdateOptions { + /** + * 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 + * +optional + * +listType=atomic + */ + dryRun: string[]; + /** + * fieldManager is a name associated with the actor or entity + * that is making these changes. The value must be less than or + * 128 characters long, and only contain printable characters, + * as defined by https://golang.org/pkg/unicode/#IsPrint. + * +optional + */ + fieldManager?: + | string + | undefined; + /** + * 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. + * +optional + */ + fieldValidation?: string | undefined; +} + +/** + * Verbs masks the value so protobuf can generate + * + * +protobuf.nullable=true + * +protobuf.options.(gogoproto.goproto_stringer)=false + */ +export interface Verbs { + items: string[]; +} + +/** + * Event represents a single event to a watched resource. + * + * +protobuf=true + * +k8s:deepcopy-gen=true + * +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + */ +export interface WatchEvent { + type?: + | string + | undefined; + /** + * Object is: + * * If Type is Added or Modified: the new state of the object. + * * If Type is Deleted: the state of the object immediately before deletion. + * * If Type is Error: *Status is recommended; other types may make sense + * depending on context. + */ + object?: RawExtension | undefined; +} + +function createBaseAPIGroup(): APIGroup { + return { name: "", versions: [], preferredVersion: undefined, serverAddressByClientCIDRs: [] }; +} + +export const APIGroup: MessageFns = { + encode(message: APIGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.versions) { + GroupVersionForDiscovery.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.preferredVersion !== undefined) { + GroupVersionForDiscovery.encode(message.preferredVersion, writer.uint32(26).fork()).join(); + } + for (const v of message.serverAddressByClientCIDRs) { + ServerAddressByClientCIDR.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.versions.push(GroupVersionForDiscovery.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.preferredVersion = GroupVersionForDiscovery.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.serverAddressByClientCIDRs.push(ServerAddressByClientCIDR.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIGroup { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + versions: globalThis.Array.isArray(object?.versions) + ? object.versions.map((e: any) => GroupVersionForDiscovery.fromJSON(e)) + : [], + preferredVersion: isSet(object.preferredVersion) + ? GroupVersionForDiscovery.fromJSON(object.preferredVersion) + : undefined, + serverAddressByClientCIDRs: globalThis.Array.isArray(object?.serverAddressByClientCIDRs) + ? object.serverAddressByClientCIDRs.map((e: any) => ServerAddressByClientCIDR.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIGroup): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.versions?.length) { + obj.versions = message.versions.map((e) => GroupVersionForDiscovery.toJSON(e)); + } + if (message.preferredVersion !== undefined) { + obj.preferredVersion = GroupVersionForDiscovery.toJSON(message.preferredVersion); + } + if (message.serverAddressByClientCIDRs?.length) { + obj.serverAddressByClientCIDRs = message.serverAddressByClientCIDRs.map((e) => + ServerAddressByClientCIDR.toJSON(e) + ); + } + return obj; + }, + + create, I>>(base?: I): APIGroup { + return APIGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIGroup { + const message = createBaseAPIGroup(); + message.name = object.name ?? ""; + message.versions = object.versions?.map((e) => GroupVersionForDiscovery.fromPartial(e)) || []; + message.preferredVersion = (object.preferredVersion !== undefined && object.preferredVersion !== null) + ? GroupVersionForDiscovery.fromPartial(object.preferredVersion) + : undefined; + message.serverAddressByClientCIDRs = + object.serverAddressByClientCIDRs?.map((e) => ServerAddressByClientCIDR.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPIGroupList(): APIGroupList { + return { groups: [] }; +} + +export const APIGroupList: MessageFns = { + encode(message: APIGroupList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.groups) { + APIGroup.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIGroupList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIGroupList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.groups.push(APIGroup.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIGroupList { + return { + groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => APIGroup.fromJSON(e)) : [], + }; + }, + + toJSON(message: APIGroupList): unknown { + const obj: any = {}; + if (message.groups?.length) { + obj.groups = message.groups.map((e) => APIGroup.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIGroupList { + return APIGroupList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIGroupList { + const message = createBaseAPIGroupList(); + message.groups = object.groups?.map((e) => APIGroup.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPIResource(): APIResource { + return { + name: "", + singularName: "", + namespaced: false, + group: "", + version: "", + kind: "", + verbs: undefined, + shortNames: [], + categories: [], + storageVersionHash: "", + }; +} + +export const APIResource: MessageFns = { + encode(message: APIResource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.singularName !== undefined && message.singularName !== "") { + writer.uint32(50).string(message.singularName); + } + if (message.namespaced !== undefined && message.namespaced !== false) { + writer.uint32(16).bool(message.namespaced); + } + if (message.group !== undefined && message.group !== "") { + writer.uint32(66).string(message.group); + } + if (message.version !== undefined && message.version !== "") { + writer.uint32(74).string(message.version); + } + if (message.kind !== undefined && message.kind !== "") { + writer.uint32(26).string(message.kind); + } + if (message.verbs !== undefined) { + Verbs.encode(message.verbs, writer.uint32(34).fork()).join(); + } + for (const v of message.shortNames) { + writer.uint32(42).string(v!); + } + for (const v of message.categories) { + writer.uint32(58).string(v!); + } + if (message.storageVersionHash !== undefined && message.storageVersionHash !== "") { + writer.uint32(82).string(message.storageVersionHash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIResource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIResource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.singularName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.namespaced = reader.bool(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.group = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.version = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.kind = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.verbs = Verbs.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.shortNames.push(reader.string()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.categories.push(reader.string()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.storageVersionHash = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIResource { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + singularName: isSet(object.singularName) ? globalThis.String(object.singularName) : "", + namespaced: isSet(object.namespaced) ? globalThis.Boolean(object.namespaced) : false, + group: isSet(object.group) ? globalThis.String(object.group) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + verbs: isSet(object.verbs) ? Verbs.fromJSON(object.verbs) : undefined, + shortNames: globalThis.Array.isArray(object?.shortNames) + ? object.shortNames.map((e: any) => globalThis.String(e)) + : [], + categories: globalThis.Array.isArray(object?.categories) + ? object.categories.map((e: any) => globalThis.String(e)) + : [], + storageVersionHash: isSet(object.storageVersionHash) ? globalThis.String(object.storageVersionHash) : "", + }; + }, + + toJSON(message: APIResource): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.singularName !== undefined && message.singularName !== "") { + obj.singularName = message.singularName; + } + if (message.namespaced !== undefined && message.namespaced !== false) { + obj.namespaced = message.namespaced; + } + if (message.group !== undefined && message.group !== "") { + obj.group = message.group; + } + if (message.version !== undefined && message.version !== "") { + obj.version = message.version; + } + if (message.kind !== undefined && message.kind !== "") { + obj.kind = message.kind; + } + if (message.verbs !== undefined) { + obj.verbs = Verbs.toJSON(message.verbs); + } + if (message.shortNames?.length) { + obj.shortNames = message.shortNames; + } + if (message.categories?.length) { + obj.categories = message.categories; + } + if (message.storageVersionHash !== undefined && message.storageVersionHash !== "") { + obj.storageVersionHash = message.storageVersionHash; + } + return obj; + }, + + create, I>>(base?: I): APIResource { + return APIResource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIResource { + const message = createBaseAPIResource(); + message.name = object.name ?? ""; + message.singularName = object.singularName ?? ""; + message.namespaced = object.namespaced ?? false; + message.group = object.group ?? ""; + message.version = object.version ?? ""; + message.kind = object.kind ?? ""; + message.verbs = (object.verbs !== undefined && object.verbs !== null) ? Verbs.fromPartial(object.verbs) : undefined; + message.shortNames = object.shortNames?.map((e) => e) || []; + message.categories = object.categories?.map((e) => e) || []; + message.storageVersionHash = object.storageVersionHash ?? ""; + return message; + }, +}; + +function createBaseAPIResourceList(): APIResourceList { + return { groupVersion: "", resources: [] }; +} + +export const APIResourceList: MessageFns = { + encode(message: APIResourceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupVersion !== undefined && message.groupVersion !== "") { + writer.uint32(10).string(message.groupVersion); + } + for (const v of message.resources) { + APIResource.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIResourceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIResourceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.groupVersion = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resources.push(APIResource.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIResourceList { + return { + groupVersion: isSet(object.groupVersion) ? globalThis.String(object.groupVersion) : "", + resources: globalThis.Array.isArray(object?.resources) + ? object.resources.map((e: any) => APIResource.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIResourceList): unknown { + const obj: any = {}; + if (message.groupVersion !== undefined && message.groupVersion !== "") { + obj.groupVersion = message.groupVersion; + } + if (message.resources?.length) { + obj.resources = message.resources.map((e) => APIResource.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): APIResourceList { + return APIResourceList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIResourceList { + const message = createBaseAPIResourceList(); + message.groupVersion = object.groupVersion ?? ""; + message.resources = object.resources?.map((e) => APIResource.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAPIVersions(): APIVersions { + return { versions: [], serverAddressByClientCIDRs: [] }; +} + +export const APIVersions: MessageFns = { + encode(message: APIVersions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.versions) { + writer.uint32(10).string(v!); + } + for (const v of message.serverAddressByClientCIDRs) { + ServerAddressByClientCIDR.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): APIVersions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAPIVersions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.versions.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.serverAddressByClientCIDRs.push(ServerAddressByClientCIDR.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): APIVersions { + return { + versions: globalThis.Array.isArray(object?.versions) ? object.versions.map((e: any) => globalThis.String(e)) : [], + serverAddressByClientCIDRs: globalThis.Array.isArray(object?.serverAddressByClientCIDRs) + ? object.serverAddressByClientCIDRs.map((e: any) => ServerAddressByClientCIDR.fromJSON(e)) + : [], + }; + }, + + toJSON(message: APIVersions): unknown { + const obj: any = {}; + if (message.versions?.length) { + obj.versions = message.versions; + } + if (message.serverAddressByClientCIDRs?.length) { + obj.serverAddressByClientCIDRs = message.serverAddressByClientCIDRs.map((e) => + ServerAddressByClientCIDR.toJSON(e) + ); + } + return obj; + }, + + create, I>>(base?: I): APIVersions { + return APIVersions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): APIVersions { + const message = createBaseAPIVersions(); + message.versions = object.versions?.map((e) => e) || []; + message.serverAddressByClientCIDRs = + object.serverAddressByClientCIDRs?.map((e) => ServerAddressByClientCIDR.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseApplyOptions(): ApplyOptions { + return { dryRun: [], force: false, fieldManager: "" }; +} + +export const ApplyOptions: MessageFns = { + encode(message: ApplyOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.dryRun) { + writer.uint32(10).string(v!); + } + if (message.force !== undefined && message.force !== false) { + writer.uint32(16).bool(message.force); + } + if (message.fieldManager !== undefined && message.fieldManager !== "") { + writer.uint32(26).string(message.fieldManager); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ApplyOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApplyOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.dryRun.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.force = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fieldManager = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ApplyOptions { + return { + dryRun: globalThis.Array.isArray(object?.dryRun) ? object.dryRun.map((e: any) => globalThis.String(e)) : [], + force: isSet(object.force) ? globalThis.Boolean(object.force) : false, + fieldManager: isSet(object.fieldManager) ? globalThis.String(object.fieldManager) : "", + }; + }, + + toJSON(message: ApplyOptions): unknown { + const obj: any = {}; + if (message.dryRun?.length) { + obj.dryRun = message.dryRun; + } + if (message.force !== undefined && message.force !== false) { + obj.force = message.force; + } + if (message.fieldManager !== undefined && message.fieldManager !== "") { + obj.fieldManager = message.fieldManager; + } + return obj; + }, + + create, I>>(base?: I): ApplyOptions { + return ApplyOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ApplyOptions { + const message = createBaseApplyOptions(); + message.dryRun = object.dryRun?.map((e) => e) || []; + message.force = object.force ?? false; + message.fieldManager = object.fieldManager ?? ""; + return message; + }, +}; + +function createBaseCondition(): Condition { + return { type: "", status: "", observedGeneration: 0, lastTransitionTime: undefined, reason: "", message: "" }; +} + +export const Condition: MessageFns = { + encode(message: Condition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== undefined && message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.status !== undefined && message.status !== "") { + writer.uint32(18).string(message.status); + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + writer.uint32(24).int64(message.observedGeneration); + } + if (message.lastTransitionTime !== undefined) { + Time.encode(message.lastTransitionTime, writer.uint32(34).fork()).join(); + } + if (message.reason !== undefined && message.reason !== "") { + writer.uint32(42).string(message.reason); + } + if (message.message !== undefined && message.message !== "") { + writer.uint32(50).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Condition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCondition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.observedGeneration = longToNumber(reader.int64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastTransitionTime = Time.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reason = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Condition { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + status: isSet(object.status) ? globalThis.String(object.status) : "", + observedGeneration: isSet(object.observedGeneration) ? globalThis.Number(object.observedGeneration) : 0, + lastTransitionTime: isSet(object.lastTransitionTime) ? Time.fromJSON(object.lastTransitionTime) : undefined, + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: Condition): unknown { + const obj: any = {}; + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.status !== undefined && message.status !== "") { + obj.status = message.status; + } + if (message.observedGeneration !== undefined && message.observedGeneration !== 0) { + obj.observedGeneration = Math.round(message.observedGeneration); + } + if (message.lastTransitionTime !== undefined) { + obj.lastTransitionTime = Time.toJSON(message.lastTransitionTime); + } + if (message.reason !== undefined && message.reason !== "") { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): Condition { + return Condition.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Condition { + const message = createBaseCondition(); + message.type = object.type ?? ""; + message.status = object.status ?? ""; + message.observedGeneration = object.observedGeneration ?? 0; + message.lastTransitionTime = (object.lastTransitionTime !== undefined && object.lastTransitionTime !== null) + ? Time.fromPartial(object.lastTransitionTime) + : undefined; + message.reason = object.reason ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseCreateOptions(): CreateOptions { + return { dryRun: [], fieldManager: "", fieldValidation: "" }; +} + +export const CreateOptions: MessageFns = { + encode(message: CreateOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.dryRun) { + writer.uint32(10).string(v!); + } + if (message.fieldManager !== undefined && message.fieldManager !== "") { + writer.uint32(26).string(message.fieldManager); + } + if (message.fieldValidation !== undefined && message.fieldValidation !== "") { + writer.uint32(34).string(message.fieldValidation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.dryRun.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fieldManager = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.fieldValidation = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): CreateOptions { + return { + dryRun: globalThis.Array.isArray(object?.dryRun) ? object.dryRun.map((e: any) => globalThis.String(e)) : [], + fieldManager: isSet(object.fieldManager) ? globalThis.String(object.fieldManager) : "", + fieldValidation: isSet(object.fieldValidation) ? globalThis.String(object.fieldValidation) : "", + }; + }, + + toJSON(message: CreateOptions): unknown { + const obj: any = {}; + if (message.dryRun?.length) { + obj.dryRun = message.dryRun; + } + if (message.fieldManager !== undefined && message.fieldManager !== "") { + obj.fieldManager = message.fieldManager; + } + if (message.fieldValidation !== undefined && message.fieldValidation !== "") { + obj.fieldValidation = message.fieldValidation; + } + return obj; + }, + + create, I>>(base?: I): CreateOptions { + return CreateOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateOptions { + const message = createBaseCreateOptions(); + message.dryRun = object.dryRun?.map((e) => e) || []; + message.fieldManager = object.fieldManager ?? ""; + message.fieldValidation = object.fieldValidation ?? ""; + return message; + }, +}; + +function createBaseDeleteOptions(): DeleteOptions { + return { + gracePeriodSeconds: 0, + preconditions: undefined, + orphanDependents: false, + propagationPolicy: "", + dryRun: [], + ignoreStoreReadErrorWithClusterBreakingPotential: false, + }; +} + +export const DeleteOptions: MessageFns = { + encode(message: DeleteOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gracePeriodSeconds !== undefined && message.gracePeriodSeconds !== 0) { + writer.uint32(8).int64(message.gracePeriodSeconds); + } + if (message.preconditions !== undefined) { + Preconditions.encode(message.preconditions, writer.uint32(18).fork()).join(); + } + if (message.orphanDependents !== undefined && message.orphanDependents !== false) { + writer.uint32(24).bool(message.orphanDependents); + } + if (message.propagationPolicy !== undefined && message.propagationPolicy !== "") { + writer.uint32(34).string(message.propagationPolicy); + } + for (const v of message.dryRun) { + writer.uint32(42).string(v!); + } + if ( + message.ignoreStoreReadErrorWithClusterBreakingPotential !== undefined && + message.ignoreStoreReadErrorWithClusterBreakingPotential !== false + ) { + writer.uint32(48).bool(message.ignoreStoreReadErrorWithClusterBreakingPotential); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.gracePeriodSeconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.preconditions = Preconditions.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.orphanDependents = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.propagationPolicy = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.dryRun.push(reader.string()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.ignoreStoreReadErrorWithClusterBreakingPotential = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): DeleteOptions { + return { + gracePeriodSeconds: isSet(object.gracePeriodSeconds) ? globalThis.Number(object.gracePeriodSeconds) : 0, + preconditions: isSet(object.preconditions) ? Preconditions.fromJSON(object.preconditions) : undefined, + orphanDependents: isSet(object.orphanDependents) ? globalThis.Boolean(object.orphanDependents) : false, + propagationPolicy: isSet(object.propagationPolicy) ? globalThis.String(object.propagationPolicy) : "", + dryRun: globalThis.Array.isArray(object?.dryRun) ? object.dryRun.map((e: any) => globalThis.String(e)) : [], + ignoreStoreReadErrorWithClusterBreakingPotential: isSet(object.ignoreStoreReadErrorWithClusterBreakingPotential) + ? globalThis.Boolean(object.ignoreStoreReadErrorWithClusterBreakingPotential) + : false, + }; + }, + + toJSON(message: DeleteOptions): unknown { + const obj: any = {}; + if (message.gracePeriodSeconds !== undefined && message.gracePeriodSeconds !== 0) { + obj.gracePeriodSeconds = Math.round(message.gracePeriodSeconds); + } + if (message.preconditions !== undefined) { + obj.preconditions = Preconditions.toJSON(message.preconditions); + } + if (message.orphanDependents !== undefined && message.orphanDependents !== false) { + obj.orphanDependents = message.orphanDependents; + } + if (message.propagationPolicy !== undefined && message.propagationPolicy !== "") { + obj.propagationPolicy = message.propagationPolicy; + } + if (message.dryRun?.length) { + obj.dryRun = message.dryRun; + } + if ( + message.ignoreStoreReadErrorWithClusterBreakingPotential !== undefined && + message.ignoreStoreReadErrorWithClusterBreakingPotential !== false + ) { + obj.ignoreStoreReadErrorWithClusterBreakingPotential = message.ignoreStoreReadErrorWithClusterBreakingPotential; + } + return obj; + }, + + create, I>>(base?: I): DeleteOptions { + return DeleteOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeleteOptions { + const message = createBaseDeleteOptions(); + message.gracePeriodSeconds = object.gracePeriodSeconds ?? 0; + message.preconditions = (object.preconditions !== undefined && object.preconditions !== null) + ? Preconditions.fromPartial(object.preconditions) + : undefined; + message.orphanDependents = object.orphanDependents ?? false; + message.propagationPolicy = object.propagationPolicy ?? ""; + message.dryRun = object.dryRun?.map((e) => e) || []; + message.ignoreStoreReadErrorWithClusterBreakingPotential = + object.ignoreStoreReadErrorWithClusterBreakingPotential ?? false; + return message; + }, +}; + +function createBaseDuration(): Duration { + return { duration: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.duration !== undefined && message.duration !== 0) { + writer.uint32(8).int64(message.duration); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.duration = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Duration { + return { duration: isSet(object.duration) ? globalThis.Number(object.duration) : 0 }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.duration !== undefined && message.duration !== 0) { + obj.duration = Math.round(message.duration); + } + return obj; + }, + + create, I>>(base?: I): Duration { + return Duration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.duration = object.duration ?? 0; + return message; + }, +}; + +function createBaseFieldSelectorRequirement(): FieldSelectorRequirement { + return { key: "", operator: "", values: [] }; +} + +export const FieldSelectorRequirement: MessageFns = { + encode(message: FieldSelectorRequirement, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined && message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.operator !== undefined && message.operator !== "") { + writer.uint32(18).string(message.operator); + } + for (const v of message.values) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldSelectorRequirement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldSelectorRequirement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.operator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.values.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FieldSelectorRequirement { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + operator: isSet(object.operator) ? globalThis.String(object.operator) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: FieldSelectorRequirement): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== "") { + obj.key = message.key; + } + if (message.operator !== undefined && message.operator !== "") { + obj.operator = message.operator; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create, I>>(base?: I): FieldSelectorRequirement { + return FieldSelectorRequirement.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldSelectorRequirement { + const message = createBaseFieldSelectorRequirement(); + message.key = object.key ?? ""; + message.operator = object.operator ?? ""; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseFieldsV1(): FieldsV1 { + return { Raw: new Uint8Array(0) }; +} + +export const FieldsV1: MessageFns = { + encode(message: FieldsV1, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.Raw !== undefined && message.Raw.length !== 0) { + writer.uint32(10).bytes(message.Raw); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldsV1 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldsV1(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.Raw = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): FieldsV1 { + return { Raw: isSet(object.Raw) ? bytesFromBase64(object.Raw) : new Uint8Array(0) }; + }, + + toJSON(message: FieldsV1): unknown { + const obj: any = {}; + if (message.Raw !== undefined && message.Raw.length !== 0) { + obj.Raw = base64FromBytes(message.Raw); + } + return obj; + }, + + create, I>>(base?: I): FieldsV1 { + return FieldsV1.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldsV1 { + const message = createBaseFieldsV1(); + message.Raw = object.Raw ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseGetOptions(): GetOptions { + return { resourceVersion: "" }; +} + +export const GetOptions: MessageFns = { + encode(message: GetOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + writer.uint32(10).string(message.resourceVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GetOptions { + return { resourceVersion: isSet(object.resourceVersion) ? globalThis.String(object.resourceVersion) : "" }; + }, + + toJSON(message: GetOptions): unknown { + const obj: any = {}; + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + obj.resourceVersion = message.resourceVersion; + } + return obj; + }, + + create, I>>(base?: I): GetOptions { + return GetOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetOptions { + const message = createBaseGetOptions(); + message.resourceVersion = object.resourceVersion ?? ""; + return message; + }, +}; + +function createBaseGroupKind(): GroupKind { + return { group: "", kind: "" }; +} + +export const GroupKind: MessageFns = { + encode(message: GroupKind, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.group !== undefined && message.group !== "") { + writer.uint32(10).string(message.group); + } + if (message.kind !== undefined && message.kind !== "") { + writer.uint32(18).string(message.kind); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupKind { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupKind(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.group = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.kind = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GroupKind { + return { + group: isSet(object.group) ? globalThis.String(object.group) : "", + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + }; + }, + + toJSON(message: GroupKind): unknown { + const obj: any = {}; + if (message.group !== undefined && message.group !== "") { + obj.group = message.group; + } + if (message.kind !== undefined && message.kind !== "") { + obj.kind = message.kind; + } + return obj; + }, + + create, I>>(base?: I): GroupKind { + return GroupKind.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupKind { + const message = createBaseGroupKind(); + message.group = object.group ?? ""; + message.kind = object.kind ?? ""; + return message; + }, +}; + +function createBaseGroupResource(): GroupResource { + return { group: "", resource: "" }; +} + +export const GroupResource: MessageFns = { + encode(message: GroupResource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.group !== undefined && message.group !== "") { + writer.uint32(10).string(message.group); + } + if (message.resource !== undefined && message.resource !== "") { + writer.uint32(18).string(message.resource); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupResource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupResource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.group = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resource = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GroupResource { + return { + group: isSet(object.group) ? globalThis.String(object.group) : "", + resource: isSet(object.resource) ? globalThis.String(object.resource) : "", + }; + }, + + toJSON(message: GroupResource): unknown { + const obj: any = {}; + if (message.group !== undefined && message.group !== "") { + obj.group = message.group; + } + if (message.resource !== undefined && message.resource !== "") { + obj.resource = message.resource; + } + return obj; + }, + + create, I>>(base?: I): GroupResource { + return GroupResource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupResource { + const message = createBaseGroupResource(); + message.group = object.group ?? ""; + message.resource = object.resource ?? ""; + return message; + }, +}; + +function createBaseGroupVersion(): GroupVersion { + return { group: "", version: "" }; +} + +export const GroupVersion: MessageFns = { + encode(message: GroupVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.group !== undefined && message.group !== "") { + writer.uint32(10).string(message.group); + } + if (message.version !== undefined && message.version !== "") { + writer.uint32(18).string(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.group = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GroupVersion { + return { + group: isSet(object.group) ? globalThis.String(object.group) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + }; + }, + + toJSON(message: GroupVersion): unknown { + const obj: any = {}; + if (message.group !== undefined && message.group !== "") { + obj.group = message.group; + } + if (message.version !== undefined && message.version !== "") { + obj.version = message.version; + } + return obj; + }, + + create, I>>(base?: I): GroupVersion { + return GroupVersion.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupVersion { + const message = createBaseGroupVersion(); + message.group = object.group ?? ""; + message.version = object.version ?? ""; + return message; + }, +}; + +function createBaseGroupVersionForDiscovery(): GroupVersionForDiscovery { + return { groupVersion: "", version: "" }; +} + +export const GroupVersionForDiscovery: MessageFns = { + encode(message: GroupVersionForDiscovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.groupVersion !== undefined && message.groupVersion !== "") { + writer.uint32(10).string(message.groupVersion); + } + if (message.version !== undefined && message.version !== "") { + writer.uint32(18).string(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupVersionForDiscovery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupVersionForDiscovery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.groupVersion = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GroupVersionForDiscovery { + return { + groupVersion: isSet(object.groupVersion) ? globalThis.String(object.groupVersion) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + }; + }, + + toJSON(message: GroupVersionForDiscovery): unknown { + const obj: any = {}; + if (message.groupVersion !== undefined && message.groupVersion !== "") { + obj.groupVersion = message.groupVersion; + } + if (message.version !== undefined && message.version !== "") { + obj.version = message.version; + } + return obj; + }, + + create, I>>(base?: I): GroupVersionForDiscovery { + return GroupVersionForDiscovery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupVersionForDiscovery { + const message = createBaseGroupVersionForDiscovery(); + message.groupVersion = object.groupVersion ?? ""; + message.version = object.version ?? ""; + return message; + }, +}; + +function createBaseGroupVersionKind(): GroupVersionKind { + return { group: "", version: "", kind: "" }; +} + +export const GroupVersionKind: MessageFns = { + encode(message: GroupVersionKind, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.group !== undefined && message.group !== "") { + writer.uint32(10).string(message.group); + } + if (message.version !== undefined && message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.kind !== undefined && message.kind !== "") { + writer.uint32(26).string(message.kind); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupVersionKind { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupVersionKind(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.group = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.kind = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GroupVersionKind { + return { + group: isSet(object.group) ? globalThis.String(object.group) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + }; + }, + + toJSON(message: GroupVersionKind): unknown { + const obj: any = {}; + if (message.group !== undefined && message.group !== "") { + obj.group = message.group; + } + if (message.version !== undefined && message.version !== "") { + obj.version = message.version; + } + if (message.kind !== undefined && message.kind !== "") { + obj.kind = message.kind; + } + return obj; + }, + + create, I>>(base?: I): GroupVersionKind { + return GroupVersionKind.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupVersionKind { + const message = createBaseGroupVersionKind(); + message.group = object.group ?? ""; + message.version = object.version ?? ""; + message.kind = object.kind ?? ""; + return message; + }, +}; + +function createBaseGroupVersionResource(): GroupVersionResource { + return { group: "", version: "", resource: "" }; +} + +export const GroupVersionResource: MessageFns = { + encode(message: GroupVersionResource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.group !== undefined && message.group !== "") { + writer.uint32(10).string(message.group); + } + if (message.version !== undefined && message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.resource !== undefined && message.resource !== "") { + writer.uint32(26).string(message.resource); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GroupVersionResource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupVersionResource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.group = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.resource = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): GroupVersionResource { + return { + group: isSet(object.group) ? globalThis.String(object.group) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + resource: isSet(object.resource) ? globalThis.String(object.resource) : "", + }; + }, + + toJSON(message: GroupVersionResource): unknown { + const obj: any = {}; + if (message.group !== undefined && message.group !== "") { + obj.group = message.group; + } + if (message.version !== undefined && message.version !== "") { + obj.version = message.version; + } + if (message.resource !== undefined && message.resource !== "") { + obj.resource = message.resource; + } + return obj; + }, + + create, I>>(base?: I): GroupVersionResource { + return GroupVersionResource.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GroupVersionResource { + const message = createBaseGroupVersionResource(); + message.group = object.group ?? ""; + message.version = object.version ?? ""; + message.resource = object.resource ?? ""; + return message; + }, +}; + +function createBaseLabelSelector(): LabelSelector { + return { matchLabels: {}, matchExpressions: [] }; +} + +export const LabelSelector: MessageFns = { + encode(message: LabelSelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + globalThis.Object.entries(message.matchLabels).forEach(([key, value]: [string, string]) => { + LabelSelector_MatchLabelsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + for (const v of message.matchExpressions) { + LabelSelectorRequirement.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LabelSelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLabelSelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = LabelSelector_MatchLabelsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.matchLabels[entry1.key] = entry1.value; + } + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.matchExpressions.push(LabelSelectorRequirement.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LabelSelector { + return { + matchLabels: isObject(object.matchLabels) + ? (globalThis.Object.entries(object.matchLabels) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + matchExpressions: globalThis.Array.isArray(object?.matchExpressions) + ? object.matchExpressions.map((e: any) => LabelSelectorRequirement.fromJSON(e)) + : [], + }; + }, + + toJSON(message: LabelSelector): unknown { + const obj: any = {}; + if (message.matchLabels) { + const entries = globalThis.Object.entries(message.matchLabels) as [string, string][]; + if (entries.length > 0) { + obj.matchLabels = {}; + entries.forEach(([k, v]) => { + obj.matchLabels[k] = v; + }); + } + } + if (message.matchExpressions?.length) { + obj.matchExpressions = message.matchExpressions.map((e) => LabelSelectorRequirement.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LabelSelector { + return LabelSelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LabelSelector { + const message = createBaseLabelSelector(); + message.matchLabels = (globalThis.Object.entries(object.matchLabels ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.matchExpressions = object.matchExpressions?.map((e) => LabelSelectorRequirement.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLabelSelector_MatchLabelsEntry(): LabelSelector_MatchLabelsEntry { + return { key: "", value: "" }; +} + +export const LabelSelector_MatchLabelsEntry: MessageFns = { + encode(message: LabelSelector_MatchLabelsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LabelSelector_MatchLabelsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLabelSelector_MatchLabelsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LabelSelector_MatchLabelsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: LabelSelector_MatchLabelsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): LabelSelector_MatchLabelsEntry { + return LabelSelector_MatchLabelsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): LabelSelector_MatchLabelsEntry { + const message = createBaseLabelSelector_MatchLabelsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseLabelSelectorRequirement(): LabelSelectorRequirement { + return { key: "", operator: "", values: [] }; +} + +export const LabelSelectorRequirement: MessageFns = { + encode(message: LabelSelectorRequirement, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined && message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.operator !== undefined && message.operator !== "") { + writer.uint32(18).string(message.operator); + } + for (const v of message.values) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LabelSelectorRequirement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLabelSelectorRequirement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.operator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.values.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): LabelSelectorRequirement { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + operator: isSet(object.operator) ? globalThis.String(object.operator) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: LabelSelectorRequirement): unknown { + const obj: any = {}; + if (message.key !== undefined && message.key !== "") { + obj.key = message.key; + } + if (message.operator !== undefined && message.operator !== "") { + obj.operator = message.operator; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create, I>>(base?: I): LabelSelectorRequirement { + return LabelSelectorRequirement.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LabelSelectorRequirement { + const message = createBaseLabelSelectorRequirement(); + message.key = object.key ?? ""; + message.operator = object.operator ?? ""; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseList(): List { + return { metadata: undefined, items: [] }; +} + +export const List: MessageFns = { + encode(message: List, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + RawExtension.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): List { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(RawExtension.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): List { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) ? object.items.map((e: any) => RawExtension.fromJSON(e)) : [], + }; + }, + + toJSON(message: List): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => RawExtension.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): List { + return List.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): List { + const message = createBaseList(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => RawExtension.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListMeta(): ListMeta { + return { selfLink: "", resourceVersion: "", continue: "", remainingItemCount: 0, shardInfo: undefined }; +} + +export const ListMeta: MessageFns = { + encode(message: ListMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selfLink !== undefined && message.selfLink !== "") { + writer.uint32(10).string(message.selfLink); + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + writer.uint32(18).string(message.resourceVersion); + } + if (message.continue !== undefined && message.continue !== "") { + writer.uint32(26).string(message.continue); + } + if (message.remainingItemCount !== undefined && message.remainingItemCount !== 0) { + writer.uint32(32).int64(message.remainingItemCount); + } + if (message.shardInfo !== undefined) { + ShardInfo.encode(message.shardInfo, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.selfLink = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resourceVersion = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.continue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.remainingItemCount = longToNumber(reader.int64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.shardInfo = ShardInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ListMeta { + return { + selfLink: isSet(object.selfLink) ? globalThis.String(object.selfLink) : "", + resourceVersion: isSet(object.resourceVersion) ? globalThis.String(object.resourceVersion) : "", + continue: isSet(object.continue) ? globalThis.String(object.continue) : "", + remainingItemCount: isSet(object.remainingItemCount) ? globalThis.Number(object.remainingItemCount) : 0, + shardInfo: isSet(object.shardInfo) ? ShardInfo.fromJSON(object.shardInfo) : undefined, + }; + }, + + toJSON(message: ListMeta): unknown { + const obj: any = {}; + if (message.selfLink !== undefined && message.selfLink !== "") { + obj.selfLink = message.selfLink; + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + obj.resourceVersion = message.resourceVersion; + } + if (message.continue !== undefined && message.continue !== "") { + obj.continue = message.continue; + } + if (message.remainingItemCount !== undefined && message.remainingItemCount !== 0) { + obj.remainingItemCount = Math.round(message.remainingItemCount); + } + if (message.shardInfo !== undefined) { + obj.shardInfo = ShardInfo.toJSON(message.shardInfo); + } + return obj; + }, + + create, I>>(base?: I): ListMeta { + return ListMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListMeta { + const message = createBaseListMeta(); + message.selfLink = object.selfLink ?? ""; + message.resourceVersion = object.resourceVersion ?? ""; + message.continue = object.continue ?? ""; + message.remainingItemCount = object.remainingItemCount ?? 0; + message.shardInfo = (object.shardInfo !== undefined && object.shardInfo !== null) + ? ShardInfo.fromPartial(object.shardInfo) + : undefined; + return message; + }, +}; + +function createBaseListOptions(): ListOptions { + return { + labelSelector: "", + fieldSelector: "", + watch: false, + allowWatchBookmarks: false, + resourceVersion: "", + resourceVersionMatch: "", + timeoutSeconds: 0, + limit: 0, + continue: "", + sendInitialEvents: false, + shardSelector: "", + }; +} + +export const ListOptions: MessageFns = { + encode(message: ListOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.labelSelector !== undefined && message.labelSelector !== "") { + writer.uint32(10).string(message.labelSelector); + } + if (message.fieldSelector !== undefined && message.fieldSelector !== "") { + writer.uint32(18).string(message.fieldSelector); + } + if (message.watch !== undefined && message.watch !== false) { + writer.uint32(24).bool(message.watch); + } + if (message.allowWatchBookmarks !== undefined && message.allowWatchBookmarks !== false) { + writer.uint32(72).bool(message.allowWatchBookmarks); + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + writer.uint32(34).string(message.resourceVersion); + } + if (message.resourceVersionMatch !== undefined && message.resourceVersionMatch !== "") { + writer.uint32(82).string(message.resourceVersionMatch); + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + writer.uint32(40).int64(message.timeoutSeconds); + } + if (message.limit !== undefined && message.limit !== 0) { + writer.uint32(56).int64(message.limit); + } + if (message.continue !== undefined && message.continue !== "") { + writer.uint32(66).string(message.continue); + } + if (message.sendInitialEvents !== undefined && message.sendInitialEvents !== false) { + writer.uint32(88).bool(message.sendInitialEvents); + } + if (message.shardSelector !== undefined && message.shardSelector !== "") { + writer.uint32(122).string(message.shardSelector); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.labelSelector = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fieldSelector = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.watch = reader.bool(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.allowWatchBookmarks = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resourceVersion = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.resourceVersionMatch = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.timeoutSeconds = longToNumber(reader.int64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.limit = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.continue = reader.string(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.sendInitialEvents = reader.bool(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.shardSelector = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ListOptions { + return { + labelSelector: isSet(object.labelSelector) ? globalThis.String(object.labelSelector) : "", + fieldSelector: isSet(object.fieldSelector) ? globalThis.String(object.fieldSelector) : "", + watch: isSet(object.watch) ? globalThis.Boolean(object.watch) : false, + allowWatchBookmarks: isSet(object.allowWatchBookmarks) ? globalThis.Boolean(object.allowWatchBookmarks) : false, + resourceVersion: isSet(object.resourceVersion) ? globalThis.String(object.resourceVersion) : "", + resourceVersionMatch: isSet(object.resourceVersionMatch) ? globalThis.String(object.resourceVersionMatch) : "", + timeoutSeconds: isSet(object.timeoutSeconds) ? globalThis.Number(object.timeoutSeconds) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + continue: isSet(object.continue) ? globalThis.String(object.continue) : "", + sendInitialEvents: isSet(object.sendInitialEvents) ? globalThis.Boolean(object.sendInitialEvents) : false, + shardSelector: isSet(object.shardSelector) ? globalThis.String(object.shardSelector) : "", + }; + }, + + toJSON(message: ListOptions): unknown { + const obj: any = {}; + if (message.labelSelector !== undefined && message.labelSelector !== "") { + obj.labelSelector = message.labelSelector; + } + if (message.fieldSelector !== undefined && message.fieldSelector !== "") { + obj.fieldSelector = message.fieldSelector; + } + if (message.watch !== undefined && message.watch !== false) { + obj.watch = message.watch; + } + if (message.allowWatchBookmarks !== undefined && message.allowWatchBookmarks !== false) { + obj.allowWatchBookmarks = message.allowWatchBookmarks; + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + obj.resourceVersion = message.resourceVersion; + } + if (message.resourceVersionMatch !== undefined && message.resourceVersionMatch !== "") { + obj.resourceVersionMatch = message.resourceVersionMatch; + } + if (message.timeoutSeconds !== undefined && message.timeoutSeconds !== 0) { + obj.timeoutSeconds = Math.round(message.timeoutSeconds); + } + if (message.limit !== undefined && message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.continue !== undefined && message.continue !== "") { + obj.continue = message.continue; + } + if (message.sendInitialEvents !== undefined && message.sendInitialEvents !== false) { + obj.sendInitialEvents = message.sendInitialEvents; + } + if (message.shardSelector !== undefined && message.shardSelector !== "") { + obj.shardSelector = message.shardSelector; + } + return obj; + }, + + create, I>>(base?: I): ListOptions { + return ListOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListOptions { + const message = createBaseListOptions(); + message.labelSelector = object.labelSelector ?? ""; + message.fieldSelector = object.fieldSelector ?? ""; + message.watch = object.watch ?? false; + message.allowWatchBookmarks = object.allowWatchBookmarks ?? false; + message.resourceVersion = object.resourceVersion ?? ""; + message.resourceVersionMatch = object.resourceVersionMatch ?? ""; + message.timeoutSeconds = object.timeoutSeconds ?? 0; + message.limit = object.limit ?? 0; + message.continue = object.continue ?? ""; + message.sendInitialEvents = object.sendInitialEvents ?? false; + message.shardSelector = object.shardSelector ?? ""; + return message; + }, +}; + +function createBaseManagedFieldsEntry(): ManagedFieldsEntry { + return { + manager: "", + operation: "", + apiVersion: "", + time: undefined, + fieldsType: "", + fieldsV1: undefined, + subresource: "", + }; +} + +export const ManagedFieldsEntry: MessageFns = { + encode(message: ManagedFieldsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.manager !== undefined && message.manager !== "") { + writer.uint32(10).string(message.manager); + } + if (message.operation !== undefined && message.operation !== "") { + writer.uint32(18).string(message.operation); + } + if (message.apiVersion !== undefined && message.apiVersion !== "") { + writer.uint32(26).string(message.apiVersion); + } + if (message.time !== undefined) { + Time.encode(message.time, writer.uint32(34).fork()).join(); + } + if (message.fieldsType !== undefined && message.fieldsType !== "") { + writer.uint32(50).string(message.fieldsType); + } + if (message.fieldsV1 !== undefined) { + FieldsV1.encode(message.fieldsV1, writer.uint32(58).fork()).join(); + } + if (message.subresource !== undefined && message.subresource !== "") { + writer.uint32(66).string(message.subresource); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ManagedFieldsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseManagedFieldsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.manager = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.operation = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.time = Time.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.fieldsType = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.fieldsV1 = FieldsV1.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.subresource = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ManagedFieldsEntry { + return { + manager: isSet(object.manager) ? globalThis.String(object.manager) : "", + operation: isSet(object.operation) ? globalThis.String(object.operation) : "", + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : "", + time: isSet(object.time) ? Time.fromJSON(object.time) : undefined, + fieldsType: isSet(object.fieldsType) ? globalThis.String(object.fieldsType) : "", + fieldsV1: isSet(object.fieldsV1) ? FieldsV1.fromJSON(object.fieldsV1) : undefined, + subresource: isSet(object.subresource) ? globalThis.String(object.subresource) : "", + }; + }, + + toJSON(message: ManagedFieldsEntry): unknown { + const obj: any = {}; + if (message.manager !== undefined && message.manager !== "") { + obj.manager = message.manager; + } + if (message.operation !== undefined && message.operation !== "") { + obj.operation = message.operation; + } + if (message.apiVersion !== undefined && message.apiVersion !== "") { + obj.apiVersion = message.apiVersion; + } + if (message.time !== undefined) { + obj.time = Time.toJSON(message.time); + } + if (message.fieldsType !== undefined && message.fieldsType !== "") { + obj.fieldsType = message.fieldsType; + } + if (message.fieldsV1 !== undefined) { + obj.fieldsV1 = FieldsV1.toJSON(message.fieldsV1); + } + if (message.subresource !== undefined && message.subresource !== "") { + obj.subresource = message.subresource; + } + return obj; + }, + + create, I>>(base?: I): ManagedFieldsEntry { + return ManagedFieldsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ManagedFieldsEntry { + const message = createBaseManagedFieldsEntry(); + message.manager = object.manager ?? ""; + message.operation = object.operation ?? ""; + message.apiVersion = object.apiVersion ?? ""; + message.time = (object.time !== undefined && object.time !== null) ? Time.fromPartial(object.time) : undefined; + message.fieldsType = object.fieldsType ?? ""; + message.fieldsV1 = (object.fieldsV1 !== undefined && object.fieldsV1 !== null) + ? FieldsV1.fromPartial(object.fieldsV1) + : undefined; + message.subresource = object.subresource ?? ""; + return message; + }, +}; + +function createBaseMicroTime(): MicroTime { + return { seconds: 0, nanos: 0 }; +} + +export const MicroTime: MessageFns = { + encode(message: MicroTime, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== undefined && message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== undefined && message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MicroTime { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMicroTime(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): MicroTime { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: MicroTime): unknown { + const obj: any = {}; + if (message.seconds !== undefined && message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== undefined && message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + + create, I>>(base?: I): MicroTime { + return MicroTime.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MicroTime { + const message = createBaseMicroTime(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +function createBaseObjectMeta(): ObjectMeta { + return { + name: "", + generateName: "", + namespace: "", + selfLink: "", + uid: "", + resourceVersion: "", + generation: 0, + creationTimestamp: undefined, + deletionTimestamp: undefined, + deletionGracePeriodSeconds: 0, + labels: {}, + annotations: {}, + ownerReferences: [], + finalizers: [], + managedFields: [], + }; +} + +export const ObjectMeta: MessageFns = { + encode(message: ObjectMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.generateName !== undefined && message.generateName !== "") { + writer.uint32(18).string(message.generateName); + } + if (message.namespace !== undefined && message.namespace !== "") { + writer.uint32(26).string(message.namespace); + } + if (message.selfLink !== undefined && message.selfLink !== "") { + writer.uint32(34).string(message.selfLink); + } + if (message.uid !== undefined && message.uid !== "") { + writer.uint32(42).string(message.uid); + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + writer.uint32(50).string(message.resourceVersion); + } + if (message.generation !== undefined && message.generation !== 0) { + writer.uint32(56).int64(message.generation); + } + if (message.creationTimestamp !== undefined) { + Time.encode(message.creationTimestamp, writer.uint32(66).fork()).join(); + } + if (message.deletionTimestamp !== undefined) { + Time.encode(message.deletionTimestamp, writer.uint32(74).fork()).join(); + } + if (message.deletionGracePeriodSeconds !== undefined && message.deletionGracePeriodSeconds !== 0) { + writer.uint32(80).int64(message.deletionGracePeriodSeconds); + } + globalThis.Object.entries(message.labels).forEach(([key, value]: [string, string]) => { + ObjectMeta_LabelsEntry.encode({ key: key as any, value }, writer.uint32(90).fork()).join(); + }); + globalThis.Object.entries(message.annotations).forEach(([key, value]: [string, string]) => { + ObjectMeta_AnnotationsEntry.encode({ key: key as any, value }, writer.uint32(98).fork()).join(); + }); + for (const v of message.ownerReferences) { + OwnerReference.encode(v!, writer.uint32(106).fork()).join(); + } + for (const v of message.finalizers) { + writer.uint32(114).string(v!); + } + for (const v of message.managedFields) { + ManagedFieldsEntry.encode(v!, writer.uint32(138).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.generateName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.namespace = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.selfLink = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.uid = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.resourceVersion = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.generation = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.creationTimestamp = Time.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.deletionTimestamp = Time.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.deletionGracePeriodSeconds = longToNumber(reader.int64()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + const entry11 = ObjectMeta_LabelsEntry.decode(reader, reader.uint32()); + if (entry11.value !== undefined) { + message.labels[entry11.key] = entry11.value; + } + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + const entry12 = ObjectMeta_AnnotationsEntry.decode(reader, reader.uint32()); + if (entry12.value !== undefined) { + message.annotations[entry12.key] = entry12.value; + } + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.ownerReferences.push(OwnerReference.decode(reader, reader.uint32())); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.finalizers.push(reader.string()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.managedFields.push(ManagedFieldsEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectMeta { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + generateName: isSet(object.generateName) ? globalThis.String(object.generateName) : "", + namespace: isSet(object.namespace) ? globalThis.String(object.namespace) : "", + selfLink: isSet(object.selfLink) ? globalThis.String(object.selfLink) : "", + uid: isSet(object.uid) ? globalThis.String(object.uid) : "", + resourceVersion: isSet(object.resourceVersion) ? globalThis.String(object.resourceVersion) : "", + generation: isSet(object.generation) ? globalThis.Number(object.generation) : 0, + creationTimestamp: isSet(object.creationTimestamp) ? Time.fromJSON(object.creationTimestamp) : undefined, + deletionTimestamp: isSet(object.deletionTimestamp) ? Time.fromJSON(object.deletionTimestamp) : undefined, + deletionGracePeriodSeconds: isSet(object.deletionGracePeriodSeconds) + ? globalThis.Number(object.deletionGracePeriodSeconds) + : 0, + labels: isObject(object.labels) + ? (globalThis.Object.entries(object.labels) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + annotations: isObject(object.annotations) + ? (globalThis.Object.entries(object.annotations) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + globalThis.Object.defineProperty(acc, key, { + value: globalThis.String(value), + enumerable: true, + configurable: true, + writable: true, + }); + return acc; + }, + {}, + ) + : {}, + ownerReferences: globalThis.Array.isArray(object?.ownerReferences) + ? object.ownerReferences.map((e: any) => OwnerReference.fromJSON(e)) + : [], + finalizers: globalThis.Array.isArray(object?.finalizers) + ? object.finalizers.map((e: any) => globalThis.String(e)) + : [], + managedFields: globalThis.Array.isArray(object?.managedFields) + ? object.managedFields.map((e: any) => ManagedFieldsEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ObjectMeta): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.generateName !== undefined && message.generateName !== "") { + obj.generateName = message.generateName; + } + if (message.namespace !== undefined && message.namespace !== "") { + obj.namespace = message.namespace; + } + if (message.selfLink !== undefined && message.selfLink !== "") { + obj.selfLink = message.selfLink; + } + if (message.uid !== undefined && message.uid !== "") { + obj.uid = message.uid; + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + obj.resourceVersion = message.resourceVersion; + } + if (message.generation !== undefined && message.generation !== 0) { + obj.generation = Math.round(message.generation); + } + if (message.creationTimestamp !== undefined) { + obj.creationTimestamp = Time.toJSON(message.creationTimestamp); + } + if (message.deletionTimestamp !== undefined) { + obj.deletionTimestamp = Time.toJSON(message.deletionTimestamp); + } + if (message.deletionGracePeriodSeconds !== undefined && message.deletionGracePeriodSeconds !== 0) { + obj.deletionGracePeriodSeconds = Math.round(message.deletionGracePeriodSeconds); + } + if (message.labels) { + const entries = globalThis.Object.entries(message.labels) as [string, string][]; + if (entries.length > 0) { + obj.labels = {}; + entries.forEach(([k, v]) => { + obj.labels[k] = v; + }); + } + } + if (message.annotations) { + const entries = globalThis.Object.entries(message.annotations) as [string, string][]; + if (entries.length > 0) { + obj.annotations = {}; + entries.forEach(([k, v]) => { + obj.annotations[k] = v; + }); + } + } + if (message.ownerReferences?.length) { + obj.ownerReferences = message.ownerReferences.map((e) => OwnerReference.toJSON(e)); + } + if (message.finalizers?.length) { + obj.finalizers = message.finalizers; + } + if (message.managedFields?.length) { + obj.managedFields = message.managedFields.map((e) => ManagedFieldsEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ObjectMeta { + return ObjectMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectMeta { + const message = createBaseObjectMeta(); + message.name = object.name ?? ""; + message.generateName = object.generateName ?? ""; + message.namespace = object.namespace ?? ""; + message.selfLink = object.selfLink ?? ""; + message.uid = object.uid ?? ""; + message.resourceVersion = object.resourceVersion ?? ""; + message.generation = object.generation ?? 0; + message.creationTimestamp = (object.creationTimestamp !== undefined && object.creationTimestamp !== null) + ? Time.fromPartial(object.creationTimestamp) + : undefined; + message.deletionTimestamp = (object.deletionTimestamp !== undefined && object.deletionTimestamp !== null) + ? Time.fromPartial(object.deletionTimestamp) + : undefined; + message.deletionGracePeriodSeconds = object.deletionGracePeriodSeconds ?? 0; + message.labels = (globalThis.Object.entries(object.labels ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.annotations = (globalThis.Object.entries(object.annotations ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.ownerReferences = object.ownerReferences?.map((e) => OwnerReference.fromPartial(e)) || []; + message.finalizers = object.finalizers?.map((e) => e) || []; + message.managedFields = object.managedFields?.map((e) => ManagedFieldsEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseObjectMeta_LabelsEntry(): ObjectMeta_LabelsEntry { + return { key: "", value: "" }; +} + +export const ObjectMeta_LabelsEntry: MessageFns = { + encode(message: ObjectMeta_LabelsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectMeta_LabelsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectMeta_LabelsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectMeta_LabelsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ObjectMeta_LabelsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ObjectMeta_LabelsEntry { + return ObjectMeta_LabelsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectMeta_LabelsEntry { + const message = createBaseObjectMeta_LabelsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseObjectMeta_AnnotationsEntry(): ObjectMeta_AnnotationsEntry { + return { key: "", value: "" }; +} + +export const ObjectMeta_AnnotationsEntry: MessageFns = { + encode(message: ObjectMeta_AnnotationsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectMeta_AnnotationsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectMeta_AnnotationsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ObjectMeta_AnnotationsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ObjectMeta_AnnotationsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ObjectMeta_AnnotationsEntry { + return ObjectMeta_AnnotationsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ObjectMeta_AnnotationsEntry { + const message = createBaseObjectMeta_AnnotationsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseOwnerReference(): OwnerReference { + return { apiVersion: "", kind: "", name: "", uid: "", controller: false, blockOwnerDeletion: false }; +} + +export const OwnerReference: MessageFns = { + encode(message: OwnerReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.apiVersion !== undefined && message.apiVersion !== "") { + writer.uint32(42).string(message.apiVersion); + } + if (message.kind !== undefined && message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.name !== undefined && message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.uid !== undefined && message.uid !== "") { + writer.uint32(34).string(message.uid); + } + if (message.controller !== undefined && message.controller !== false) { + writer.uint32(48).bool(message.controller); + } + if (message.blockOwnerDeletion !== undefined && message.blockOwnerDeletion !== false) { + writer.uint32(56).bool(message.blockOwnerDeletion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OwnerReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOwnerReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + if (tag !== 42) { + break; + } + + message.apiVersion = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.uid = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.controller = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.blockOwnerDeletion = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): OwnerReference { + return { + apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : "", + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + uid: isSet(object.uid) ? globalThis.String(object.uid) : "", + controller: isSet(object.controller) ? globalThis.Boolean(object.controller) : false, + blockOwnerDeletion: isSet(object.blockOwnerDeletion) ? globalThis.Boolean(object.blockOwnerDeletion) : false, + }; + }, + + toJSON(message: OwnerReference): unknown { + const obj: any = {}; + if (message.apiVersion !== undefined && message.apiVersion !== "") { + obj.apiVersion = message.apiVersion; + } + if (message.kind !== undefined && message.kind !== "") { + obj.kind = message.kind; + } + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.uid !== undefined && message.uid !== "") { + obj.uid = message.uid; + } + if (message.controller !== undefined && message.controller !== false) { + obj.controller = message.controller; + } + if (message.blockOwnerDeletion !== undefined && message.blockOwnerDeletion !== false) { + obj.blockOwnerDeletion = message.blockOwnerDeletion; + } + return obj; + }, + + create, I>>(base?: I): OwnerReference { + return OwnerReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OwnerReference { + const message = createBaseOwnerReference(); + message.apiVersion = object.apiVersion ?? ""; + message.kind = object.kind ?? ""; + message.name = object.name ?? ""; + message.uid = object.uid ?? ""; + message.controller = object.controller ?? false; + message.blockOwnerDeletion = object.blockOwnerDeletion ?? false; + return message; + }, +}; + +function createBasePartialObjectMetadata(): PartialObjectMetadata { + return { metadata: undefined }; +} + +export const PartialObjectMetadata: MessageFns = { + encode(message: PartialObjectMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ObjectMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartialObjectMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartialObjectMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ObjectMeta.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PartialObjectMetadata { + return { metadata: isSet(object.metadata) ? ObjectMeta.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: PartialObjectMetadata): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ObjectMeta.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): PartialObjectMetadata { + return PartialObjectMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartialObjectMetadata { + const message = createBasePartialObjectMetadata(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? ObjectMeta.fromPartial(object.metadata) + : undefined; + return message; + }, +}; + +function createBasePartialObjectMetadataList(): PartialObjectMetadataList { + return { metadata: undefined, items: [] }; +} + +export const PartialObjectMetadataList: MessageFns = { + encode(message: PartialObjectMetadataList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + for (const v of message.items) { + PartialObjectMetadata.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartialObjectMetadataList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartialObjectMetadataList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(PartialObjectMetadata.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PartialObjectMetadataList { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => PartialObjectMetadata.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PartialObjectMetadataList): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.items?.length) { + obj.items = message.items.map((e) => PartialObjectMetadata.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PartialObjectMetadataList { + return PartialObjectMetadataList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartialObjectMetadataList { + const message = createBasePartialObjectMetadataList(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.items = object.items?.map((e) => PartialObjectMetadata.fromPartial(e)) || []; + return message; + }, +}; + +function createBasePatch(): Patch { + return {}; +} + +export const Patch: MessageFns = { + encode(_: Patch, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Patch { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(_: any): Patch { + return {}; + }, + + toJSON(_: Patch): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Patch { + return Patch.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Patch { + const message = createBasePatch(); + return message; + }, +}; + +function createBasePatchOptions(): PatchOptions { + return { dryRun: [], force: false, fieldManager: "", fieldValidation: "" }; +} + +export const PatchOptions: MessageFns = { + encode(message: PatchOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.dryRun) { + writer.uint32(10).string(v!); + } + if (message.force !== undefined && message.force !== false) { + writer.uint32(16).bool(message.force); + } + if (message.fieldManager !== undefined && message.fieldManager !== "") { + writer.uint32(26).string(message.fieldManager); + } + if (message.fieldValidation !== undefined && message.fieldValidation !== "") { + writer.uint32(34).string(message.fieldValidation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PatchOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePatchOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.dryRun.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.force = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.fieldManager = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.fieldValidation = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): PatchOptions { + return { + dryRun: globalThis.Array.isArray(object?.dryRun) ? object.dryRun.map((e: any) => globalThis.String(e)) : [], + force: isSet(object.force) ? globalThis.Boolean(object.force) : false, + fieldManager: isSet(object.fieldManager) ? globalThis.String(object.fieldManager) : "", + fieldValidation: isSet(object.fieldValidation) ? globalThis.String(object.fieldValidation) : "", + }; + }, + + toJSON(message: PatchOptions): unknown { + const obj: any = {}; + if (message.dryRun?.length) { + obj.dryRun = message.dryRun; + } + if (message.force !== undefined && message.force !== false) { + obj.force = message.force; + } + if (message.fieldManager !== undefined && message.fieldManager !== "") { + obj.fieldManager = message.fieldManager; + } + if (message.fieldValidation !== undefined && message.fieldValidation !== "") { + obj.fieldValidation = message.fieldValidation; + } + return obj; + }, + + create, I>>(base?: I): PatchOptions { + return PatchOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PatchOptions { + const message = createBasePatchOptions(); + message.dryRun = object.dryRun?.map((e) => e) || []; + message.force = object.force ?? false; + message.fieldManager = object.fieldManager ?? ""; + message.fieldValidation = object.fieldValidation ?? ""; + return message; + }, +}; + +function createBasePreconditions(): Preconditions { + return { uid: "", resourceVersion: "" }; +} + +export const Preconditions: MessageFns = { + encode(message: Preconditions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uid !== undefined && message.uid !== "") { + writer.uint32(10).string(message.uid); + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + writer.uint32(18).string(message.resourceVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Preconditions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePreconditions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.uid = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resourceVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Preconditions { + return { + uid: isSet(object.uid) ? globalThis.String(object.uid) : "", + resourceVersion: isSet(object.resourceVersion) ? globalThis.String(object.resourceVersion) : "", + }; + }, + + toJSON(message: Preconditions): unknown { + const obj: any = {}; + if (message.uid !== undefined && message.uid !== "") { + obj.uid = message.uid; + } + if (message.resourceVersion !== undefined && message.resourceVersion !== "") { + obj.resourceVersion = message.resourceVersion; + } + return obj; + }, + + create, I>>(base?: I): Preconditions { + return Preconditions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Preconditions { + const message = createBasePreconditions(); + message.uid = object.uid ?? ""; + message.resourceVersion = object.resourceVersion ?? ""; + return message; + }, +}; + +function createBaseRootPaths(): RootPaths { + return { paths: [] }; +} + +export const RootPaths: MessageFns = { + encode(message: RootPaths, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.paths) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RootPaths { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRootPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.paths.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): RootPaths { + return { paths: globalThis.Array.isArray(object?.paths) ? object.paths.map((e: any) => globalThis.String(e)) : [] }; + }, + + toJSON(message: RootPaths): unknown { + const obj: any = {}; + if (message.paths?.length) { + obj.paths = message.paths; + } + return obj; + }, + + create, I>>(base?: I): RootPaths { + return RootPaths.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RootPaths { + const message = createBaseRootPaths(); + message.paths = object.paths?.map((e) => e) || []; + return message; + }, +}; + +function createBaseServerAddressByClientCIDR(): ServerAddressByClientCIDR { + return { clientCIDR: "", serverAddress: "" }; +} + +export const ServerAddressByClientCIDR: MessageFns = { + encode(message: ServerAddressByClientCIDR, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientCIDR !== undefined && message.clientCIDR !== "") { + writer.uint32(10).string(message.clientCIDR); + } + if (message.serverAddress !== undefined && message.serverAddress !== "") { + writer.uint32(18).string(message.serverAddress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServerAddressByClientCIDR { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServerAddressByClientCIDR(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.clientCIDR = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.serverAddress = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ServerAddressByClientCIDR { + return { + clientCIDR: isSet(object.clientCIDR) ? globalThis.String(object.clientCIDR) : "", + serverAddress: isSet(object.serverAddress) ? globalThis.String(object.serverAddress) : "", + }; + }, + + toJSON(message: ServerAddressByClientCIDR): unknown { + const obj: any = {}; + if (message.clientCIDR !== undefined && message.clientCIDR !== "") { + obj.clientCIDR = message.clientCIDR; + } + if (message.serverAddress !== undefined && message.serverAddress !== "") { + obj.serverAddress = message.serverAddress; + } + return obj; + }, + + create, I>>(base?: I): ServerAddressByClientCIDR { + return ServerAddressByClientCIDR.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServerAddressByClientCIDR { + const message = createBaseServerAddressByClientCIDR(); + message.clientCIDR = object.clientCIDR ?? ""; + message.serverAddress = object.serverAddress ?? ""; + return message; + }, +}; + +function createBaseShardInfo(): ShardInfo { + return { selector: "" }; +} + +export const ShardInfo: MessageFns = { + encode(message: ShardInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selector !== undefined && message.selector !== "") { + writer.uint32(10).string(message.selector); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ShardInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShardInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.selector = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): ShardInfo { + return { selector: isSet(object.selector) ? globalThis.String(object.selector) : "" }; + }, + + toJSON(message: ShardInfo): unknown { + const obj: any = {}; + if (message.selector !== undefined && message.selector !== "") { + obj.selector = message.selector; + } + return obj; + }, + + create, I>>(base?: I): ShardInfo { + return ShardInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ShardInfo { + const message = createBaseShardInfo(); + message.selector = object.selector ?? ""; + return message; + }, +}; + +function createBaseStatus(): Status { + return { metadata: undefined, status: "", message: "", reason: "", details: undefined, code: 0 }; +} + +export const Status: MessageFns = { + encode(message: Status, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + ListMeta.encode(message.metadata, writer.uint32(10).fork()).join(); + } + if (message.status !== undefined && message.status !== "") { + writer.uint32(18).string(message.status); + } + if (message.message !== undefined && message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.reason !== undefined && message.reason !== "") { + writer.uint32(34).string(message.reason); + } + if (message.details !== undefined) { + StatusDetails.encode(message.details, writer.uint32(42).fork()).join(); + } + if (message.code !== undefined && message.code !== 0) { + writer.uint32(48).int32(message.code); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Status { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.metadata = ListMeta.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.status = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reason = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.details = StatusDetails.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.code = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): Status { + return { + metadata: isSet(object.metadata) ? ListMeta.fromJSON(object.metadata) : undefined, + status: isSet(object.status) ? globalThis.String(object.status) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", + details: isSet(object.details) ? StatusDetails.fromJSON(object.details) : undefined, + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + }; + }, + + toJSON(message: Status): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = ListMeta.toJSON(message.metadata); + } + if (message.status !== undefined && message.status !== "") { + obj.status = message.status; + } + if (message.message !== undefined && message.message !== "") { + obj.message = message.message; + } + if (message.reason !== undefined && message.reason !== "") { + obj.reason = message.reason; + } + if (message.details !== undefined) { + obj.details = StatusDetails.toJSON(message.details); + } + if (message.code !== undefined && message.code !== 0) { + obj.code = Math.round(message.code); + } + return obj; + }, + + create, I>>(base?: I): Status { + return Status.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Status { + const message = createBaseStatus(); + message.metadata = (object.metadata !== undefined && object.metadata !== null) + ? ListMeta.fromPartial(object.metadata) + : undefined; + message.status = object.status ?? ""; + message.message = object.message ?? ""; + message.reason = object.reason ?? ""; + message.details = (object.details !== undefined && object.details !== null) + ? StatusDetails.fromPartial(object.details) + : undefined; + message.code = object.code ?? 0; + return message; + }, +}; + +function createBaseStatusCause(): StatusCause { + return { reason: "", message: "", field: "" }; +} + +export const StatusCause: MessageFns = { + encode(message: StatusCause, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reason !== undefined && message.reason !== "") { + writer.uint32(10).string(message.reason); + } + if (message.message !== undefined && message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.field !== undefined && message.field !== "") { + writer.uint32(26).string(message.field); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusCause { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusCause(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.reason = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatusCause { + return { + reason: isSet(object.reason) ? globalThis.String(object.reason) : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + }; + }, + + toJSON(message: StatusCause): unknown { + const obj: any = {}; + if (message.reason !== undefined && message.reason !== "") { + obj.reason = message.reason; + } + if (message.message !== undefined && message.message !== "") { + obj.message = message.message; + } + if (message.field !== undefined && message.field !== "") { + obj.field = message.field; + } + return obj; + }, + + create, I>>(base?: I): StatusCause { + return StatusCause.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatusCause { + const message = createBaseStatusCause(); + message.reason = object.reason ?? ""; + message.message = object.message ?? ""; + message.field = object.field ?? ""; + return message; + }, +}; + +function createBaseStatusDetails(): StatusDetails { + return { name: "", group: "", kind: "", uid: "", causes: [], retryAfterSeconds: 0 }; +} + +export const StatusDetails: MessageFns = { + encode(message: StatusDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.group !== undefined && message.group !== "") { + writer.uint32(18).string(message.group); + } + if (message.kind !== undefined && message.kind !== "") { + writer.uint32(26).string(message.kind); + } + if (message.uid !== undefined && message.uid !== "") { + writer.uint32(50).string(message.uid); + } + for (const v of message.causes) { + StatusCause.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.retryAfterSeconds !== undefined && message.retryAfterSeconds !== 0) { + writer.uint32(40).int32(message.retryAfterSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatusDetails { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.group = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.kind = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.uid = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.causes.push(StatusCause.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.retryAfterSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): StatusDetails { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + group: isSet(object.group) ? globalThis.String(object.group) : "", + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + uid: isSet(object.uid) ? globalThis.String(object.uid) : "", + causes: globalThis.Array.isArray(object?.causes) ? object.causes.map((e: any) => StatusCause.fromJSON(e)) : [], + retryAfterSeconds: isSet(object.retryAfterSeconds) ? globalThis.Number(object.retryAfterSeconds) : 0, + }; + }, + + toJSON(message: StatusDetails): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.group !== undefined && message.group !== "") { + obj.group = message.group; + } + if (message.kind !== undefined && message.kind !== "") { + obj.kind = message.kind; + } + if (message.uid !== undefined && message.uid !== "") { + obj.uid = message.uid; + } + if (message.causes?.length) { + obj.causes = message.causes.map((e) => StatusCause.toJSON(e)); + } + if (message.retryAfterSeconds !== undefined && message.retryAfterSeconds !== 0) { + obj.retryAfterSeconds = Math.round(message.retryAfterSeconds); + } + return obj; + }, + + create, I>>(base?: I): StatusDetails { + return StatusDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StatusDetails { + const message = createBaseStatusDetails(); + message.name = object.name ?? ""; + message.group = object.group ?? ""; + message.kind = object.kind ?? ""; + message.uid = object.uid ?? ""; + message.causes = object.causes?.map((e) => StatusCause.fromPartial(e)) || []; + message.retryAfterSeconds = object.retryAfterSeconds ?? 0; + return message; + }, +}; + +function createBaseTableOptions(): TableOptions { + return { includeObject: "" }; +} + +export const TableOptions: MessageFns = { + encode(message: TableOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.includeObject !== undefined && message.includeObject !== "") { + writer.uint32(10).string(message.includeObject); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0; + if (previousRecursionDepth >= 100) { + throw new globalThis.Error("protobuf decode recursion limit exceeded"); + } + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1; + try { + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTableOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.includeObject = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + } finally { + (reader as any).__tsProtoDecodeDepth = previousRecursionDepth; + } + }, + + fromJSON(object: any): TableOptions { + return { includeObject: isSet(object.includeObject) ? globalThis.String(object.includeObject) : "" }; + }, + + toJSON(message: TableOptions): unknown { + const obj: any = {}; + if (message.includeObject !== undefined && message.includeObject !== "") { + obj.includeObject = message.includeObject; + } + return obj; + }, + + create, I>>(base?: I): TableOptions { + return TableOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TableOptions { + const message = createBaseTableOptions(); + message.includeObject = object.includeObject ?? ""; + return message; + }, +}; + +function createBaseTime(): Time { + return { seconds: 0, nanos: 0 }; +} + +export const Time: MessageFns